[PATCH v5 7/8] x86/resctrl: Update documentation with Sub-NUMA cluster changes

Tony Luck posted 8 patches 2 years, 3 months ago
There is a newer version of this series
[PATCH v5 7/8] x86/resctrl: Update documentation with Sub-NUMA cluster changes
Posted by Tony Luck 2 years, 3 months ago
With Sub-NUMA Cluster mode enabled the scope of monitoring resources is
per-NODE instead of per-L3 cache. Suffixes of directories with "L3" in
their name refer to Sub-NUMA nodes instead of L3 cache ids.

Users should be aware that SNC mode also affects the amount of L3 cache
available for allocation within each SNC node.

Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 Documentation/arch/x86/resctrl.rst | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst
index cb05d90111b4..407764f43f25 100644
--- a/Documentation/arch/x86/resctrl.rst
+++ b/Documentation/arch/x86/resctrl.rst
@@ -345,9 +345,15 @@ When control is enabled all CTRL_MON groups will also contain:
 When monitoring is enabled all MON groups will also contain:
 
 "mon_data":
-	This contains a set of files organized by L3 domain and by
-	RDT event. E.g. on a system with two L3 domains there will
-	be subdirectories "mon_L3_00" and "mon_L3_01".	Each of these
+	This contains a set of files organized by L3 domain or by NUMA
+	node (depending on whether Sub-NUMA Cluster (SNC) mode is disabled
+	or enabled respectively) and by RDT event. E.g. on a system with
+	SNC mode disabled with two L3 domains there will be subdirectories
+	"mon_L3_00" and "mon_L3_01". The numerical suffix refers to the
+	L3 cache id.  With SNC enabled the directory names are the same,
+	but the numerical suffix refers to the node id.
+        Mappings from node ids to CPUs are available in the
+        /sys/devices/system/node/node*/cpulist files. Each of these
 	directories have one file per event (e.g. "llc_occupancy",
 	"mbm_total_bytes", and "mbm_local_bytes"). In a MON group these
 	files provide a read out of the current value of the event for
@@ -452,6 +458,19 @@ and 0xA are not.  On a system with a 20-bit mask each bit represents 5%
 of the capacity of the cache. You could partition the cache into four
 equal parts with masks: 0x1f, 0x3e0, 0x7c00, 0xf8000.
 
+Notes on Sub-NUMA Cluster mode
+==============================
+When SNC mode is enabled the "llc_occupancy", "mbm_total_bytes", and
+"mbm_local_bytes" will only give accurate results for well behaved NUMA
+applications. I.e. those that perform the majority of memory accesses
+to memory on the local NUMA node to the CPU where the task is executing.
+
+The cache allocation feature still provides the same number of
+bits in a mask to control allocation into the L3 cache. But each
+of those ways has its capacity reduced because the cache is divided
+between the SNC nodes. The values reported in the resctrl
+"size" files are adjusted accordingly.
+
 Memory bandwidth Allocation and monitoring
 ==========================================
 
-- 
2.41.0
Re: [PATCH v5 7/8] x86/resctrl: Update documentation with Sub-NUMA cluster changes
Posted by Moger, Babu 2 years, 2 months ago
Hi Tony,

How does user know Sub-NUMA Cluster mode is being enabled on the system?

Do you have any information in /sys/fs/resctrl/info?

Below documentation does not have any info about it.
Would it be better to add that in "info" directory?

Thanks
Babu



