linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Newman <peternewman@google.com>
To: Reinette Chatre <reinette.chatre@intel.com>
Cc: James Morse <james.morse@arm.com>,
	Tony Luck <tony.luck@intel.com>,
	"Yu, Fenghua" <fenghua.yu@intel.com>,
	"Eranian, Stephane" <eranian@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Babu Moger <Babu.Moger@amd.com>,
	Gaurang Upasani <gupasani@google.com>
Subject: Re: [RFD] resctrl: reassigning a running container's CTRL_MON group
Date: Tue, 1 Nov 2022 16:23:13 +0100	[thread overview]
Message-ID: <CALPaoCj8bVo3Z1r9_Ag=6KvGuR2wzQesArwZKEDvudGPYbbwaA@mail.gmail.com> (raw)
In-Reply-To: <08c0e91a-a17a-5dad-0638-800a4db5034f@intel.com>

Hi Reinette,

On Thu, Oct 27, 2022 at 7:36 PM Reinette Chatre
<reinette.chatre@intel.com> wrote:
> On 10/27/2022 12:56 AM, Peter Newman wrote:
> > On Wed, Oct 26, 2022 at 11:12 PM Reinette Chatre
> > <reinette.chatre@intel.com> 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.

Yes it looks like the task's rq_lock would provide the necessary
ordering. It's not feasible to ensure the IPI arrives before the target
task migrates away, but the task would need to obtain the same lock in
order to migrate off of its current CPU, so that alone would ensure the
next migration would observe the updates.

The difficulty is this lock is private to sched/, so I'd have to propose
some API.

It would make sense for the API to return the result of task_curr(t) and
task_cpu(t) to the caller to avoid giving the impression that this
function would be useful for anything other than helping someone do an
smp_call_function targeting a task's CPU.

I'll just have to push a patch and see what people say.

-Peter

  reply	other threads:[~2022-11-01 15:23 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07 10:39 [RFD] resctrl: reassigning a running container's CTRL_MON group Peter Newman
2022-10-07 15:36 ` Reinette Chatre
2022-10-07 15:44   ` Yu, Fenghua
2022-10-07 17:28     ` Tony Luck
2022-10-10 23:35       ` Reinette Chatre
2022-10-12 11:21         ` Peter Newman
2022-10-12 16:55           ` James Morse
2022-10-17 10:15             ` Peter Newman
2022-10-19 13:57               ` James Morse
2022-10-20 10:39                 ` Peter Newman
2022-10-21 12:42                   ` Peter Newman
2022-10-25 15:55                     ` James Morse
2022-10-26  8:52                       ` Peter Newman
2022-10-26 21:12                         ` Reinette Chatre
2022-10-27  7:56                           ` Peter Newman
2022-10-27 17:35                             ` Reinette Chatre
2022-11-01 15:23                               ` Peter Newman [this message]
2022-11-01 15:53                                 ` Peter Newman
2022-11-01 16:48                                   ` Reinette Chatre
2022-10-25 15:56                   ` James Morse
2022-10-21 20:09                 ` Reinette Chatre
2022-10-21 20:22                   ` Luck, Tony
2022-10-21 21:34                     ` Reinette Chatre
2022-11-03 17:06                   ` James Morse
2022-11-08 21:28                     ` Reinette Chatre
2022-11-08 21:56                       ` Luck, Tony
2022-11-08 23:18                         ` Reinette Chatre
2022-11-09 17:58                           ` James Morse
2022-11-09  9:50                       ` Peter Newman
2022-11-09 19:11                         ` Reinette Chatre
2022-11-11 18:38                           ` James Morse
2022-11-14 18:02                             ` Reinette Chatre
2022-11-16 13:20                             ` Peter Newman
2022-11-09 17:59                       ` James Morse
2022-11-09 19:12                         ` Reinette Chatre
2022-11-11 18:36                           ` James Morse
2022-10-12 16:57           ` Yu, Fenghua
2022-10-12 17:23           ` Reinette Chatre
2022-10-14 12:56             ` James Morse
2022-10-19  9:08             ` Peter Newman
2022-10-19 13:20               ` James Morse
2022-10-19 23:54               ` Reinette Chatre
2022-10-20  8:48                 ` Peter Newman
2022-10-20 19:08                   ` Reinette Chatre
2022-10-21 10:09                     ` Peter Newman
2022-10-25 15:56                       ` James Morse
2022-10-25 15:55                     ` James Morse
2022-10-26  9:36                       ` Peter Newman
2022-11-03 17:06                         ` James Morse
2022-11-08 21:25                           ` Reinette Chatre
2022-10-07 17:57 ` Moger, Babu
2022-10-11 15:00   ` Stephane Eranian
2022-10-11 14:59 ` Stephane Eranian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALPaoCj8bVo3Z1r9_Ag=6KvGuR2wzQesArwZKEDvudGPYbbwaA@mail.gmail.com' \
    --to=peternewman@google.com \
    --cc=Babu.Moger@amd.com \
    --cc=eranian@google.com \
    --cc=fenghua.yu@intel.com \
    --cc=gupasani@google.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).