[Intel-gfx] [PATCH v2] drm/i915: Priority boost for new clients

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 8 18:53:33 UTC 2018


Quoting Tvrtko Ursulin (2018-08-08 13:40:41)
> 
> On 07/08/2018 16:02, Chris Wilson wrote:
> > Quoting Tvrtko Ursulin (2018-08-07 10:08:28)
> >>
> >> On 07/08/2018 08:29, Chris Wilson wrote:
> >>> +     /*
> >>> +      * The active request is now effectively the start of a new client
> >>> +      * stream, so give it the equivalent small priority bump to prevent
> >>> +      * it being gazumped a second time by another peer.
> >>> +      */
> >>> +     if (!(prio & I915_PRIORITY_NEWCLIENT)) {
> >>> +             list_move_tail(&active->sched.link,
> >>> +                            lookup_priolist(engine,
> >>> +                                            prio | I915_PRIORITY_NEWCLIENT));
> >>>        }
> >>>    }
> >>>    
> >>>
> >>
> >> This sounds fair, I think I'm okay with it. Does it still work well for
> >> mixed media workloads?
> > 
> > Grr. Current drm-tip is scoring much much higher in fairness than I
> > remember, and there's no apparent improvement, even little room for
> > possible improvement. When in doubt, blame ksoftirqd ;)
> 
> Perhaps previous testing was before direct submission?

I went back and checked that, unfortunately not that simple. The
influencing factor appears to be the choice of workload. I am seeing
some now that respond favourably (by pure chance selection) but I need
to spend more time to ensure the results are stable, and see if there's
any method to the madness in selection.
 
> > Quite surprising though, it was (at least if memory serves) a dramatic
> > improvement from this patch. Time to see if the metrics do resemble what
> > I think they should be, and to see if I can find a good example in
> > media-bench.pl
> 
> I should maybe rename it to wsim-bench.pl with a switch to select 
> workload groups per directory or something..

What I'm thinking is closer to the expression I want is

diff --git a/scripts/media-bench.pl b/scripts/media-bench.pl
index ddf9c0ec..f39b1bb1 100755
--- a/scripts/media-bench.pl
+++ b/scripts/media-bench.pl
@@ -339,7 +339,6 @@ sub find_saturation_point
                } elsif ($c == 1) {
                        $swps = $wps;
                        return ($c, $wps, $swps, $wwps) if $wcnt > 1 or
-                                                          $multi_mode or
                                                           ($wps_target_param < 0 and
                                                            $wps_target == 0);
                }

We want to find the saturated peak of each wsim. We could use sim_wsim
for this.

@@ -553,7 +552,7 @@ foreach my $wrk (@saturation_workloads) {

                                        # Normalize mixed sum with sum of
                                        # individual runs.
-                                       $w *= 100;
+                                       $w *= 100 * scalar(@multi_workloads);
                                        $w /= $tot;

Knowing the saturation point of each wsim, we should be able to saturate
the engine running all simultaneous, each taking 1/N of the bw.
(Spherical cows and all that). Applying the factor of N here sets the
normalized target to 100%.

                                        # Second metric is average of each
@@ -563,10 +562,11 @@ foreach my $wrk (@saturation_workloads) {
                                        $s = 0;
                                        $widx = 0;
                                        foreach my $wrk (@multi_workloads) {
-                                               $s += 100 * $bwwps->[$widx] /
-                                                     $allwps{$wrk}->{$best_bid{$wrk}};
+                                               my $target = $allwps{$wrk}->{$best_bid{$wrk}} / scalar(@multi_workloads);
+                                               $s += 1. - abs($target - $bwwps->[$widx]) / $target;
                                                $widx++;
                                        }
+                                       $s *= 100;
                                        $s /= scalar(@multi_workloads);

This is the challenge. My idea of fairness is that each wsim got 1/N of
the bw, so should see wps of its saturated max / N. Fairness is then how
close we get to our theoretical fair slice.

Problem is the spherical cows are multiplying. It's box packing (linear
optimisation) problem, probably best to quantify the ideal fair slice
using sim_wsim and then report how unfair reality was.
-Chris


More information about the Intel-gfx mailing list