On 8/29/23 18:44, Tony Luck wrote:
> With Sub-NUMA Cluster mode enabled the scope of monitoring resources is
> per-NODE instead of per-L3 cache. Suffixes of directories with "L3" in
> their name refer to Sub-NUMA nodes instead of L3 cache ids.
> 
> Users should be aware that SNC mode also affects the amount of L3 cache
> available for allocation within each SNC node.
> 
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
>  Documentation/arch/x86/resctrl.rst | 25 ++++++++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst
> index cb05d90111b4..407764f43f25 100644
> --- a/Documentation/arch/x86/resctrl.rst
> +++ b/Documentation/arch/x86/resctrl.rst
> @@ -345,9 +345,15 @@ When control is enabled all CTRL_MON groups will also contain:
>  When monitoring is enabled all MON groups will also contain:
>  
>  "mon_data":
> -	This contains a set of files organized by L3 domain and by
> -	RDT event. E.g. on a system with two L3 domains there will
> -	be subdirectories "mon_L3_00" and "mon_L3_01".	Each of these
> +	This contains a set of files organized by L3 domain or by NUMA
> +	node (depending on whether Sub-NUMA Cluster (SNC) mode is disabled
> +	or enabled respectively) and by RDT event. E.g. on a system with
> +	SNC mode disabled with two L3 domains there will be subdirectories
> +	"mon_L3_00" and "mon_L3_01". The numerical suffix refers to the
> +	L3 cache id.  With SNC enabled the directory names are the same,
> +	but the numerical suffix refers to the node id.
> +        Mappings from node ids to CPUs are available in the
> +        /sys/devices/system/node/node*/cpulist files. Each of these
>  	directories have one file per event (e.g. "llc_occupancy",
>  	"mbm_total_bytes", and "mbm_local_bytes"). In a MON group these
>  	files provide a read out of the current value of the event for
> @@ -452,6 +458,19 @@ and 0xA are not.  On a system with a 20-bit mask each bit represents 5%
>  of the capacity of the cache. You could partition the cache into four
>  equal parts with masks: 0x1f, 0x3e0, 0x7c00, 0xf8000.
>  
> +Notes on Sub-NUMA Cluster mode
> +==============================
> +When SNC mode is enabled the "llc_occupancy", "mbm_total_bytes", and
> +"mbm_local_bytes" will only give accurate results for well behaved NUMA
> +applications. I.e. those that perform the majority of memory accesses
> +to memory on the local NUMA node to the CPU where the task is executing.
> +
> +The cache allocation feature still provides the same number of
> +bits in a mask to control allocation into the L3 cache. But each
> +of those ways has its capacity reduced because the cache is divided
> +between the SNC nodes. The values reported in the resctrl
> +"size" files are adjusted accordingly.
> +
>  Memory bandwidth Allocation and monitoring
>  ==========================================
>  

-- 
Thanks
Babu Moger
RE: [PATCH v5 7/8] x86/resctrl: Update documentation with Sub-NUMA cluster changes
Posted by Luck, Tony 2 years, 2 months ago
> How does user know Sub-NUMA Cluster mode is being enabled on the system?
>
> Do you have any information in /sys/fs/resctrl/info?
>
> Below documentation does not have any info about it.
> Would it be better to add that in "info" directory?


Babu,

My original patch series added an "snc_ways" file to the info/ directory
to make this visible. But I was talked out of it because of a lack of clear
user mode use case that needs it.

https://lore.kernel.org/all/f0841866-315b-4727-0a6c-ec60d22ca29c@arm.com/

Users can figure out whether SNC is enabled by looking at topology
files for nodes and L3 caches in /sys. The open question is whether
we should provide a simple short cut to that information, or make them
walk two miles uphill in the snow to figure it out.

-Tony
Re: [PATCH v5 7/8] x86/resctrl: Update documentation with Sub-NUMA cluster changes
Posted by Moger, Babu 2 years, 2 months ago

On 9/26/23 14:11, Luck, Tony wrote:
>> How does user know Sub-NUMA Cluster mode is being enabled on the system?
>>
>> Do you have any information in /sys/fs/resctrl/info?
>>
>> Below documentation does not have any info about it.
>> Would it be better to add that in "info" directory?
> 
> 
> Babu,
> 
> My original patch series added an "snc_ways" file to the info/ directory
> to make this visible. But I was talked out of it because of a lack of clear
> user mode use case that needs it.

ok. Lets go with it.

Thanks
Babu Moger
RE: [PATCH v5 7/8] x86/resctrl: Update documentation with Sub-NUMA cluster changes
Posted by Luck, Tony 2 years, 2 months ago
>> My original patch series added an "snc_ways" file to the info/ directory
>> to make this visible. But I was talked out of it because of a lack of clear
>> user mode use case that needs it.
>
> ok. Lets go with it.

