mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: "Chen, Yu C" <yu.c.chen@intel.com>
Cc: Ben Horgan <ben.horgan@arm.com>,
	James Morse <james.morse@arm.com>,
	"Dave Martin" <Dave.Martin@arm.com>,
	Babu Moger <babu.moger@amd.com>,
	Drew Fustini <fustini@kernel.org>,
	Fenghua Yu <fenghuay@nvidia.com>, Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Peter Newman <peternewman@google.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Luck, Tony" <tony.luck@intel.com>, <chen.yu@linux.dev>
Subject: Re: [RFC] mpam,x86,fs/resctrl: Generic schema description Proof of Concept
Date: Tue, 14 Jul 2026 14:39:46 -0700	[thread overview]
Message-ID: <b4eda8aa-55a3-4b11-b4f7-f94246509cab@intel.com> (raw)
In-Reply-To: <68b1b8db-4ffd-4e3b-a097-3bade368ab73@intel.com>

Hi Chenyu,

On 7/8/26 5:56 AM, Chen, Yu C wrote:
> Hi Reinette,
> 
> On 6/5/2026 5:42 AM, Reinette Chatre wrote:
>> Hi Tony,
>>
>> On 6/3/26 11:46 AM, Luck, Tony wrote:
>>> Reinette,
>>>
>>> Tiny bug in "mpam,x86,fs/resctrl: Transition resource control to a list"
>>>
>>>> /*
>>>>   * Return length needed to display longest control suffix.
>>>>   * Add 1 for the "_" character when control name exists.
>>>>   */
>>>> size_t resctrl_resource_ctrl_max_len(struct rdt_resource *r)
>>>> {
>>>>     struct resctrl_ctrl *ctrl;
>>>>     size_t total = 0;
>>>>     size_t len;
>>>>
>>>>     for_each_resource_ctrl(ctrl,r) {
>>>>         len = strlen(resctrl_ctrl_name_str(ctrl->name));
>>>>         if (len)
>>>>             total += 1 + len;
>>>
>>> Should be:
>>>
>>>             total = max(total, 1 + len);
>>
>> Thank you very much. I squashed this locally.
>>
> 
> A minor alignment schemata issue is found when testing region-aware RDT:
> [resctrl]# cat schemata
>             MB:0=100
>             MB_REGION0_OPT:0=255
>             MB_REGION0_MIN:0=255
>             MB_REGION0_MAX:0=255
>             MB_REGION1_OPT:0=255
>             MB_REGION1_MIN:0=255
>             MB_REGION1_MAX:0=255
>             L2:0=ffff;2=ffff;4=ffff
>             L3:0=3ff
> 
> The schemata file right-justified only the resource name in a
> max_name_width field, then printed the control suffix afterwards
> without padding. Since max_name_width reserves space for name plus
> suffix, this left a run of spaces before every line. A small hacky
> fix:
> 
> diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
> index 9b51464b66b7..7d517f3457bf 100644
> --- a/fs/resctrl/ctrlmondata.c
> +++ b/fs/resctrl/ctrlmondata.c
> @@ -521,6 +521,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
>  static void show_doms(struct seq_file *s, struct rdt_resource_final *f,
>                       bool print_ctrl, int closid, struct resctrl_ctrl *ctrl)
>  {
> +       char name[20];
>         struct rdt_resource *r = f->res;
>         struct rdt_ctrl_domain *dom;
>         bool sep = false;
> @@ -529,11 +530,13 @@ static void show_doms(struct seq_file *s, struct rdt_resource_final *f,
>         /* Walking r->domains, ensure it can't race with cpuhp */
>         lockdep_assert_cpus_held();
> 
> -       if (print_ctrl)
> -               seq_printf(s, "%*s%s%s:", max_name_width, f->name,
> -                               resctrl_ctrl_is_default(ctrl) ? "" : "_",
> -                               resctrl_ctrl_is_default(ctrl) ?
> -                                "" : resctrl_ctrl_name_str(ctrl->name));
> +       if (print_ctrl) {
> +               snprintf(name, sizeof(name), "%s%s%s", f->name,
> +                        resctrl_ctrl_is_default(ctrl) ? "" : "_",
> +                        resctrl_ctrl_is_default(ctrl) ?
> +                         "" : resctrl_ctrl_name_str(ctrl->name));
> +               seq_printf(s, "%*s:", max_name_width, name);
> +       }
>         list_for_each_entry(dom, &ctrl->domains, hdr.list) {
>                 if (sep)
>                         seq_puts(s, ";");
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index c1aac0dcd332..916bf6a8eab4 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
> @@ -1654,6 +1654,7 @@ static int rdtgroup_size_show(struct kernfs_open_file *of,
>         struct rdtgroup *rdtgrp;
>         struct rdt_resource *r;
>         unsigned int size;
> +       char name[20];
>         u32 ctrl_val;
>         int ret = 0;
>         u32 closid;
> @@ -1693,11 +1694,11 @@ static int rdtgroup_size_show(struct kernfs_open_file *of,
>                 type = f->conf_type;
>                 for_each_resource_ctrl(ctrl, r) {
>                         sep = false;
> -                       seq_printf(s, "%*s", max_name_width, f->name);
> -                       if (!resctrl_ctrl_is_default(ctrl))
> -                               seq_printf(s, "_%s:", resctrl_ctrl_name_str(ctrl->name));
> -                       else
> -                               seq_putc(s, ':');
> +                       snprintf(name, sizeof(name), "%s%s%s", f->name,
> +                                resctrl_ctrl_is_default(ctrl) ? "" : "_",
> +                                resctrl_ctrl_is_default(ctrl) ?
> +                                 "" : resctrl_ctrl_name_str(ctrl->name));
> +                       seq_printf(s, "%*s:", max_name_width, name);
>                         list_for_each_entry(d, &ctrl->domains, hdr.list) {
>                                 if (sep)
>                                         seq_putc(s, ';');
> 
> 
> 
> And it becomes:
> [ resctrl]# cat schemata
>             MB:0=100
> MB_REGION0_OPT:0=255
> MB_REGION0_MIN:0=255
> MB_REGION0_MAX:0=255
> MB_REGION1_OPT:0=255
> MB_REGION1_MIN:0=255
> MB_REGION1_MAX:0=255
>             L2:0=ffff;2=ffff;4=ffff
>             L3:0=3ff
> 
Thank you for the report and the proposed fix. I'll look into making the fix generic.

Reinette


  reply	other threads:[~2026-07-14 21:39 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 18:06 Reinette Chatre
2026-06-02 20:23 ` Babu Moger
2026-06-02 22:56   ` Reinette Chatre
2026-06-03  1:14     ` Moger, Babu
2026-06-03  3:55       ` Reinette Chatre
2026-06-03 14:40         ` Babu Moger
2026-06-02 23:32 ` Chen, Yu C
2026-06-03  3:45   ` Reinette Chatre
2026-06-03 11:53     ` Chen, Yu C
2026-06-04 16:37       ` Reinette Chatre
2026-06-05 15:43         ` Chen, Yu C
2026-06-05 16:20           ` Reinette Chatre
2026-06-03 15:15 ` Ben Horgan
2026-06-03 19:34   ` Drew Fustini
2026-06-04 11:24     ` Ben Horgan
2026-06-04 17:38       ` Drew Fustini
2026-06-12  1:30         ` Shaopeng Tan (Fujitsu)
2026-06-17 15:29           ` Reinette Chatre
2026-06-19  1:42             ` Shaopeng Tan (Fujitsu)
2026-06-22 16:10               ` Reinette Chatre
2026-06-23  5:04                 ` Shaopeng Tan (Fujitsu)
2026-06-04 21:05     ` Reinette Chatre
2026-06-05 19:35       ` Drew Fustini
2026-06-06  5:10         ` Drew Fustini
2026-06-06  5:23           ` Drew Fustini
2026-06-04 17:43   ` Reinette Chatre
2026-06-05 14:53     ` Ben Horgan
2026-06-05 15:39       ` Reinette Chatre
2026-06-05 16:37         ` Ben Horgan
2026-06-08 16:16           ` Reinette Chatre
2026-06-09 10:10             ` Ben Horgan
2026-06-09 15:28               ` Reinette Chatre
2026-06-09 16:37                 ` Ben Horgan
2026-06-09 17:41                   ` Reinette Chatre
2026-06-10  7:09                     ` Chen, Yu C
2026-06-10 14:27                       ` Chen, Yu C
2026-06-10 16:13                         ` Reinette Chatre
2026-06-10 17:57                           ` Chen, Yu C
2026-06-10 18:10                             ` Reinette Chatre
2026-06-10 15:59                       ` Reinette Chatre
2026-06-10 18:05                         ` Chen, Yu C
2026-06-11  3:26                         ` Chen, Yu C
2026-06-11 15:45                           ` Reinette Chatre
2026-06-26 15:46                             ` Chen, Yu C
2026-07-02 14:27                               ` Ben Horgan
2026-07-03  9:01                                 ` Chen, Yu C
2026-07-14 21:37                               ` Reinette Chatre
2026-07-15  2:49                                 ` Chen, Yu C
2026-06-10  4:31                 ` Drew Fustini
2026-06-10 15:14                   ` Reinette Chatre
2026-06-03 18:46 ` Luck, Tony
2026-06-04 10:02   ` Ben Horgan
2026-06-04 21:42   ` Reinette Chatre
2026-07-08 12:56     ` Chen, Yu C
2026-07-14 21:39       ` Reinette Chatre [this message]
2026-06-03 22:14 ` Drew Fustini
2026-06-04 21:47   ` Reinette Chatre
2026-06-05 19:48     ` Drew Fustini
2026-06-15 21:05 ` Moger, Babu
2026-06-17 17:18   ` Reinette Chatre
2026-06-17 20:29     ` Babu Moger
2026-06-24 19:08 ` Fenghua Yu
2026-06-24 22:22   ` Reinette Chatre
2026-06-25  1:26     ` Fenghua Yu
2026-06-25 15:43       ` Reinette Chatre
2026-07-10 20:59         ` Fenghua Yu
2026-07-14 22:06           ` Reinette Chatre
2026-07-15  8:34             ` Ben Horgan
2026-07-15 15:41               ` Reinette Chatre
2026-07-16 14:59                 ` Ben Horgan
2026-07-16 16:02                   ` Luck, Tony
2026-07-16 16:22                     ` Ben Horgan
2026-07-16 17:50                       ` Reinette Chatre
2026-07-17 10:27                         ` Ben Horgan
2026-07-16 16:04                   ` Reinette Chatre
2026-07-16 16:44                     ` Ben Horgan
2026-07-16 17:07                       ` Reinette Chatre
2026-07-17 12:20                         ` Ben Horgan
2026-07-17 16:00                           ` Reinette Chatre
2026-07-20 13:30                             ` Ben Horgan
2026-07-20 22:54                               ` Reinette Chatre
2026-07-21 13:23                                 ` Ben Horgan
2026-07-21 17:30                                   ` Reinette Chatre
2026-07-21 20:02                                     ` Babu Moger
2026-07-22 10:47                                       ` Ben Horgan
2026-07-22 17:02                                         ` Babu Moger
2026-08-04  9:11                                           ` Ben Horgan
2026-08-04 14:09                                             ` Babu Moger
2026-08-04 15:11                                               ` Ben Horgan
2026-08-04 19:51                                                 ` Babu Moger
2026-08-05  6:06                                                 ` Reinette Chatre
2026-08-06  9:24                                                   ` Ben Horgan
2026-08-07 22:53                                                     ` Reinette Chatre
2026-07-22 10:03                                     ` Ben Horgan
2026-07-22 16:32                                       ` Reinette Chatre
2026-07-23  7:58                                         ` Ben Horgan
2026-07-23 15:52                                           ` Reinette Chatre
2026-07-23 22:08                                   ` Fenghua Yu
2026-07-27  9:13                                     ` Ben Horgan
2026-07-17 16:02                     ` Chen, Yu C
2026-07-17 16:55                       ` Reinette Chatre
2026-07-23  0:17             ` Fenghua Yu
2026-07-23 16:18               ` Reinette Chatre
2026-07-23 22:27                 ` Fenghua Yu
2026-07-23 23:31                   ` Reinette Chatre
2026-07-02 13:37       ` Ben Horgan
2026-07-02 15:16         ` Fenghua Yu
2026-07-03 13:42           ` Ben Horgan

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=b4eda8aa-55a3-4b11-b4f7-f94246509cab@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=chen.yu@linux.dev \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghuay@nvidia.com \
    --cc=fustini@kernel.org \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peternewman@google.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®