mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Yu <yu.c.chen@intel.com>
To: Reinette Chatre <reinette.chatre@intel.com>
Cc: Tony Luck <tony.luck@intel.com>, Ben Horgan <ben.horgan@arm.com>,
	"James Morse" <james.morse@arm.com>,
	Dave Martin <Dave.Martin@arm.com>,
	Babu Moger <babu.moger@amd.com>,
	Drew Fustini <fustini@kernel.org>,
	Fenghua Yu <fenghuay@nvidia.com>,
	Jinjie Ruan <ruanjinjie@huawei.com>,
	Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Peter Newman <peternewman@google.com>,
	"chen.yu@linux.dev x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC v3] arm,x86,fs/resctrl: Generic schema description Proof of Concept
Date: Tue, 1 Dec 2026 20:16:47 +0800	[thread overview]
Message-ID: <aw66r2eyLGOTHXXF@chenyu-dev> (raw)
In-Reply-To: <89f56594-9088-4b3e-ac7f-0cf911e08731@intel.com>

Hi Reinette,

On Wed, Nov 25, 2026 at 03:15:04PM -0800, Reinette Chatre wrote:
> Hi Chenyu,
> 
> > OK, I'm also thinking of the min/max/opt clamp among different controls. As you mentioned in the cover
> > letter, this logic can be embedded in fs/resctrl(by doing santity check in the staging buffer)
> 
> In the cover letter I was actually trying to convey that doing this reliably and consistently in
> resctrl filesystem is difficult and leaning towards this being done by architecture. resctrl
> filesystem should be able to handle relationships among controls if they support the same
> control values, but that is not guaranteed. 
> 
> Consider, for example, the example of MPAM's min and max controls (I think region-aware may
> have similar layout in legacy mode?):
> 
> info/
> └── MB/
>     └── schemata/
>         ├── MB/
>         │   └── MB_MAX/
>         └── MB_MIN/
> 
> When in legacy mode user space can set new control values for the MB and MB_MIN controls - since
> the MPAM driver manages the conversion from MB control value to MB_MAX control value it is not
> obvious how resctrl filesystem can enforce the relationship.
> 
> For now I've just left it as-is - the filesystem allows user space to write a control value to
> the MIN control that is larger than the control value written to MAX.
> 
> As noted this is still an open so we can discuss now as part of this RFC how best to handle this.
>

Thanks very much for providing the direction.

[Open1]:

If I understand correctly, control_mode determines what the schemata file
displays. I thought that in "legacy" mode, schemata would show only the legacy
controls. In the MPAM case, shouldn't "MB" be the only control displayed in
legacy mode? Why is "MB_L3_MIN" at the same level as the MB control? Did I miss
a discussion about this? I expected to see only:

# cat /sys/fs/resctrl/info/MB/control_mode
[legacy] native
# cat /sys/fs/resctrl/schemata
MB:0=100;1=100

rather than:

# cat /sys/fs/resctrl/info/MB/control_mode
[legacy] native
# cat /sys/fs/resctrl/schemata
MB:0=100;1=100
MB_L3_MIN:0=0;1=0

MB_L3_MIN is at the same level as the MB control because
in the code it is added in the same level as MB control:

list_add_tail(&mb->r_ctrl.entry, &r->controls);
list_add_tail(&mb_max->r_ctrl.entry, &mb->r_ctrl.emulated_by);
list_add_tail(&mb_min->r_ctrl.entry, &r->controls);

As a result, in legacy mode the control iteration helper
resctrl_enabled_ctrl_iter_next() iterates over both MB and MB_L3_MIN. That is
why schemata displays both of them. I wonder for this case,
can we add a dummy legacy MIN control, and link the MB_L3_MIN
under the legacy MIN control, so we can only display the controls
in the first level?

[Open2]:

Besides, if I understand correctly, the comparison between multiple controls
comes down to this check:
verify that user_min <= hw_max && user_max >= hw_min.

Intel region-aware MBA requires this sanity check, but MPAM might not. As Ben
mentioned: "The MPAM hardware configuration is still well-defined if
MIN is greater than MAX". So we can implement this check in the arch driver.

Can we say that min/max comparisons only happen between native controls? Since
the legacy control does not currently support min or max, would every new
control be a native control?

If that assumption holds, the validation could introduce
resctrl_arch_valid_range_bw(r, ctrl, bw) and call it from bw_validate().
If the values are invalid, then it will be discarded from the staged_buffer
and not reach the hardware update. I'm thinking of something like below: 

bool resctrl_arch_valid_range_bw(struct rdt_resource *r, struct resctrl_ctrl *ctrl,
				 u32 bw)
{
	struct resctrl_hw_ctrl *hw_ctrl = resctrl_to_arch_ctrl(ctrl);

	if (!hw_ctrl->valid_range)
		return true;

	return hw_ctrl->valid_range(r, ctrl, bw);
}

hw_ctrl->valid_range = erdt_valid_range;

erdt_valid_range()
{
	/* Do the ERDT-specific min/max/opt sanity check. */
}

thanks,
Chenyu

  reply	other threads:[~2026-12-01 12:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  5:04 Reinette Chatre
2026-11-20 19:48 ` Fenghua Yu
2026-11-20 20:26   ` Reinette Chatre
2026-11-23  3:16 ` Chen Yu
2026-11-24  4:26   ` Reinette Chatre
2026-11-25  5:10     ` Chen Yu
2026-11-25 23:15       ` Reinette Chatre
2026-12-01 12:16         ` Chen Yu [this message]
2026-11-30 12:37 ` Ben Horgan

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=aw66r2eyLGOTHXXF@chenyu-dev \
    --to=yu.c.chen@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghuay@nvidia.com \
    --cc=fustini@kernel.org \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peternewman@google.com \
    --cc=reinette.chatre@intel.com \
    --cc=ruanjinjie@huawei.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®