Babu,

I'm not sure whether you are voting to bring the snc_ways patch back into
the series. Or to stick with the decision to drop that patch.

-Tony
Re: [PATCH v5 7/8] x86/resctrl: Update documentation with Sub-NUMA cluster changes
Posted by Moger, Babu 2 years, 2 months ago

On 9/26/23 14:43, Luck, Tony wrote:
>>> My original patch series added an "snc_ways" file to the info/ directory
>>> to make this visible. But I was talked out of it because of a lack of clear
>>> user mode use case that needs it.
>>
>> ok. Lets go with it.
> 
> Babu,
> 
> I'm not sure whether you are voting to bring the snc_ways patch back into
> the series. Or to stick with the decision to drop that patch.
> 

Sorry.. for not being clear. Lets stick with the James comment to drop it.

-- 
Thanks
Babu Moger
Re: [PATCH v5 7/8] x86/resctrl: Update documentation with Sub-NUMA cluster changes
Posted by Reinette Chatre 2 years, 2 months ago
Hi Tony,

On 8/29/2023 4:44 PM, Tony Luck wrote:
> With Sub-NUMA Cluster mode enabled the scope of monitoring resources is
> per-NODE instead of per-L3 cache. Suffixes of directories with "L3" in
> their name refer to Sub-NUMA nodes instead of L3 cache ids.
> 
> Users should be aware that SNC mode also affects the amount of L3 cache
> available for allocation within each SNC node.
> 
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
>  Documentation/arch/x86/resctrl.rst | 25 ++++++++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst
> index cb05d90111b4..407764f43f25 100644
> --- a/Documentation/arch/x86/resctrl.rst
> +++ b/Documentation/arch/x86/resctrl.rst
> @@ -345,9 +345,15 @@ When control is enabled all CTRL_MON groups will also contain:
>  When monitoring is enabled all MON groups will also contain:
>  
>  "mon_data":
> -	This contains a set of files organized by L3 domain and by
> -	RDT event. E.g. on a system with two L3 domains there will
> -	be subdirectories "mon_L3_00" and "mon_L3_01".	Each of these
> +	This contains a set of files organized by L3 domain or by NUMA
> +	node (depending on whether Sub-NUMA Cluster (SNC) mode is disabled
> +	or enabled respectively) and by RDT event. E.g. on a system with
> +	SNC mode disabled with two L3 domains there will be subdirectories
> +	"mon_L3_00" and "mon_L3_01". The numerical suffix refers to the
> +	L3 cache id.  With SNC enabled the directory names are the same,
> +	but the numerical suffix refers to the node id.
> +        Mappings from node ids to CPUs are available in the
> +        /sys/devices/system/node/node*/cpulist files. Each of these

Please be consistent with tabs vs spaces.

>  	directories have one file per event (e.g. "llc_occupancy",
>  	"mbm_total_bytes", and "mbm_local_bytes"). In a MON group these
>  	files provide a read out of the current value of the event for
> @@ -452,6 +458,19 @@ and 0xA are not.  On a system with a 20-bit mask each bit represents 5%
>  of the capacity of the cache. You could partition the cache into four
>  equal parts with masks: 0x1f, 0x3e0, 0x7c00, 0xf8000.
>  
> +Notes on Sub-NUMA Cluster mode
> +==============================
> +When SNC mode is enabled the "llc_occupancy", "mbm_total_bytes", and
> +"mbm_local_bytes" will only give accurate results for well behaved NUMA
> +applications. I.e. those that perform the majority of memory accesses
> +to memory on the local NUMA node to the CPU where the task is executing.
> +

Following our discussion of the cover letter I believe this will change to
be specific about what user space can expect and what is actually "accurate".

> +The cache allocation feature still provides the same number of
> +bits in a mask to control allocation into the L3 cache. But each
> +of those ways has its capacity reduced because the cache is divided
> +between the SNC nodes. The values reported in the resctrl
> +"size" files are adjusted accordingly.
> +
>  Memory bandwidth Allocation and monitoring
>  ==========================================
>  

