<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Another big question:<o:p></o:p></p>
<p class="MsoNormal">I agree the general idea is good to balance scheduler load for same ring family.<o:p></o:p></p>
<p class="MsoNormal">But, when same entity job run on different scheduler, that means the later job could be completed ahead of front, Right?<o:p></o:p></p>
<p class="MsoNormal">That will break fence design, later fence must be signaled after front fence in same fence context.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Anything I missed?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">David Zhou<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>From:</b> dri-devel <dri-devel-bounces@lists.freedesktop.org>
<b>On Behalf Of </b>Nayan Deshmukh<br>
<b>Sent:</b> Thursday, August 02, 2018 12:07 AM<br>
<b>To:</b> Grodzovsky, Andrey <Andrey.Grodzovsky@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org; Maling list - DRI developers <dri-devel@lists.freedesktop.org>; Koenig, Christian <Christian.Koenig@amd.com><br>
<b>Subject:</b> Re: [PATCH 3/4] drm/scheduler: add new function to get least loaded sched v2<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Yes, that is correct. <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Nayan<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Wed, Aug 1, 2018, 9:05 PM Andrey Grodzovsky <<a href="mailto:Andrey.Grodzovsky@amd.com">Andrey.Grodzovsky@amd.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal" style="margin-bottom:12.0pt">Clarification question - if the run queues belong to different
<br>
schedulers they effectively point to different rings,<br>
<br>
it means we allow to move (reschedule) a drm_sched_entity from one ring <br>
to another - i assume that the idea int the first place, that<br>
<br>
you have a set of HW rings and you can utilize any of them for your jobs <br>
(like compute rings). Correct ?<br>
<br>
Andrey<br>
<br>
<br>
On 08/01/2018 04:20 AM, Nayan Deshmukh wrote:<br>
> The function selects the run queue from the rq_list with the<br>
> least load. The load is decided by the number of jobs in a<br>
> scheduler.<br>
><br>
> v2: avoid using atomic read twice consecutively, instead store<br>
> it locally<br>
><br>
> Signed-off-by: Nayan Deshmukh <<a href="mailto:nayan26deshmukh@gmail.com" target="_blank">nayan26deshmukh@gmail.com</a>><br>
> ---<br>
> drivers/gpu/drm/scheduler/gpu_scheduler.c | 25 +++++++++++++++++++++++++<br>
> 1 file changed, 25 insertions(+)<br>
><br>
> diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c<br>
> index 375f6f7f6a93..fb4e542660b0 100644<br>
> --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c<br>
> +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c<br>
> @@ -255,6 +255,31 @@ static bool drm_sched_entity_is_ready(struct drm_sched_entity *entity)<br>
> return true;<br>
> }<br>
> <br>
> +/**<br>
> + * drm_sched_entity_get_free_sched - Get the rq from rq_list with least load<br>
> + *<br>
> + * @entity: scheduler entity<br>
> + *<br>
> + * Return the pointer to the rq with least load.<br>
> + */<br>
> +static struct drm_sched_rq *<br>
> +drm_sched_entity_get_free_sched(struct drm_sched_entity *entity)<br>
> +{<br>
> + struct drm_sched_rq *rq = NULL;<br>
> + unsigned int min_jobs = UINT_MAX, num_jobs;<br>
> + int i;<br>
> +<br>
> + for (i = 0; i < entity->num_rq_list; ++i) {<br>
> + num_jobs = atomic_read(&entity->rq_list[i]->sched->num_jobs);<br>
> + if (num_jobs < min_jobs) {<br>
> + min_jobs = num_jobs;<br>
> + rq = entity->rq_list[i];<br>
> + }<br>
> + }<br>
> +<br>
> + return rq;<br>
> +}<br>
> +<br>
> static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,<br>
> struct dma_fence_cb *cb)<br>
> {<o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>