lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <baba42e8-022d-4140-9c4c-256fc6b44765@intel.com>
Date: Thu, 19 Sep 2024 10:43:04 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Babu Moger <babu.moger@....com>, <corbet@....net>, <fenghua.yu@...el.com>,
	<tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
	<dave.hansen@...ux.intel.com>
CC: <x86@...nel.org>, <hpa@...or.com>, <paulmck@...nel.org>,
	<rdunlap@...radead.org>, <tj@...nel.org>, <peterz@...radead.org>,
	<yanjiewtw@...il.com>, <kim.phillips@....com>, <lukas.bulwahn@...il.com>,
	<seanjc@...gle.com>, <jmattson@...gle.com>, <leitao@...ian.org>,
	<jpoimboe@...nel.org>, <rick.p.edgecombe@...el.com>,
	<kirill.shutemov@...ux.intel.com>, <jithu.joseph@...el.com>,
	<kai.huang@...el.com>, <kan.liang@...ux.intel.com>,
	<daniel.sneddon@...ux.intel.com>, <pbonzini@...hat.com>,
	<sandipan.das@....com>, <ilpo.jarvinen@...ux.intel.com>,
	<peternewman@...gle.com>, <maciej.wieczor-retman@...el.com>,
	<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<eranian@...gle.com>, <james.morse@....com>
Subject: Re: [PATCH v7 21/24] x86/resctrl: Configure mbm_cntr_assign mode if
 supported

Hi Babu,

On 9/4/24 3:21 PM, Babu Moger wrote:
> Configure mbm_cntr_assign on AMD.
> 
> 'mbm_cntr_assign' mode in AMD is ABMC (Assignable Bandwidth Monitoring
> Counters). When the ABMC is updated, it must be updated on all logical
> processors in the resctrl domain.
> 
> Signed-off-by: Babu Moger <babu.moger@....com>
> ---
> v7: Introduced resctrl_arch_mbm_cntr_assign_configure() to configure.
>     Moved the default settings to rdt_get_mon_l3_config(). It should be
>     done before the hotplug handler is called. It cannot be done at
>     rdtgroup_init().
> 
> v6: Keeping the default enablement in arch init code for now.
>      This may need some discussion.
>      Renamed resctrl_arch_configure_abmc to resctrl_arch_mbm_cntr_assign_configure.
> 
> v5: New patch to enable ABMC by default.
> ---
>  arch/x86/kernel/cpu/resctrl/internal.h |  1 +
>  arch/x86/kernel/cpu/resctrl/monitor.c  |  1 +
>  arch/x86/kernel/cpu/resctrl/rdtgroup.c | 11 +++++++++++
>  3 files changed, 13 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
> index 9a65a13ccbe9..3250561f0187 100644
> --- a/arch/x86/kernel/cpu/resctrl/internal.h
> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
> @@ -709,6 +709,7 @@ int rdtgroup_assign_cntr(struct rdt_resource *r, struct rdtgroup *rdtgrp,
>  			 struct rdt_mon_domain *d, enum resctrl_event_id evtid);
>  int rdtgroup_unassign_cntr(struct rdt_resource *r, struct rdtgroup *rdtgrp,
>  			   struct rdt_mon_domain *d, enum resctrl_event_id evtid);
> +void resctrl_arch_mbm_cntr_assign_configure(struct rdt_resource *r);
>  void rdt_staged_configs_clear(void);
>  bool closid_allocated(unsigned int closid);
>  int resctrl_find_cleanest_closid(void);
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
> index 09b1d8bb0aa0..314c0b297470 100644
> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
> @@ -1261,6 +1261,7 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)
>  			cpuid_count(0x80000020, 5, &eax, &ebx, &ecx, &edx);
>  			r->mon.num_mbm_cntrs = (ebx & 0xFFFF) + 1;
>  			resctrl_file_fflags_init("num_mbm_cntrs", RFTYPE_MON_INFO);
> +			hw_res->mbm_cntr_assign_enabled = true;

This is a major change to require architecture to set whether this is the default mode.
That seems fine but needs to be highlighted in the changelog and descriptions of this work.

>  		}
>  	}
>  
> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index 7a8ece12d7da..1054583bef9d 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -2726,6 +2726,13 @@ int resctrl_arch_mbm_cntr_assign_set(struct rdt_resource *r, bool enable)
>  	return 0;
>  }
>  
> +void resctrl_arch_mbm_cntr_assign_configure(struct rdt_resource *r)

How about resctrl_arch_mbm_cntr_assign_set_one() to match existing
resctrl_arch_mbm_cntr_assign_set()?

> +{
> +	struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
> +
> +	resctrl_abmc_set_one_amd(&hw_res->mbm_cntr_assign_enabled);
> +}
> +
>  /*
>   * We don't allow rdtgroup directories to be created anywhere
>   * except the root directory. Thus when looking for the rdtgroup
> @@ -4510,9 +4517,13 @@ int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_mon_domain *d)
>  
>  void resctrl_online_cpu(unsigned int cpu)
>  {
> +	struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl;
> +
>  	mutex_lock(&rdtgroup_mutex);
>  	/* The CPU is set in default rdtgroup after online. */
>  	cpumask_set_cpu(cpu, &rdtgroup_default.cpu_mask);
> +	if (r->mon.mbm_cntr_assignable)

Needs a r->mon_capable check?

> +		resctrl_arch_mbm_cntr_assign_configure(r);
>  	mutex_unlock(&rdtgroup_mutex);
>  }
>  

Reinette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