Reinette
Re: [PATCH v5 7/8] x86/resctrl: Update documentation with Sub-NUMA cluster changes
Posted by Tony Luck 2 years, 2 months ago
On Mon, Sep 25, 2023 at 04:30:22PM -0700, Reinette Chatre wrote:
> Hi Tony,
> 
> On 8/29/2023 4:44 PM, Tony Luck wrote:
> > With Sub-NUMA Cluster mode enabled the scope of monitoring resources is
> > per-NODE instead of per-L3 cache. Suffixes of directories with "L3" in
> > their name refer to Sub-NUMA nodes instead of L3 cache ids.
> > 
> > Users should be aware that SNC mode also affects the amount of L3 cache
> > available for allocation within each SNC node.
> > 
> > Signed-off-by: Tony Luck <tony.luck@intel.com>
> > ---
> >  Documentation/arch/x86/resctrl.rst | 25 ++++++++++++++++++++++---
> >  1 file changed, 22 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst
> > index cb05d90111b4..407764f43f25 100644
> > --- a/Documentation/arch/x86/resctrl.rst
> > +++ b/Documentation/arch/x86/resctrl.rst
> > @@ -345,9 +345,15 @@ When control is enabled all CTRL_MON groups will also contain:
> >  When monitoring is enabled all MON groups will also contain:
> >  
> >  "mon_data":
> > -	This contains a set of files organized by L3 domain and by
> > -	RDT event. E.g. on a system with two L3 domains there will
> > -	be subdirectories "mon_L3_00" and "mon_L3_01".	Each of these
> > +	This contains a set of files organized by L3 domain or by NUMA
> > +	node (depending on whether Sub-NUMA Cluster (SNC) mode is disabled
> > +	or enabled respectively) and by RDT event. E.g. on a system with
> > +	SNC mode disabled with two L3 domains there will be subdirectories
> > +	"mon_L3_00" and "mon_L3_01". The numerical suffix refers to the
> > +	L3 cache id.  With SNC enabled the directory names are the same,
> > +	but the numerical suffix refers to the node id.
> > +        Mappings from node ids to CPUs are available in the
> > +        /sys/devices/system/node/node*/cpulist files. Each of these
> 
> Please be consistent with tabs vs spaces.

I blame "vim" for this one. Typing <TAB> while working on a .rst file
throws in 8 spaces. Maybe there's a vim setting to stop this annoying
behaviour (set syntax=off didn't help). Had to use CTRL(V)<TAB> to make
it work.

> 
> >  	directories have one file per event (e.g. "llc_occupancy",
> >  	"mbm_total_bytes", and "mbm_local_bytes"). In a MON group these
> >  	files provide a read out of the current value of the event for
> > @@ -452,6 +458,19 @@ and 0xA are not.  On a system with a 20-bit mask each bit represents 5%
> >  of the capacity of the cache. You could partition the cache into four
> >  equal parts with masks: 0x1f, 0x3e0, 0x7c00, 0xf8000.
> >  
> > +Notes on Sub-NUMA Cluster mode
> > +==============================
> > +When SNC mode is enabled the "llc_occupancy", "mbm_total_bytes", and
> > +"mbm_local_bytes" will only give accurate results for well behaved NUMA
> > +applications. I.e. those that perform the majority of memory accesses
> > +to memory on the local NUMA node to the CPU where the task is executing.
> > +
> 
> Following our discussion of the cover letter I believe this will change to
> be specific about what user space can expect and what is actually "accurate".

I added more text about the importance of binding tasks to SNC nodes.
> 
> > +The cache allocation feature still provides the same number of
> > +bits in a mask to control allocation into the L3 cache. But each
> > +of those ways has its capacity reduced because the cache is divided
> > +between the SNC nodes. The values reported in the resctrl
> > +"size" files are adjusted accordingly.
> > +
> >  Memory bandwidth Allocation and monitoring
> >  ==========================================
> >  
> 
> Reinette