Archive-only list for patches
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: <kees@kernel.org>, <mingo@redhat.com>, <peterz@infradead.org>,
	<juri.lelli@redhat.com>, <vincent.guittot@linaro.org>,
	<dietmar.eggemann@arm.com>, <rostedt@goodmis.org>,
	<bsegall@google.com>, <mgorman@suse.de>, <vschneid@redhat.com>,
	<kprateek.nayak@amd.com>, <david@kernel.org>, <ljs@kernel.org>,
	<liam@infradead.org>, <vbabka@kernel.org>, <rppt@kernel.org>,
	<surenb@google.com>, <mhocko@suse.com>, <ben.horgan@arm.com>,
	<bp@alien8.de>, <tglx@linutronix.de>,
	<dave.hansen@linux.intel.com>, <Dave.Martin@arm.com>,
	<james.morse@arm.com>, <babu.moger@amd.com>, <fustini@kernel.org>,
	<jedrzej.wasiukiewicz@intel.com>, <fenghuay@nvidia.com>,
	<peternewman@google.com>, <yu.c.chen@intel.com>, <x86@kernel.org>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<patches@lists.linux.dev>
Subject: Re: [PATCH v2 0/4] fork,arm,x86,fs/resctrl: Fix stale resource group assignment on fork
Date: Fri, 4 Dec 2026 15:00:31 -0800	[thread overview]
Message-ID: <f61129d7-5d9e-460c-87f4-d2e09ca024f1@intel.com> (raw)
In-Reply-To: <axMrqfLmLZBfIUuN@agluck-desk3>

Hi Tony,

On 12/4/26 1:07 PM, Luck, Tony wrote:
> On Fri, Dec 04, 2026 at 11:15:12AM -0800, Reinette Chatre wrote:
>> What remains?
>> =============
>> On x86 the CLOSID and RMID are separate values in struct task_struct and
>> __resctrl_sched_in() reads them without a lock, so a task can still be
>> labelled with a mismatched pair for the duration of a move. Unlike the
>> fork case, which is permanent and invisible to every later walk of the
>> task list, that window is transient and the pair is corrected at the next
>> context switch. MPAM stores the two as a single value.
> 
> I think the patch below covers this (only atomic on 64-bit CPUs).

Thank you for taking a look.

If I understand correctly the 64-bit dependency comes from the READ_ONCE()
and WRITE_ONCE() usage that requires the 64-bit value to be accessed as a
single value. Since your proposal relies on READ_ONCE() and WRITE_ONCE()
it requires resctrl to depend on X86_64. As soon as

	https://lore.kernel.org/lkml/39843a4166ca45ac777548eb70e777e2f23c949c.1793864720.git.yu.c.chen@intel.com/

lands then we can address this remaining transient issue without needing to
involve the scheduler and MM maintainers.

The fix in this series addresses a different and more severe (permanent instead
of transient) issue that does not have this dependency.
 
> Builds and passes tools/testing/selftests/resctrl/resctrl_tests.
> 
> -Tony
> 
> ---
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index e4f6323d7855..c79ac345136d 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1364,8 +1364,13 @@ struct task_struct {
>  #endif	/* CONFIG_PREEMPT_RT */
>  #endif	/* CONFIG_CGROUPS */
>  #ifdef CONFIG_X86_CPU_RESCTRL
> -	u32				closid;
> -	u32				rmid;
> +	union x86_pqosid {
> +		u64			pqosid;
> +		struct {
> +			u32		closid;
> +			u32		rmid;
> +		};
> +	};
>  #endif
>  

Have you considered Chenyu's proposal?
	
	https://lore.kernel.org/lkml/awO3nYazk97csbpO@chenyu-dev/

It matches the MPAM implementation with a single:

	u64                             closid_rmid;

I prefer this single value approach since it does not create false
impression that the closid and rmid members can be written on their own.

Reinette

      reply	other threads:[~2026-12-04 23:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 19:15 [PATCH v2 0/4] fork,arm,x86,fs/resctrl: Fix stale resource group assignment on fork Reinette Chatre
2026-12-04 19:15 ` [PATCH v2 1/4] arm64: mpam: Remove unneeded include of linux/arm_mpam.h Reinette Chatre
2026-12-04 19:15 ` [PATCH v2 2/4] fork,arm,x86,fs/resctrl: Fix stale resource group assignment vs copy_process() Reinette Chatre
2026-12-04 19:15 ` [PATCH v2 3/4] arm,x86/resctrl: Assert tasklist_lock is held when setting CLOSID and RMID Reinette Chatre
2026-12-04 19:15 ` [PATCH v2 4/4] NOT_FOR_INCLUSION: selftests/resctrl: Tasks keep using removed RMID after fork() reproducer Reinette Chatre
2026-12-04 21:07 ` [PATCH v2 0/4] fork,arm,x86,fs/resctrl: Fix stale resource group assignment on fork Luck, Tony
2026-12-04 23:00   ` Reinette Chatre [this message]

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=f61129d7-5d9e-460c-87f4-d2e09ca024f1@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=bsegall@google.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=fenghuay@nvidia.com \
    --cc=fustini@kernel.org \
    --cc=james.morse@arm.com \
    --cc=jedrzej.wasiukiewicz@intel.com \
    --cc=juri.lelli@redhat.com \
    --cc=kees@kernel.org \
    --cc=kprateek.nayak@amd.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=patches@lists.linux.dev \
    --cc=peternewman@google.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=vbabka@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=x86@kernel.org \
    --cc=yu.c.chen@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