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@intel.com>, <tglx@kernel.org>, <bp@alien8.de>,
	<mingo@redhat.com>, <dave.hansen@linux.intel.com>,
	<hpa@zytor.com>, <fenghuay@nvidia.com>, <babu.moger@amd.com>,
	<hongyu.ning@intel.com>, <chen.yu@linux.dev>, <x86@kernel.org>,
	<linux-kernel@vger.kernel.org>,
	"Hongyu Ning" <hongyu.ning@linux.intel.com>
Subject: Re: [PATCH v8 5/9] x86/resctrl: Parse ACPI CMRC table
Date: Sun, 4 Oct 2026 12:34:58 +0800	[thread overview]
Message-ID: <asHXcgv80IIA1TzL@chenyu-dev> (raw)
In-Reply-To: <fcab8cf3-b5d6-4d67-86d6-b8d9f9092fbf@intel.com>

Hi Reinette,

On Mon, Sep 28, 2026 at 02:46:32PM -0700, Reinette Chatre wrote:
> Hi Chenyu,
> 
> On 9/17/26 9:50 PM, Chen Yu wrote:
> > diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h
> > index 8f6edcdcfd87..9a32ed418c33 100644
> > --- a/arch/x86/include/asm/resctrl.h
> > +++ b/arch/x86/include/asm/resctrl.h
> > @@ -49,6 +49,8 @@ DECLARE_STATIC_KEY_FALSE(rdt_enable_key);
> >  DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key);
> >  DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key);
> >  
> > +unsigned int erdt_get_scale(void);
> > +
> 
> Adding this prototype to asm header file seems out of place. One needs to look
> at later patches to learn this is because of upcoming use in
> resctrl_arch_round_mon_val(). Beyond that, resctrl_arch_round_mon_val() also
> later needs erdt_cpu_has() that even more looks like the wrong thing to do
> when it comes to the asm header file.
> 
> resctrl_arch_round_mon_val() is used in two places, during system initialization
> and when user space updates resctrl_rmid_realloc_threshold via a write to
> "max_threshold_occupancy". Neither is a hot path requiring this to be inline
> code. 
> 
> Aiming to keep resctrl_arch_round_mon_val() as an inline function is causing this
> ERDT support to be unnecessarily fragmented. Could you please add a preparatory
> patch that moves resctrl_arch_round_mon_val() to a c file and add its prototype
> to include/linux/resctrl.h? This means that a change to MPAM driver is also needed
> that I do not expect objection against. To make this easier it would help to
> place the stub among the more stable resctrl_arch_* calls in MPAM driver.
>

Got it, thanks for providing this detailed information. Let me make this change.

