[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cdcfcd64-c76f-0d2d-6653-0229c956f2bc@intel.com>
Date: Fri, 9 Dec 2022 15:54:28 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: Peter Newman <peternewman@...gle.com>
CC: <bp@...en8.de>, <derkling@...gle.com>, <eranian@...gle.com>,
<fenghua.yu@...el.com>, <hpa@...or.com>, <james.morse@....com>,
<jannh@...gle.com>, <kpsingh@...gle.com>,
<linux-kernel@...r.kernel.org>, <mingo@...hat.com>,
<tglx@...utronix.de>, <x86@...nel.org>
Subject: Re: [PATCH v4 1/2] x86/resctrl: Update task closid/rmid with
task_call_func()
Hi Peter,
On 12/8/2022 2:30 PM, Peter Newman wrote:
> On Wed, Dec 7, 2022 at 7:41 PM Reinette Chatre <reinette.chatre@...el.com> wrote:
>> On 12/7/2022 2:58 AM, Peter Newman wrote:
>>>>> 2. resctrl_sched_in() loads t->{closid,rmid} before the calling context
>>>>> switch stores new task_curr() and task_cpu() values.
...
>
> Based on this, I'll just sketch out the first scenario below and drop
> (2) from the changelog. This also implies that the group update cases
ok, thank you for doing that analysis.
> can use a single smp_mb() to provide all the necessary ordering, because
> there's a full barrier on context switch for it to pair with, so I don't
> need to broadcast IPI anymore. I don't know whether task_call_func() is
This is not clear to me because rdt_move_group_tasks() seems to have the
same code as shown below as vulnerable to re-ordering. Only difference
is that it uses the "//false" checks to set a bit in the cpumask for a
later IPI instead of an immediate IPI.
> faster than an smp_mb(). I'll take some measurements to see.
>
> The presumed behavior is __rdtgroup_move_task() not seeing t1 running
> yet implies that it observes the updated values:
>
> CPU 0 CPU 1
> ----- -----
> (t1->{closid,rmid} -> {1,1}) (rq->curr -> t0)
>
> __rdtgroup_move_task():
> t1->{closid,rmid} <- {2,2}
> curr <- t1->cpu->rq->curr
> __schedule():
> rq->curr <- t1
> resctrl_sched_in():
> t1->{closid,rmid} -> {2,2}
> if (curr == t1) // false
> IPI(t1->cpu)
I understand that the test is false when it may be expected to be true, but
there does not seem to be a problem because of that. t1 was scheduled in with
the correct CLOSID/RMID and its CPU did not get an unnecessary IPI.
> In (1), CPU 0 is allowed to store {closid,rmid} after reading whether t1
> is current:
>
> CPU 0 CPU 1
> ----- -----
> __rdtgroup_move_task():
> curr <- t1->cpu->rq->curr
> __schedule():
> rq->curr <- t1
> resctrl_sched_in():
> t1->{closid,rmid} -> {1,1}
> t1->{closid,rmid} <- {2,2}
> if (curr == t1) // false
> IPI(t1->cpu)
Yes, this I understand to be the problematic scenario.
> Please let me know if these diagrams clarify things.
They do, thank you very much.
Reinette
Powered by blists - more mailing lists