2023-09-16 04:47:05

by Moger, Babu

[permalink] [raw]
Subject: [PATCH v10 10/10] x86/resctrl: Display RMID of resource group

In x86, hardware uses RMID to identify a monitoring group. When a user
creates a monitor group these details are not visible. These details
can help resctrl debugging.

Add RMID(mon_hw_id) to the monitor groups display in resctrl interface.
Users can see these details when resctrl is mounted with "-o debug" option.

Other architectures do not use "RMID". Use the name mon_hw_id to refer
to "RMID" in an effort to keep the naming generic.

For example:
$cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id
3

Signed-off-by: Babu Moger <[email protected]>
---
Documentation/arch/x86/resctrl.rst | 4 ++++
arch/x86/kernel/cpu/resctrl/internal.h | 5 +++++
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++
3 files changed, 32 insertions(+)

diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst
index 54691c8b832d..98b0eb509ed4 100644
--- a/Documentation/arch/x86/resctrl.rst
+++ b/Documentation/arch/x86/resctrl.rst
@@ -369,6 +369,10 @@ When monitoring is enabled all MON groups will also contain:
the sum for all tasks in the CTRL_MON group and all tasks in
MON groups. Please see example section for more details on usage.

+"mon_hw_id":
+ Available only with debug option. The identifier used by hardware
+ for the monitor group. On x86 this is the RMID.
+
Resource allocation rules
-------------------------

diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index a07fa4329b65..b4910892b0a6 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -296,6 +296,11 @@ struct rdtgroup {
* --> RFTYPE_BASE (Files common for both MON and CTRL groups)
* Files: cpus, cpus_list, tasks
*
+ * --> RFTYPE_MON (Files only for MON group)
+ *
+ * --> RFTYPE_DEBUG (Files to help resctrl debugging)
+ * File: mon_hw_id
+ *
* --> RFTYPE_CTRL (Files only for CTRL group)
* Files: mode, schemata, size
*
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 55d1b90f460e..ef4b18091e5d 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -795,6 +795,22 @@ static int rdtgroup_closid_show(struct kernfs_open_file *of,
return ret;
}

+static int rdtgroup_rmid_show(struct kernfs_open_file *of,
+ struct seq_file *s, void *v)
+{
+ struct rdtgroup *rdtgrp;
+ int ret = 0;
+
+ rdtgrp = rdtgroup_kn_lock_live(of->kn);
+ if (rdtgrp)
+ seq_printf(s, "%u\n", rdtgrp->mon.rmid);
+ else
+ ret = -ENOENT;
+ rdtgroup_kn_unlock(of->kn);
+
+ return ret;
+}
+
#ifdef CONFIG_PROC_CPU_RESCTRL

/*
@@ -1856,6 +1872,13 @@ static struct rftype res_common_files[] = {
.seq_show = rdtgroup_tasks_show,
.fflags = RFTYPE_BASE,
},
+ {
+ .name = "mon_hw_id",
+ .mode = 0444,
+ .kf_ops = &rdtgroup_kf_single_ops,
+ .seq_show = rdtgroup_rmid_show,
+ .fflags = RFTYPE_MON_BASE | RFTYPE_DEBUG,
+ },
{
.name = "schemata",
.mode = 0644,
--
2.34.1


2023-09-22 18:52:07

by Peter Newman

[permalink] [raw]
Subject: Re: [PATCH v10 10/10] x86/resctrl: Display RMID of resource group

Hi Babu,

On Sat, Sep 16, 2023 at 12:42 AM Babu Moger <[email protected]> wrote:
>
> In x86, hardware uses RMID to identify a monitoring group. When a user
> creates a monitor group these details are not visible. These details
> can help resctrl debugging.
>
> Add RMID(mon_hw_id) to the monitor groups display in resctrl interface.
> Users can see these details when resctrl is mounted with "-o debug" option.

When I reviewed this, I went through the whole series second-guessing
the wording above and wondering whether "monitoring groups" applied to
CTRL_MON groups.

I was able to confirm that mon_hw_id did appear and had a believable
value in CTRL_MON groups which had allocated monitors. (and I added
some comma-separated PID lists to the tasks node)

for the series:
Tested-By: Peter Newman <[email protected]>

> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
> index a07fa4329b65..b4910892b0a6 100644
> --- a/arch/x86/kernel/cpu/resctrl/internal.h
> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
> @@ -296,6 +296,11 @@ struct rdtgroup {
> * --> RFTYPE_BASE (Files common for both MON and CTRL groups)
> * Files: cpus, cpus_list, tasks
> *
> + * --> RFTYPE_MON (Files only for MON group)

If monitoring is supported, all groups are MON groups. I think the
"only" above caused me to second guess whether this takes into account
CTRL_MON groups getting the RFTYPE_MON flag set dynamically.

However, I think the documentation above is still technically accurate.

for the series:
Reviewed-By: Peter Newman <[email protected]>

Thanks!
-Peter

2023-09-22 21:10:54

by Fenghua Yu

[permalink] [raw]
Subject: Re: [PATCH v10 10/10] x86/resctrl: Display RMID of resource group

Hi, Peter,

On 9/22/23 07:36, Peter Newman wrote:
> Hi Babu,
>
> On Sat, Sep 16, 2023 at 12:42 AM Babu Moger <[email protected]> wrote:
>>
>> In x86, hardware uses RMID to identify a monitoring group. When a user
>> creates a monitor group these details are not visible. These details
>> can help resctrl debugging.
>>
>> Add RMID(mon_hw_id) to the monitor groups display in resctrl interface.
>> Users can see these details when resctrl is mounted with "-o debug" option.
>
> When I reviewed this, I went through the whole series second-guessing
> the wording above and wondering whether "monitoring groups" applied to
> CTRL_MON groups.
>
> I was able to confirm that mon_hw_id did appear and had a believable
> value in CTRL_MON groups which had allocated monitors. (and I added
> some comma-separated PID lists to the tasks node)
>
> for the series:
> Tested-By: Peter Newman <[email protected]>

Please use "Tested-by" instead of "Tested-By" (the "By" is wrong).

>
>> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
>> index a07fa4329b65..b4910892b0a6 100644
>> --- a/arch/x86/kernel/cpu/resctrl/internal.h
>> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
>> @@ -296,6 +296,11 @@ struct rdtgroup {
>> * --> RFTYPE_BASE (Files common for both MON and CTRL groups)
>> * Files: cpus, cpus_list, tasks
>> *
>> + * --> RFTYPE_MON (Files only for MON group)
>
> If monitoring is supported, all groups are MON groups. I think the
> "only" above caused me to second guess whether this takes into account
> CTRL_MON groups getting the RFTYPE_MON flag set dynamically.
>
> However, I think the documentation above is still technically accurate.
>
> for the series:
> Reviewed-By: Peter Newman <[email protected]>

Please use "Reviewed-by" instead of "Reviewed-By" (the "By" is wrong).

Thanks.

-Fenghua

2023-09-22 23:31:38

by Moger, Babu

[permalink] [raw]
Subject: Re: [PATCH v10 10/10] x86/resctrl: Display RMID of resource group

Hi Peter,

On 9/22/2023 9:36 AM, Peter Newman wrote:
> Hi Babu,
>
> On Sat, Sep 16, 2023 at 12:42 AM Babu Moger <[email protected]> wrote:
>> In x86, hardware uses RMID to identify a monitoring group. When a user
>> creates a monitor group these details are not visible. These details
>> can help resctrl debugging.
>>
>> Add RMID(mon_hw_id) to the monitor groups display in resctrl interface.
>> Users can see these details when resctrl is mounted with "-o debug" option.
> When I reviewed this, I went through the whole series second-guessing
> the wording above and wondering whether "monitoring groups" applied to
> CTRL_MON groups.
>
> I was able to confirm that mon_hw_id did appear and had a believable
> value in CTRL_MON groups which had allocated monitors. (and I added
> some comma-separated PID lists to the tasks node)
>
> for the series:
> Tested-By: Peter Newman <[email protected]>
Thank you.
>
>> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
>> index a07fa4329b65..b4910892b0a6 100644
>> --- a/arch/x86/kernel/cpu/resctrl/internal.h
>> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
>> @@ -296,6 +296,11 @@ struct rdtgroup {
>> * --> RFTYPE_BASE (Files common for both MON and CTRL groups)
>> * Files: cpus, cpus_list, tasks
>> *
>> + * --> RFTYPE_MON (Files only for MON group)
> If monitoring is supported, all groups are MON groups. I think the
> "only" above caused me to second guess whether this takes into account
> CTRL_MON groups getting the RFTYPE_MON flag set dynamically.
>
> However, I think the documentation above is still technically accurate.
Thanks. If there is another revision, I am open to remove "only" from
this text.
>
> for the series:
> Reviewed-By: Peter Newman <[email protected]>

Thanks

Babu

2023-09-25 13:45:30

by Peter Newman

[permalink] [raw]
Subject: Re: [PATCH v10 10/10] x86/resctrl: Display RMID of resource group

On Fri, Sep 22, 2023 at 7:59 PM Fenghua Yu <[email protected]> wrote:
> On 9/22/23 07:36, Peter Newman wrote:
> > On Sat, Sep 16, 2023 at 12:42 AM Babu Moger <[email protected]> wrote:
> >>
> >> In x86, hardware uses RMID to identify a monitoring group. When a user
> >> creates a monitor group these details are not visible. These details
> >> can help resctrl debugging.
> >>
> >> Add RMID(mon_hw_id) to the monitor groups display in resctrl interface.
> >> Users can see these details when resctrl is mounted with "-o debug" option.
> >
> > When I reviewed this, I went through the whole series second-guessing
> > the wording above and wondering whether "monitoring groups" applied to
> > CTRL_MON groups.
> >
> > I was able to confirm that mon_hw_id did appear and had a believable
> > value in CTRL_MON groups which had allocated monitors. (and I added
> > some comma-separated PID lists to the tasks node)
> >
> > for the series:
> > Tested-By: Peter Newman <[email protected]>
>
> Please use "Tested-by" instead of "Tested-By" (the "By" is wrong).

Tested-by: Peter Newman <[email protected]>

> >
> >> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
> >> index a07fa4329b65..b4910892b0a6 100644
> >> --- a/arch/x86/kernel/cpu/resctrl/internal.h
> >> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
> >> @@ -296,6 +296,11 @@ struct rdtgroup {
> >> * --> RFTYPE_BASE (Files common for both MON and CTRL groups)
> >> * Files: cpus, cpus_list, tasks
> >> *
> >> + * --> RFTYPE_MON (Files only for MON group)
> >
> > If monitoring is supported, all groups are MON groups. I think the
> > "only" above caused me to second guess whether this takes into account
> > CTRL_MON groups getting the RFTYPE_MON flag set dynamically.
> >
> > However, I think the documentation above is still technically accurate.
> >
> > for the series:
> > Reviewed-By: Peter Newman <[email protected]>
>
> Please use "Reviewed-by" instead of "Reviewed-By" (the "By" is wrong).

Reviewed-by: Peter Newman <[email protected]>

2023-09-26 03:43:13

by Fenghua Yu

[permalink] [raw]
Subject: Re: [PATCH v10 10/10] x86/resctrl: Display RMID of resource group



On 9/15/23 15:42, Babu Moger wrote:
> In x86, hardware uses RMID to identify a monitoring group. When a user
> creates a monitor group these details are not visible. These details
> can help resctrl debugging.
>
> Add RMID(mon_hw_id) to the monitor groups display in resctrl interface.
> Users can see these details when resctrl is mounted with "-o debug" option.
>
> Other architectures do not use "RMID". Use the name mon_hw_id to refer
> to "RMID" in an effort to keep the naming generic.
>
> For example:
> $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id
> 3
>
> Signed-off-by: Babu Moger <[email protected]>

Reviewed-by: Fenghua Yu <[email protected]>

Thanks.

-Fenghua

2023-09-28 02:16:09

by Reinette Chatre

[permalink] [raw]
Subject: Re: [PATCH v10 10/10] x86/resctrl: Display RMID of resource group

Hi Babu,

On 9/15/2023 3:42 PM, Babu Moger wrote:
> In x86, hardware uses RMID to identify a monitoring group. When a user
> creates a monitor group these details are not visible. These details
> can help resctrl debugging.
>
> Add RMID(mon_hw_id) to the monitor groups display in resctrl interface.
> Users can see these details when resctrl is mounted with "-o debug" option.
>
> Other architectures do not use "RMID". Use the name mon_hw_id to refer
> to "RMID" in an effort to keep the naming generic.
>
> For example:
> $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id
> 3
>
> Signed-off-by: Babu Moger <[email protected]>
> ---

Reviewed-by: Reinette Chatre <[email protected]>

Reinette

2023-09-29 18:25:30

by Ilpo Järvinen

[permalink] [raw]
Subject: Re: [PATCH v10 10/10] x86/resctrl: Display RMID of resource group

On Fri, 15 Sep 2023, Babu Moger wrote:

> In x86, hardware uses RMID to identify a monitoring group. When a user
> creates a monitor group these details are not visible. These details
> can help resctrl debugging.
>
> Add RMID(mon_hw_id) to the monitor groups display in resctrl interface.
> Users can see these details when resctrl is mounted with "-o debug" option.
>
> Other architectures do not use "RMID". Use the name mon_hw_id to refer
> to "RMID" in an effort to keep the naming generic.
>
> For example:
> $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id
> 3
>
> Signed-off-by: Babu Moger <[email protected]>
> ---
> Documentation/arch/x86/resctrl.rst | 4 ++++
> arch/x86/kernel/cpu/resctrl/internal.h | 5 +++++
> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++
> 3 files changed, 32 insertions(+)
>
> diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst
> index 54691c8b832d..98b0eb509ed4 100644
> --- a/Documentation/arch/x86/resctrl.rst
> +++ b/Documentation/arch/x86/resctrl.rst
> @@ -369,6 +369,10 @@ When monitoring is enabled all MON groups will also contain:
> the sum for all tasks in the CTRL_MON group and all tasks in
> MON groups. Please see example section for more details on usage.
>
> +"mon_hw_id":
> + Available only with debug option. The identifier used by hardware
> + for the monitor group. On x86 this is the RMID.
> +
> Resource allocation rules
> -------------------------
>
> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
> index a07fa4329b65..b4910892b0a6 100644
> --- a/arch/x86/kernel/cpu/resctrl/internal.h
> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
> @@ -296,6 +296,11 @@ struct rdtgroup {
> * --> RFTYPE_BASE (Files common for both MON and CTRL groups)
> * Files: cpus, cpus_list, tasks
> *
> + * --> RFTYPE_MON (Files only for MON group)
> + *
> + * --> RFTYPE_DEBUG (Files to help resctrl debugging)
> + * File: mon_hw_id
> + *
> * --> RFTYPE_CTRL (Files only for CTRL group)
> * Files: mode, schemata, size
> *
> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index 55d1b90f460e..ef4b18091e5d 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -795,6 +795,22 @@ static int rdtgroup_closid_show(struct kernfs_open_file *of,
> return ret;
> }
>
> +static int rdtgroup_rmid_show(struct kernfs_open_file *of,
> + struct seq_file *s, void *v)
> +{
> + struct rdtgroup *rdtgrp;
> + int ret = 0;
> +
> + rdtgrp = rdtgroup_kn_lock_live(of->kn);
> + if (rdtgrp)
> + seq_printf(s, "%u\n", rdtgrp->mon.rmid);
> + else
> + ret = -ENOENT;
> + rdtgroup_kn_unlock(of->kn);
> +
> + return ret;
> +}
> +
> #ifdef CONFIG_PROC_CPU_RESCTRL
>
> /*
> @@ -1856,6 +1872,13 @@ static struct rftype res_common_files[] = {
> .seq_show = rdtgroup_tasks_show,
> .fflags = RFTYPE_BASE,
> },
> + {
> + .name = "mon_hw_id",
> + .mode = 0444,
> + .kf_ops = &rdtgroup_kf_single_ops,
> + .seq_show = rdtgroup_rmid_show,
> + .fflags = RFTYPE_MON_BASE | RFTYPE_DEBUG,
> + },
> {
> .name = "schemata",
> .mode = 0644,
>

Reviewed-by: Ilpo J?rvinen <[email protected]>


--
i.