Messages in this thread | | | Subject | Re: [PATCH 2/3] x86/resctrl: Update PQR_ASSOC MSR synchronously when moving task to resource group | From | Reinette Chatre <> | Date | Wed, 16 Dec 2020 10:26:50 -0800 |
| |
Hi Valentin,
On 12/16/2020 9:41 AM, Valentin Schneider wrote: > > 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.
Could you please elaborate why it would be an issue is the closid write is ordered after the task_curr() read? task_curr() does not depend on the closid.
> With > > tsk->closid = x; > > barrier(); > > if (task_curr(tsk)) > smp_call(...); > > that explicitely cannot happen. >
Reinette
| |