[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <jhj1rfptzqt.mognet@arm.com>
Date: Wed, 16 Dec 2020 17:41:30 +0000
From: Valentin Schneider <valentin.schneider@....com>
To: Reinette Chatre <reinette.chatre@...el.com>
Cc: tglx@...utronix.de, fenghua.yu@...el.com, bp@...en8.de,
tony.luck@...el.com, kuo-lang.tseng@...el.com, shakeelb@...gle.com,
mingo@...hat.com, babu.moger@....com, james.morse@....com,
hpa@...or.com, x86@...nel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH 2/3] x86/resctrl: Update PQR_ASSOC MSR synchronously when moving task to resource group
On 14/12/20 18:41, Reinette Chatre wrote:
>>> - return ret;
>>> +
>>> + /*
>>> + * By now, the task's closid and rmid are set. If the task is current
>>> + * on a CPU, the PQR_ASSOC MSR needs to be updated to make the resource
>>> + * group go into effect. If the task is not current, the MSR will be
>>> + * updated when the task is scheduled in.
>>> + */
>>> + update_task_closid_rmid(tsk);
>>
>> We need the above writes to be compile-ordered before the IPI is sent.
>> There *is* a preempt_disable() down in smp_call_function_single() that
>> gives us the required barrier(), can we deem that sufficient or would we
>> want one before update_task_closid_rmid() for the sake of clarity?
>>
>
> Apologies, it is not clear to me why the preempt_disable() would be
> insufficient. If it is not then there may be a few other areas (where
> resctrl calls smp_call_function_xxx()) that needs to be re-evaluated.
So that's part paranoia and part nonsense from my end - the contents of
smp_call() shouldn't matter here.
If we distill the code to:
tsk->closid = x;
if (task_curr(tsk))
smp_call(...);
It is somewhat far fetched, but AFAICT this can be compiled as:
if (task_curr(tsk))
tsk->closid = x;
smp_call(...);
else
tsk->closid = x;
IOW, there could be a sequence where the closid write is ordered *after*
the task_curr() read. With
tsk->closid = x;
barrier();
if (task_curr(tsk))
smp_call(...);
that explicitely cannot happen.
>
> Thank you very much
>
> Reinette
Powered by blists - more mailing lists