mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
	<tony.luck@intel.com>, <ben.horgan@arm.com>,
	<james.morse@arm.com>, <Dave.Martin@arm.com>,
	<babu.moger@amd.com>, <bp@alien8.de>, <tglx@linutronix.de>,
	<dave.hansen@linux.intel.com>
Cc: <x86@kernel.org>, <hpa@zytor.com>, <fustini@kernel.org>,
	<fenghuay@nvidia.com>, <peternewman@google.com>,
	<yu.c.chen@intel.com>, <linux-kernel@vger.kernel.org>,
	<patches@lists.linux.dev>
Subject: Re: [PATCH v2 1/5] x86,fs/resctrl: Remove unused non-linear bandwidth delay mapping
Date: Tue, 27 Oct 2026 16:07:32 +0800	[thread overview]
Message-ID: <2b7e4de7-ad06-40a1-92e0-479b3d7812af@huawei.com> (raw)
In-Reply-To: <103c954ead8905b3582b6ade76e2082dffb01fc6.1791406459.git.reinette.chatre@intel.com>



在 2026/10/8 5:06, Reinette Chatre 写道:
> Intel MBA throttles memory bandwidth with delay values, while resctrl
> exposes memory bandwidth to user space as a percentage. When delay values
> are linear there is a direct mapping between the two. Support for
> non-linear delay values would need a pre-calibrated table mapping
> percentages to delay values.
> 
> Commit
> 
>   05b93417ce5b ("x86/intel_rdt/mba: Add primary support for Memory Bandwidth Allocation (MBA)")
> 
> added a placeholder for such a table to the resctrl_membw structure, but
> the table was never populated and never read. rdt_get_mb_table(), which
> would provide it, always fails. As a result, an Intel MBA resource with
> non-linear delay values is never marked as capable of allocation, and its
> control values are never written to hardware.
> 
> Remove the unused mapping table and fold the linear percentage-to-delay
> conversion into the function that writes the control values to hardware.
> 
> Keep the check that delay values are linear as a defensive measure in
> preparation for supporting multiple controls, which turns the memory
> bandwidth control into a generic scalar control that indicates whether it
> requires linear values.
> 
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
> Reviewed-by: Chen Yu <yu.c.chen@intel.com>
> ---
> Changes since RFC v1:
> - Also drop separate delay_bw_map() and instead integrate the only
>   mapping to when control value is written.
> 
> Changes since RFC v2:
> - Rework changelog.
> 
> Changes since v1:
> - Rewrite changelog, fix subject prefix.
> - Match error message about linear support with similar message during
>   enumeration added in next patch.
> - Add Chenyu's Reviewed-by tag
> ---
>  arch/x86/kernel/cpu/resctrl/core.c | 23 +++++++----------------
>  include/linux/resctrl.h            |  2 --
>  2 files changed, 7 insertions(+), 18 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 55214d6fdc49..f9677e52790e 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -323,29 +323,20 @@ static void mba_wrmsr_amd(struct msr_param *m)
>  		wrmsrq(hw_res->msr_base + i, hw_dom->ctrl_val[i]);
>  }
>  
> -/*
> - * Map the memory b/w percentage value to delay values
> - * that can be written to QOS_MSRs.
> - * There are currently no SKUs which support non linear delay values.
> - */
> -static u32 delay_bw_map(unsigned long bw, struct rdt_resource *r)
> -{
> -	if (r->membw.delay_linear)
> -		return MAX_MBA_BW - bw;
> -
> -	pr_warn_once("Non Linear delay-bw map not supported but queried\n");
> -	return MAX_MBA_BW;
> -}
> -
>  static void mba_wrmsr_intel(struct msr_param *m)
>  {
>  	struct rdt_hw_ctrl_domain *hw_dom = resctrl_to_arch_ctrl_dom(m->dom);
>  	struct rdt_hw_resource *hw_res = resctrl_to_arch_res(m->res);
>  	unsigned int i;
>  
> -	/*  Write the delay values for mba. */
> +	if (!m->res->membw.delay_linear) {
> +		pr_warn_once("Non-linear MBA delay values not supported\n");
> +		return;
> +	}
> +
> +	/* Program bandwidth percentage mapped to linear delay value. */
>  	for (i = m->low; i < m->high; i++)
> -		wrmsrq(hw_res->msr_base + i, delay_bw_map(hw_dom->ctrl_val[i], m->res));
> +		wrmsrq(hw_res->msr_base + i, MAX_MBA_BW - hw_dom->ctrl_val[i]);

LGTM
Reviewed-by: Jinjie Ruan <ruanjinjie@huawei.com>

>  }
>  
>  static void cat_wrmsr(struct msr_param *m)
> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
> index 10dfdca7f4bf..b63dc62690ca 100644
> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -253,7 +253,6 @@ enum membw_throttle_mode {
>   * @throttle_mode:	Bandwidth throttling mode when threads request
>   *			different memory bandwidths
>   * @mba_sc:		True if MBA software controller(mba_sc) is enabled
> - * @mb_map:		Mapping of memory B/W percentage to memory B/W delay
>   */
>  struct resctrl_membw {
>  	u32				min_bw;
> @@ -263,7 +262,6 @@ struct resctrl_membw {
>  	bool				arch_needs_linear;
>  	enum membw_throttle_mode	throttle_mode;
>  	bool				mba_sc;
> -	u32				*mb_map;
>  };
>  
>  struct resctrl_schema;

-- 
Best regards,
Jinjie


  reply	other threads:[~2026-10-27  8:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 21:06 [PATCH v2 0/5] x86,fs/resctrl: Cleanups in preparation for multiple controls support Reinette Chatre
2026-10-07 21:06 ` [PATCH v2 1/5] x86,fs/resctrl: Remove unused non-linear bandwidth delay mapping Reinette Chatre
2026-10-27  8:07   ` Jinjie Ruan [this message]
2026-10-07 21:06 ` [PATCH v2 2/5] x86,fs/resctrl: Remove unnecessary non-linear MBA configuration check Reinette Chatre
2026-10-08  7:14   ` Chen Yu
2026-10-27  8:29   ` Jinjie Ruan
2026-10-07 21:06 ` [PATCH v2 3/5] x86,fs/resctrl: Move MSR_IA32_L{2,3}_QOS_CFG scope property to x86 resource Reinette Chatre
2026-10-18 17:40   ` Chen Yu
2026-10-19 23:06     ` Reinette Chatre
2026-10-20  6:05       ` Chen Yu
2026-10-20 21:01         ` Reinette Chatre
2026-10-07 21:06 ` [PATCH v2 4/5] fs/resctrl: Drop unnecessary is_mba_linear() helper Reinette Chatre
2026-10-27  8:34   ` Jinjie Ruan
2026-10-07 21:06 ` [PATCH v2 5/5] fs/resctrl: Drop unnecessary parameter from resctrl_io_alloc_parse_line() Reinette Chatre
2026-10-18 17:44   ` Chen Yu
2026-10-27  8:35   ` Jinjie Ruan
2026-10-27 14:36     ` Reinette Chatre
2026-10-08 16:12 ` [PATCH v2 0/5] x86,fs/resctrl: Cleanups in preparation for multiple controls support Luck, Tony
2026-10-08 22:48   ` 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=2b7e4de7-ad06-40a1-92e0-479b3d7812af@huawei.com \
    --to=ruanjinjie@huawei.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=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=peternewman@google.com \
    --cc=reinette.chatre@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.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

all inboxes | Powered by JetHome®