> >  static inline bool resctrl_arch_alloc_capable(void)
> >  {
> >  	return rdt_alloc_capable;
> > diff --git a/arch/x86/kernel/cpu/resctrl/erdt.c b/arch/x86/kernel/cpu/resctrl/erdt.c
> > index 249ba547d7c8..a8a7417c2f82 100644
> > --- a/arch/x86/kernel/cpu/resctrl/erdt.c
> > +++ b/arch/x86/kernel/cpu/resctrl/erdt.c
> > @@ -23,6 +23,7 @@ static LIST_HEAD(domain_info_list);
> >  static bool erdt_enabled;
> >  
> >  #define ERDT_VALID_VERSION		1
> > +#define CMRC_SUPPORTED_INDEX_FN		1
> >  #define RMDD_FLAG_CPU_L3_DOMAIN		BIT(0)
> >  
> >  /* Bitmask of valid sub-tables found in the first RMDD, used to ensure all RMDDs match. */
> > @@ -37,11 +38,26 @@ static u16 first_rmdd_domain_id;
> >   */
> >  static unsigned int erdt_max_rmid;
> >  
> > +/*
> > + * Used only by the limbo handler to round resctrl_rmid_realloc_threshold.
> 
> This implies erdt_scale is used by limbo handler but limbo handler only uses
> resctrl_rmid_realloc_threshold directly, no?
> 

Right, limbo handler only uses resctrl_rmid_realloc_threshold, which is
rounded by legacy/erdt_get_scale(). Let me revise this comment.

> > + * resctrl_rmid_realloc_threshold is a single global value, and
> > + * resctrl_arch_round_mon_val() takes no domain argument, so a single scale has
> > + * to be derived from the per-domain cmrc->up_scale. max() is chosen because the
> 
> This does not sound right. Using the fact that a function does not take an argument as
> a motivation just makes one wonder why the function cannot just be changed?
> 
> "resctrl_rmid_realloc_threshold is a single global value" is accurate and the reason
> why it needs to stay that way is because it is exposed to user space as such. That
> was done before RDT introduced per domain scaling. If keeping it a global is ok for
> ERDT then please highlight this, otherwise resctrl needs an enhancement.
> 

It is OK for ERDT to use the global scale factor, let me revise the
commit log as well as the comment.

> Apart from above it looks like introduction of erdt_scale and erdt_get_scale() would
> benefit from a separate commit. The comment above clearly notes its complexity but
> there is no mention of it in changelog. 
>

OK, let me split this change into a new patch and add a corresponding description
in the commit log as well.

> > + * rounding is a floor: a larger scale yields a slightly lower threshold, i.e. an
> > + * RMID has to drop to a slightly lower occupancy before it is reused.
> > + */

[ ... ]

> > +static __init int cmrc_init(struct acpi_subtbl_hdr_16 *subtbl,
> > +			    struct erdt_domain_info *domain_info)
> 
> Same comment as for cacd_init().
>

OK, will convert the return value to bool.

> >  static inline struct acpi_subtbl_hdr_16 *rmdd_subtbl(struct acpi_erdt_rmdd *rmdd)
> >  {
> >  	return (void *)rmdd + sizeof(*rmdd);
> > @@ -170,6 +230,19 @@ static __init bool parse_rmdd_table(struct acpi_subtbl_hdr_16 *rmdd_hdr)
> >  
> >  			subtbl_mask |= BIT(ACPI_ERDT_TYPE_CACD);
> >  			break;
> > +		case ACPI_ERDT_TYPE_CMRC:
> > +			/*
> > +			 * Only one CMRC is supported per domain as there is no
> > +			 * method to distinguish different CMRCs within a domain.
> > +			 */
> 
> Please note how this comment style is different from comment used to describe parsing
> of other RMDD sub-tables (before or after "case"). Please stick one style and use it
> consistently.
>

OK, it is one single-line comment above the case, the other a multi-line block inside the
case body. I'll standardize them for consistency.

thanks,
Chenyu

  reply	other threads:[~2026-10-04  4:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18  4:46 [PATCH v8 0/9] Introduce MMIO-based CMT access for Enhanced RDT Chen Yu
2026-09-18  4:48 ` [PATCH v8 1/9] x86/topology: Export topo_lookup_cpuid() for resctrl use Chen Yu
2026-09-18  4:48 ` [PATCH v8 2/9] x86/resctrl: Require 64-bit x86 for resctrl support Chen Yu
2026-09-28 21:21   ` Reinette Chatre
2026-09-29 15:03     ` Chen Yu
2026-09-18  4:49 ` [PATCH v8 3/9] x86/resctrl: Parse ACPI ERDT table and save CACD cpumask for RMDD domains Chen Yu
2026-09-28 21:37   ` Reinette Chatre
2026-09-29 10:32     ` Chen Yu
2026-09-29 15:40       ` Reinette Chatre
2026-09-18  4:50 ` [PATCH v8 4/9] x86/resctrl: Attach ACPI ERDT information to L3 mon domain on CPU online Chen Yu
2026-09-28 21:44   ` Reinette Chatre
2026-09-29 14:52     ` Chen Yu
2026-09-18  4:50 ` [PATCH v8 5/9] x86/resctrl: Parse ACPI CMRC table Chen Yu
2026-09-28 21:46   ` Reinette Chatre
2026-10-04  4:34     ` Chen Yu [this message]
2026-09-18  4:50 ` [PATCH v8 6/9] x86/resctrl: Refactor the monitor read function Chen Yu
2026-09-18  4:50 ` [PATCH v8 7/9] fs/resctrl: Do not invoke smp_processor_id() in preemptible context Chen Yu
2026-09-28 21:48   ` Reinette Chatre
2026-10-04  5:54     ` Chen Yu
2026-09-18  4:51 ` [PATCH v8 8/9] x86/resctrl: Introduce erdt_cpu_has() and erdt_support() Chen Yu
2026-09-28 21:49   ` Reinette Chatre
2026-09-18  4:51 ` [PATCH v8 9/9] x86/resctrl: Add MMIO-based LLC occupancy monitoring support Chen Yu
2026-09-28 21:54   ` Reinette Chatre

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=asHXcgv80IIA1TzL@chenyu-dev \
    --to=yu.c.chen@intel.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=chen.yu@linux.dev \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghuay@nvidia.com \
    --cc=hongyu.ning@intel.com \
    --cc=hongyu.ning@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=reinette.chatre@intel.com \
    --cc=tglx@kernel.org \
    --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®