[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dc8d11f2-38ae-4745-ba19-82cf8a6c4dde@intel.com>
Date: Tue, 15 Oct 2024 20:22:59 -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 v8 15/25] x86/resctrl: Introduce cntr_id in mongroup for
assignments
Hi Babu,
On 10/9/24 10:39 AM, Babu Moger wrote:
> mbm_cntr_assign feature provides an option to the user to assign a counter
> to an RMID, event pair and monitor the bandwidth as long as the counter is
> assigned. There can be two counters per monitor group, one for MBM total
> event and another for MBM local event.
>
> Introduce cntr_id to manage the assignments.
>
> Signed-off-by: Babu Moger <babu.moger@....com>
> ---
> v8: Minor commit message update.
>
> v7: Minor comment update for cntr_id.
>
> v6: New patch.
> Separated FS and arch bits.
> ---
> arch/x86/kernel/cpu/resctrl/internal.h | 7 +++++++
> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 ++++++
> 2 files changed, 13 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
> index de397468b945..58298db9034f 100644
> --- a/arch/x86/kernel/cpu/resctrl/internal.h
> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
> @@ -62,6 +62,11 @@
> /* Setting bit 0 in L3_QOS_EXT_CFG enables the ABMC feature. */
> #define ABMC_ENABLE_BIT 0
>
> +/* Maximum assignable counters per resctrl group */
> +#define MAX_CNTRS 2
> +
> +#define MON_CNTR_UNSET U32_MAX
> +
> /**
> * cpumask_any_housekeeping() - Choose any CPU in @mask, preferring those that
> * aren't marked nohz_full
> @@ -231,12 +236,14 @@ enum rdtgrp_mode {
> * @parent: parent rdtgrp
> * @crdtgrp_list: child rdtgroup node list
> * @rmid: rmid for this rdtgroup
> + * @cntr_id: IDs of hardware counters assigned to monitor group
> */
> struct mongroup {
> struct kernfs_node *mon_data_kn;
> struct rdtgroup *parent;
> struct list_head crdtgrp_list;
> u32 rmid;
> + u32 cntr_id[MAX_CNTRS];
> };
>
> /**
> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index 610eae64b13a..03b670b95c49 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -3530,6 +3530,9 @@ static int mkdir_rdt_prepare_rmid_alloc(struct rdtgroup *rdtgrp)
> }
> rdtgrp->mon.rmid = ret;
>
> + rdtgrp->mon.cntr_id[0] = MON_CNTR_UNSET;
> + rdtgrp->mon.cntr_id[1] = MON_CNTR_UNSET;
> +
> ret = mkdir_mondata_all(rdtgrp->kn, rdtgrp, &rdtgrp->mon.mon_data_kn);
> if (ret) {
> rdt_last_cmd_puts("kernfs subdir error\n");
> @@ -4084,6 +4087,9 @@ static void __init rdtgroup_setup_default(void)
> rdtgroup_default.closid = RESCTRL_RESERVED_CLOSID;
> rdtgroup_default.mon.rmid = RESCTRL_RESERVED_RMID;
> rdtgroup_default.type = RDTCTRL_GROUP;
> + rdtgroup_default.mon.cntr_id[0] = MON_CNTR_UNSET;
> + rdtgroup_default.mon.cntr_id[1] = MON_CNTR_UNSET;
> +
Could these magic constants be avoided by introducing MBM_EVENT_ARRAY_INDEX here
and using it for the array index instead of "0" and "1"?
> INIT_LIST_HEAD(&rdtgroup_default.mon.crdtgrp_list);
>
> list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups);
Reinette
Powered by blists - more mailing lists