[PATCH v5 4/8] x86/resctrl: Add node-scope to the options for feature scope

Tony Luck posted 8 patches 2 years, 3 months ago
There is a newer version of this series
[PATCH v5 4/8] x86/resctrl: Add node-scope to the options for feature scope
Posted by Tony Luck 2 years, 3 months ago
Currently supported resctrl features are all domain scoped the same as the
scope of the L2 or L3 caches.

Add "node" as a new option for domain scope.

Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 include/linux/resctrl.h            | 1 +
 arch/x86/kernel/cpu/resctrl/core.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 08382548571e..f55cf7afd4eb 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -163,6 +163,7 @@ struct resctrl_schema;
 enum resctrl_scope {
 	RESCTRL_L3_CACHE,
 	RESCTRL_L2_CACHE,
+	RESCTRL_NODE,
 };
 
 /**
diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index 3e08aa04a7ff..9fcc264fac6c 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -514,6 +514,8 @@ static int get_domain_id_from_scope(int cpu, enum resctrl_scope scope)
 		return get_cpu_cacheinfo_id(cpu, 3);
 	case RESCTRL_L2_CACHE:
 		return get_cpu_cacheinfo_id(cpu, 2);
+	case RESCTRL_NODE:
+		return cpu_to_node(cpu);
 	default:
 		WARN_ON_ONCE(1);
 		break;
-- 
2.41.0
Re: [PATCH v5 4/8] x86/resctrl: Add node-scope to the options for feature scope
Posted by Reinette Chatre 2 years, 2 months ago
Hi Tony,

On 8/29/2023 4:44 PM, Tony Luck wrote:
> Currently supported resctrl features are all domain scoped the same as the
> scope of the L2 or L3 caches.

fyi ... this patch series seems to use the terms "resctrl feature"
and "resctrl resource" interchangeably and it is not always clear
if the terms mean something different.

> 
> Add "node" as a new option for domain scope.

Could the commit message please get a snippet about what "node"
represents and why this new scope is needed?

> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
>  include/linux/resctrl.h            | 1 +
>  arch/x86/kernel/cpu/resctrl/core.c | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
> index 08382548571e..f55cf7afd4eb 100644
> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -163,6 +163,7 @@ struct resctrl_schema;
>  enum resctrl_scope {
>  	RESCTRL_L3_CACHE,
>  	RESCTRL_L2_CACHE,
> +	RESCTRL_NODE,
>  };
>  
>  /**
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 3e08aa04a7ff..9fcc264fac6c 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -514,6 +514,8 @@ static int get_domain_id_from_scope(int cpu, enum resctrl_scope scope)
>  		return get_cpu_cacheinfo_id(cpu, 3);
>  	case RESCTRL_L2_CACHE:
>  		return get_cpu_cacheinfo_id(cpu, 2);
> +	case RESCTRL_NODE:
> +		return cpu_to_node(cpu);
>  	default:
>  		WARN_ON_ONCE(1);
>  		break;


Reinette
Re: [PATCH v5 4/8] x86/resctrl: Add node-scope to the options for feature scope
Posted by Tony Luck 2 years, 2 months ago
On Mon, Sep 25, 2023 at 04:25:54PM -0700, Reinette Chatre wrote:
> Hi Tony,
> 
> On 8/29/2023 4:44 PM, Tony Luck wrote:
> > Currently supported resctrl features are all domain scoped the same as the
> > scope of the L2 or L3 caches.
> 
> fyi ... this patch series seems to use the terms "resctrl feature"
> and "resctrl resource" interchangeably and it is not always clear
> if the terms mean something different.

I think a "resctrl feature" is a h/w control or monitor feature. A
"resctrl resource" is "struct rdt_resource" (which may have more than
one "resctrl feature" attached to it. E.g. the RDT_RESOURCE_L3 resource
has L3 CAT, MBM, CQM attached).

> 
> > 
> > Add "node" as a new option for domain scope.
> 
> Could the commit message please get a snippet about what "node"
> represents and why this new scope is needed?

Yes. I've added a note.

> 
> > Signed-off-by: Tony Luck <tony.luck@intel.com>
> > ---
> >  include/linux/resctrl.h            | 1 +
> >  arch/x86/kernel/cpu/resctrl/core.c | 2 ++
> >  2 files changed, 3 insertions(+)
> > 
> > diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
> > index 08382548571e..f55cf7afd4eb 100644
> > --- a/include/linux/resctrl.h
> > +++ b/include/linux/resctrl.h
> > @@ -163,6 +163,7 @@ struct resctrl_schema;
> >  enum resctrl_scope {
> >  	RESCTRL_L3_CACHE,
> >  	RESCTRL_L2_CACHE,
> > +	RESCTRL_NODE,
> >  };
> >  
> >  /**
> > diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> > index 3e08aa04a7ff..9fcc264fac6c 100644
> > --- a/arch/x86/kernel/cpu/resctrl/core.c
> > +++ b/arch/x86/kernel/cpu/resctrl/core.c
> > @@ -514,6 +514,8 @@ static int get_domain_id_from_scope(int cpu, enum resctrl_scope scope)
> >  		return get_cpu_cacheinfo_id(cpu, 3);
> >  	case RESCTRL_L2_CACHE:
> >  		return get_cpu_cacheinfo_id(cpu, 2);
> > +	case RESCTRL_NODE:
> > +		return cpu_to_node(cpu);
> >  	default:
> >  		WARN_ON_ONCE(1);
> >  		break;
> 
> 
> Reinette
Re: [PATCH v5 4/8] x86/resctrl: Add node-scope to the options for feature scope
Posted by Reinette Chatre 2 years, 2 months ago
Hi Tony,

On 9/28/2023 10:42 AM, Tony Luck wrote:
> On Mon, Sep 25, 2023 at 04:25:54PM -0700, Reinette Chatre wrote:
>> Hi Tony,
>>
>> On 8/29/2023 4:44 PM, Tony Luck wrote:
>>> Currently supported resctrl features are all domain scoped the same as the
>>> scope of the L2 or L3 caches.
>>
>> fyi ... this patch series seems to use the terms "resctrl feature"
>> and "resctrl resource" interchangeably and it is not always clear
>> if the terms mean something different.
> 
> I think a "resctrl feature" is a h/w control or monitor feature. A
> "resctrl resource" is "struct rdt_resource" (which may have more than
> one "resctrl feature" attached to it. E.g. the RDT_RESOURCE_L3 resource
> has L3 CAT, MBM, CQM attached).

Please keep in mind that in resctrl documentation
(Documentation/arch/x86/resctrl.rst) L3_MON is described as 
a resource. The main message is just to ensure that it is clear
what is meant with particular terms and then be consistent in
their use.

Reinette