[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54b4d6a1-fcfd-404b-bc36-930f7785a7a5@intel.com>
Date: Mon, 21 Oct 2024 10:39:23 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: James Morse <james.morse@....com>, <x86@...nel.org>,
<linux-kernel@...r.kernel.org>
CC: Fenghua Yu <fenghua.yu@...el.com>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, H Peter Anvin
<hpa@...or.com>, Babu Moger <Babu.Moger@....com>,
<shameerali.kolothum.thodi@...wei.com>, D Scott Phillips OS
<scott@...amperecomputing.com>, <carl@...amperecomputing.com>,
<lcherian@...vell.com>, <bobo.shaobowang@...wei.com>,
<tan.shaopeng@...itsu.com>, <baolin.wang@...ux.alibaba.com>, Jamie Iles
<quic_jiles@...cinc.com>, Xin Hao <xhao@...ux.alibaba.com>,
<peternewman@...gle.com>, <dfustini@...libre.com>, <amitsinght@...vell.com>,
David Hildenbrand <david@...hat.com>, Rex Nie <rex.nie@...uarmicro.com>,
"Dave Martin" <dave.martin@....com>, Shaopeng Tan
<tan.shaopeng@...fujitsu.com>
Subject: Re: [PATCH v5 05/40] x86/resctrl: Use schema type to determine the
schema format string
Hi James,
On 10/4/24 11:03 AM, James Morse wrote:
> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index 11153271cbdc..896350e9fb32 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -2600,6 +2600,15 @@ static int schemata_list_add(struct rdt_resource *r, enum resctrl_conf_type type
> if (cl > max_name_width)
> max_name_width = cl;
>
> + switch (r->schema_fmt) {
> + case RESCTRL_SCHEMA_BITMAP:
> + s->fmt_str = "%d=%0*x";
> + break;
> + case RESCTRL_SCHEMA_RANGE:
> + s->fmt_str = "%d=%0*u";
> + break;
> + }
> +
The parsing of user input happens after the creation of the schema list. If the goal
is to protect against incorrect arch settings then I think schemata_list_add() initialization of
s->fmt_str needs similar WARN_ON_ONCE() treatment as planned [1] for parse_ctrlval within
parse_line().
Reinette
[1] https://lore.kernel.org/all/d48e65cc-3c7b-4a93-80a2-fa0d676e88c4@arm.com/
Powered by blists - more mailing lists