From: Reinette Chatre <reinette.chatre@intel.com>
To: James Morse <james.morse@arm.com>, <x86@kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
H Peter Anvin <hpa@zytor.com>, Babu Moger <Babu.Moger@amd.com>,
<shameerali.kolothum.thodi@huawei.com>,
D Scott Phillips OS <scott@os.amperecomputing.com>,
<carl@os.amperecomputing.com>, <lcherian@marvell.com>,
<bobo.shaobowang@huawei.com>, <tan.shaopeng@fujitsu.com>,
<baolin.wang@linux.alibaba.com>,
Jamie Iles <quic_jiles@quicinc.com>,
Xin Hao <xhao@linux.alibaba.com>, <peternewman@google.com>,
<dfustini@baylibre.com>, <amitsinght@marvell.com>,
David Hildenbrand <david@redhat.com>,
Rex Nie <rex.nie@jaguarmicro.com>,
"Dave Martin" <dave.martin@arm.com>
Subject: Re: [PATCH v3 06/38] x86/resctrl: Move data_width to be a schema property
Date: Fri, 28 Jun 2024 09:45:26 -0700 [thread overview]
Message-ID: <d9568ea8-08cc-4e3b-9951-78acbcd54075@intel.com> (raw)
In-Reply-To: <20240614150033.10454-7-james.morse@arm.com>
Hi James,
On 6/14/24 8:00 AM, James Morse wrote:
> The resctrl architecture code gets to specify the width of the schema
> entries that are used by resctrl. These are determined by the schema
> format, e.g. percentage or bitmap.
>
> Move this property into struct resctrl_schema and get the filesystem
> parts of resctrl to set it based on the schema format.
>
> This allows rdt_init_padding() to be removed, its work can be done
> by schemata_list_add(), allowing max_name_width and max_data_width
> to be moved out of core.c which has no counterpart after the
> move to fs.
Please do write commit messages in imperative mood.
>
> The logic for calculating max_name_width was moved in earlier patches,
> but the definition was not moved.
>
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
> Changes since v2:
> * This patch is new.
> ---
> arch/x86/kernel/cpu/resctrl/core.c | 26 --------------------------
> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 11 +++++++++++
> include/linux/resctrl.h | 4 ++--
> 3 files changed, 13 insertions(+), 28 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 4a5216a13b46..4de7d20aa5aa 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -44,12 +44,6 @@ static DEFINE_MUTEX(domain_list_lock);
> */
> DEFINE_PER_CPU(struct resctrl_pqr_state, pqr_state);
>
> -/*
> - * Used to store the max resource name width and max resource data width
> - * to display the schemata in a tabular format
> - */
> -int max_name_width, max_data_width;
> -
> /*
> * Global boolean for rdt_alloc which is true if any
> * resource allocation is enabled.
> @@ -222,7 +216,6 @@ static bool __get_mem_config_intel(struct rdt_resource *r)
> return false;
> r->membw.arch_needs_linear = false;
> }
> - r->data_width = 3;
>
> if (boot_cpu_has(X86_FEATURE_PER_THREAD_MBA))
> r->membw.throttle_mode = THREAD_THROTTLE_PER_THREAD;
> @@ -262,8 +255,6 @@ static bool __rdt_get_mem_config_amd(struct rdt_resource *r)
> r->membw.throttle_mode = THREAD_THROTTLE_UNDEFINED;
> r->membw.min_bw = 0;
> r->membw.bw_gran = 1;
> - /* Max value is 2048, Data width should be 4 in decimal */
> - r->data_width = 4;
>
> r->alloc_capable = true;
>
> @@ -283,7 +274,6 @@ static void rdt_get_cache_alloc_cfg(int idx, struct rdt_resource *r)
> r->cache.cbm_len = eax.split.cbm_len + 1;
> r->default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1;
> r->cache.shareable_bits = ebx & r->default_ctrl;
> - r->data_width = (r->cache.cbm_len + 3) / 4;
> if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
> r->cache.arch_has_sparse_bitmasks = ecx.split.noncont;
> r->alloc_capable = true;
> @@ -631,20 +621,6 @@ static int resctrl_arch_offline_cpu(unsigned int cpu)
> return 0;
> }
>
> -/*
> - * Choose a width for the resource name and resource data based on the
> - * resource that has widest name and cbm.
> - */
> -static __init void rdt_init_padding(void)
> -{
> - struct rdt_resource *r;
> -
> - for_each_alloc_capable_rdt_resource(r) {
> - if (r->data_width > max_data_width)
> - max_data_width = r->data_width;
> - }
> -}
> -
> enum {
> RDT_FLAG_CMT,
> RDT_FLAG_MBM_TOTAL,
> @@ -942,8 +918,6 @@ static int __init resctrl_late_init(void)
> if (!get_rdt_resources())
> return -ENODEV;
>
> - rdt_init_padding();
> -
> state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
> "x86/resctrl/cat:online:",
> resctrl_arch_online_cpu,
> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index af9968328771..4f8e20cc06eb 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -58,6 +58,12 @@ static struct kernfs_node *kn_mongrp;
> /* Kernel fs node for "mon_data" directory under root */
> static struct kernfs_node *kn_mondata;
>
> +/*
> + * Used to store the max resource name width and max resource data width
> + * to display the schemata in a tabular format
> + */
I understand that you just copied existing text here, but since you touch this line
could you please have this sentence end with a period?
> +int max_name_width, max_data_width;
> +
> static struct seq_buf last_cmd_status;
> static char last_cmd_status_buf[512];
>
> @@ -2600,15 +2606,20 @@ static int schemata_list_add(struct rdt_resource *r, enum resctrl_conf_type type
> switch (r->schema_fmt) {
> case RESCTRL_SCHEMA_BITMAP:
> s->fmt_str = "%d=%0*x";
> + s->data_width = (r->cache.cbm_len + 3) / 4;
> break;
> case RESCTRL_SCHEMA_PERCENTAGE:
> s->fmt_str = "%d=%0*u";
> + s->data_width = 3;
> break;
> case RESCTRL_SCHEMA_MBPS:
> s->fmt_str = "%d=%0*u";
> + s->data_width = 4;
> break;
> }
>
> + max_data_width = max(max_data_width, s->data_width);
> +
> INIT_LIST_HEAD(&s->list);
> list_add(&s->list, &resctrl_schema_all);
>
> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
> index abecbd92ac93..ddcd938972d2 100644
> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -182,7 +182,6 @@ enum resctrl_schema_fmt {
> * @membw: If the component has bandwidth controls, their properties.
> * @domains: RCU list of all domains for this resource
> * @name: Name to use in "schemata" file.
> - * @data_width: Character width of data when displaying
> * @default_ctrl: Specifies default cache cbm or memory B/W percent.
> * @schema_fmt: Which format string and parser is used for this schema.
> * @evt_list: List of monitoring events
> @@ -198,7 +197,6 @@ struct rdt_resource {
> struct resctrl_membw membw;
> struct list_head domains;
> char *name;
> - int data_width;
> u32 default_ctrl;
> enum resctrl_schema_fmt schema_fmt;
> struct list_head evt_list;
> @@ -218,6 +216,7 @@ struct rdt_resource *resctrl_arch_get_resource(enum resctrl_res_level l);
> * @list: Member of resctrl_schema_all.
> * @name: The name to use in the "schemata" file.
> * @fmt_str: Format string to show domain value
> + * @data_width: Character width of data when displaying
> * @conf_type: Whether this schema is specific to code/data.
> * @res: The resource structure exported by the architecture to describe
> * the hardware that is configured by this schema.
> @@ -229,6 +228,7 @@ struct resctrl_schema {
> struct list_head list;
> char name[8];
> const char *fmt_str;
> + int data_width;
> enum resctrl_conf_type conf_type;
> struct rdt_resource *res;
> u32 num_closid;
Reinette
next prev parent reply other threads:[~2024-06-28 16:45 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-14 14:59 [PATCH v3 00/38] x86/resctrl: Move the resctrl filesystem code to /fs/resctrl James Morse
2024-06-14 14:59 ` [PATCH v3 01/38] x86/resctrl: Fix allocation of cleanest CLOSID on platforms with no monitors James Morse
2024-06-28 16:41 ` Reinette Chatre
2024-06-14 14:59 ` [PATCH v3 02/38] x86/resctrl: Add a helper to avoid reaching into the arch code resource list James Morse
2024-06-28 16:42 ` Reinette Chatre
2024-06-14 14:59 ` [PATCH v3 03/38] x86/resctrl: Add a schema format enum and use this for fflags James Morse
2024-06-28 16:43 ` Reinette Chatre
2024-07-01 18:17 ` James Morse
2024-07-01 21:09 ` Reinette Chatre
2024-08-02 17:24 ` James Morse
2024-06-14 14:59 ` [PATCH v3 04/38] x86/resctrl: Use schema type to determine how to parse schema values James Morse
2024-06-28 16:43 ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 05/38] x86/resctrl: Use schema type to determine the schema format string James Morse
2024-06-28 16:43 ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 06/38] x86/resctrl: Move data_width to be a schema property James Morse
2024-06-28 16:45 ` Reinette Chatre [this message]
2024-06-14 15:00 ` [PATCH v3 07/38] x86/resctrl: Add max_bw to struct resctrl_membw James Morse
2024-06-14 15:00 ` [PATCH v3 08/38] x86/resctrl: Generate default_ctrl instead of sharing it James Morse
2024-06-14 15:00 ` [PATCH v3 09/38] x86/resctrl: Add helper for setting CPU default properties James Morse
2024-06-14 15:00 ` [PATCH v3 10/38] x86/resctrl: Remove rdtgroup from update_cpu_closid_rmid() James Morse
2024-06-14 15:00 ` [PATCH v3 11/38] x86/resctrl: Export resctrl fs's init function James Morse
2024-06-14 15:00 ` [PATCH v3 12/38] x86/resctrl: Wrap resctrl_arch_find_domain() around rdt_find_domain() James Morse
2024-06-14 15:00 ` [PATCH v3 13/38] x86/resctrl: Move resctrl types to a separate header James Morse
2024-06-28 16:45 ` Reinette Chatre
2024-07-01 18:16 ` James Morse
2024-06-14 15:00 ` [PATCH v3 14/38] x86/resctrl: Add a resctrl helper to reset all the resources James Morse
2024-06-14 15:00 ` [PATCH v3 15/38] x86/resctrl: Move monitor exit work to a restrl exit call James Morse
2024-06-28 16:46 ` Reinette Chatre
2024-07-01 18:17 ` James Morse
2024-07-11 21:12 ` Carl Worth
2024-06-14 15:00 ` [PATCH v3 16/38] x86/resctrl: Move monitor init work to a resctrl init call James Morse
2024-06-28 16:47 ` Reinette Chatre
2024-07-01 18:17 ` James Morse
2024-07-01 21:11 ` Reinette Chatre
2024-08-02 17:23 ` James Morse
2024-06-14 15:00 ` [PATCH v3 17/38] x86/resctrl: Stop using the for_each_*_rdt_resource() walkers James Morse
2024-06-28 16:48 ` Reinette Chatre
2024-07-01 18:16 ` James Morse
2024-07-01 21:10 ` Reinette Chatre
2024-08-02 17:22 ` James Morse
2024-06-14 15:00 ` [PATCH v3 18/38] x86/resctrl: Export the is_mbm_*_enabled() helpers to asm/resctrl.h James Morse
2024-06-14 15:00 ` [PATCH v3 19/38] x86/resctrl: Add resctrl_arch_is_evt_configurable() to abstract BMEC James Morse
2024-06-14 15:00 ` [PATCH v3 20/38] x86/resctrl: Change mon_event_config_{read,write}() to be arch helpers James Morse
2024-06-28 16:49 ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 21/38] x86/resctrl: Move mbm_cfg_mask to struct rdt_resource James Morse
2024-06-28 16:53 ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 22/38] x86/resctrl: Add resctrl_arch_ prefix to pseudo lock functions James Morse
2024-06-14 15:00 ` [PATCH v3 23/38] x86/resctrl: Allow an architecture to disable pseudo lock James Morse
2024-07-11 21:33 ` Carl Worth
2024-08-02 17:22 ` James Morse
2024-06-14 15:00 ` [PATCH v3 24/38] x86/resctrl: Make prefetch_disable_bits belong to the arch code James Morse
2024-06-14 15:00 ` [PATCH v3 25/38] x86/resctrl: Make resctrl_arch_pseudo_lock_fn() take a plr James Morse
2024-06-14 15:00 ` [PATCH v3 26/38] x86/resctrl: Move thread_throttle_mode_init() to be managed by resctrl James Morse
2024-06-14 15:00 ` [PATCH v3 27/38] x86/resctrl: Move get_config_index() to a header James Morse
2024-06-14 15:00 ` [PATCH v3 28/38] x86/resctrl: Claim get_domain_from_cpu() for resctrl James Morse
2024-06-14 15:00 ` [PATCH v3 29/38] x86/resctrl: Describe resctrl's bitmap size assumptions James Morse
2024-06-14 15:00 ` [PATCH v3 30/38] x86/resctrl: Rename resctrl_sched_in() to begin with "resctrl_arch_" James Morse
2024-06-14 15:00 ` [PATCH v3 31/38] x86/resctrl: resctrl_exit() teardown resctrl but leave the mount point James Morse
2024-06-28 16:53 ` Reinette Chatre
2024-07-04 16:41 ` James Morse
2024-07-08 17:47 ` Reinette Chatre
2024-08-02 17:28 ` James Morse
2024-06-14 15:00 ` [PATCH v3 32/38] x86/resctrl: Drop __init/__exit on assorted symbols James Morse
2024-06-14 15:00 ` [PATCH v3 33/38] x86/resctrl: Move is_mba_sc() out of core.c James Morse
2024-06-14 15:00 ` [PATCH v3 34/38] x86/resctrl: Add end-marker to the resctrl_event_id enum James Morse
2024-06-14 15:00 ` [PATCH v3 35/38] x86/resctrl: Remove a newline to avoid confusing the code move script James Morse
2024-06-14 15:00 ` [PATCH v3 36/38] fs/resctrl: Add boiler plate for external resctrl code James Morse
2024-06-28 16:54 ` Reinette Chatre
2024-07-04 16:40 ` James Morse
2024-07-08 17:47 ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 37/38] x86/resctrl: Move the filesystem bits to headers visible to fs/resctrl James Morse
2024-06-28 17:04 ` Reinette Chatre
2024-06-14 15:00 ` [PATCH v3 38/38] x86/resctrl: Add python script to move resctrl code to /fs/resctrl James Morse
2024-07-11 22:00 ` [PATCH v3 00/38] x86/resctrl: Move the resctrl filesystem " Carl Worth
2024-08-02 17:22 ` James Morse
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=d9568ea8-08cc-4e3b-9951-78acbcd54075@intel.com \
--to=reinette.chatre@intel.com \
--cc=Babu.Moger@amd.com \
--cc=amitsinght@marvell.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=bobo.shaobowang@huawei.com \
--cc=bp@alien8.de \
--cc=carl@os.amperecomputing.com \
--cc=dave.martin@arm.com \
--cc=david@redhat.com \
--cc=dfustini@baylibre.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=lcherian@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peternewman@google.com \
--cc=quic_jiles@quicinc.com \
--cc=rex.nie@jaguarmicro.com \
--cc=scott@os.amperecomputing.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=tan.shaopeng@fujitsu.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xhao@linux.alibaba.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