Re: [RFC PATCH 16/19] fs/resctrl: Implement rdtgroup_plza_write() to configure PLZA in a group
From: Luck, Tony
Date: Thu Jan 29 2026 - 13:55:30 EST
On Wed, Jan 28, 2026 at 02:03:31PM -0800, Luck, Tony wrote:
> On Wed, Jan 21, 2026 at 03:12:54PM -0600, Babu Moger wrote:
> > Introduce rdtgroup_plza_write() group which enables per group control of
> > PLZA through the resctrl filesystem and ensure that enabling or disabling
> > PLZA is propagated consistently across all CPUs belonging to the group.
> >
> > Enforce the capability checks, exclude default, pseudo-locked and CTRL_MON
> > groups with sub monitors. Also, ensure that only one group can have PLZA
> > enabled at a time.
> >
> ...
>
> > +static ssize_t rdtgroup_plza_write(struct kernfs_open_file *of, char *buf,
> > + size_t nbytes, loff_t off)
> > +{
> > + struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
> > + struct rdtgroup *rdtgrp, *prgrp;
> > + int cpu, ret = 0;
> > + bool enable;
>
> ...
>
> > + /* Enable or disable PLZA state and update per CPU state if there is a change */
> > + if (enable != rdtgrp->plza) {
> > + resctrl_arch_plza_setup(r, rdtgrp->closid, rdtgrp->mon.rmid);
>
> What is this for? If I've just created a group with no tasks, and empty
> CPU mask ... it seems that this writes the MSR_IA32_PQR_PLZA_ASSOC on
> every CPU in every domain.
I think I see now. There are THREE enable bits in your
MSR_IA32_PQR_PLZA_ASSOC.
One each for CLOSID and RMID, and an overall PLZA_EN in the high bit.
At this step you setup the CLOSID/RMID with their enable bits, but
leaving the PLZA_EN off.
Is this a subtle optimzation for the context switch? Is the WRMSR
faster if it only toggle PLZA_EN leaving all the other bits unchanged?
This might not be working as expected. The context switch code does:
wrmsr(MSR_IA32_PQR_PLZA_ASSOC,
RMID_EN | state->plza_rmid,
(plza ? PLZA_EN : 0) | CLOSID_EN | state->plza_closid);
This doesn't just clear the PLZA_EN bit, it zeroes the high dword of the MSR.
> It also appears that marking a task as PLZA is permanent. Moving it to
> another group doesn't unmark it. Is this intentional?
Ditto assigning a CPU to the PLZA group. Once done it can't be undone
(except by turing off PLZA?).
-Tony
[More comments about this coming against patch 16]