Re: [RFD] resctrl: reassigning a running container's CTRL_MON group

From: Reinette Chatre
Date: Thu Oct 27 2022 - 13:36:18 EST


Hi Peter,

On 10/27/2022 12:56 AM, Peter Newman wrote:
> On Wed, Oct 26, 2022 at 11:12 PM Reinette Chatre
> <reinette.chatre@xxxxxxxxx> wrote:
>> The original concern is "the stores to t->closid and t->rmid could be
>> reordered with the task_curr(t) and task_cpu(t) reads which follow". I can see
>> that issue. Have you considered using the compiler barrier, barrier(), instead?
>> From what I understand it will prevent the compiler from moving the memory accesses.
>> This is what is currently done in __rdtgroup_move_task() and could be done here also?
>
> A memory system (including those on x86) is allowed to reorder a store with a
> later load, in addition to the compiler.
>
> Also because the locations in question can be concurrently accessed by another
> CPU, a compiler barrier would not be sufficient.

This is hard. Regarding the concurrent access from another CPU it seems
that task_rq_lock() is available to prevent races with schedule(). Using this
may be able to prevent task_curr(t) changing during this time and thus the local
reordering may not be a problem. I am not familiar with task_rq_lock() though,
surely there are many details to consider in this area.

Reinette