[PATCH v9 03/10] x86,fs/resctrl: Detect io_alloc feature

Babu Moger posted 10 patches 1 month ago
[PATCH v9 03/10] x86,fs/resctrl: Detect io_alloc feature
Posted by Babu Moger 1 month ago
Smart Data Cache Injection (SDCI) is a mechanism that enables direct
insertion of data from I/O devices into the L3 cache. It can reduce the
demands on DRAM bandwidth and reduces latency to the processor consuming
the I/O data.

Introduce cache resource property "io_alloc_capable" that an architecture
can set if a portion of the cache can be allocated for I/O traffic.

Set this property on x86 systems that support SDCIAE (L3 Smart Data Cache
Injection Allocation Enforcement). This property is set only for the L3
cache resource on systems that support SDCIAE.

Signed-off-by: Babu Moger <babu.moger@amd.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
---
v9: No changes.

v8: Added Reviewed-by tag.

v7: Few text updates in changelog and resctrl.h.

v6: No changes.

v5: No changes.

v4: Updated the commit message and code comment based on feedback.

v3: Rewrote commit log. Changed the text to bit generic than the AMD specific.
    Renamed the rdt_get_sdciae_alloc_cfg() to rdt_set_io_alloc_capable().
    Removed leftover comment from v2.

v2: Changed sdciae_capable to io_alloc_capable to make it generic feature.
    Also moved the io_alloc_capable in struct resctrl_cache.
---
 arch/x86/kernel/cpu/resctrl/core.c | 7 +++++++
 include/linux/resctrl.h            | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index f6d84882cc4e..1d1002526745 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -274,6 +274,11 @@ static void rdt_get_cdp_config(int level)
 	rdt_resources_all[level].r_resctrl.cdp_capable = true;
 }
 
+static void rdt_set_io_alloc_capable(struct rdt_resource *r)
+{
+	r->cache.io_alloc_capable = true;
+}
+
 static void rdt_get_cdp_l3_config(void)
 {
 	rdt_get_cdp_config(RDT_RESOURCE_L3);
@@ -842,6 +847,8 @@ static __init bool get_rdt_alloc_resources(void)
 		rdt_get_cache_alloc_cfg(1, r);
 		if (rdt_cpu_has(X86_FEATURE_CDP_L3))
 			rdt_get_cdp_l3_config();
+		if (rdt_cpu_has(X86_FEATURE_SDCIAE))
+			rdt_set_io_alloc_capable(r);
 		ret = true;
 	}
 	if (rdt_cpu_has(X86_FEATURE_CAT_L2)) {
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 6fb4894b8cfd..010f238843b2 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -191,6 +191,8 @@ struct rdt_mon_domain {
  * @arch_has_sparse_bitmasks:	True if a bitmask like f00f is valid.
  * @arch_has_per_cpu_cfg:	True if QOS_CFG register for this cache
  *				level has CPU scope.
+ * @io_alloc_capable:	True if portion of the cache can be configured
+ *			for I/O traffic.
  */
 struct resctrl_cache {
 	unsigned int	cbm_len;
@@ -198,6 +200,7 @@ struct resctrl_cache {
 	unsigned int	shareable_bits;
 	bool		arch_has_sparse_bitmasks;
 	bool		arch_has_per_cpu_cfg;
+	bool		io_alloc_capable;
 };
 
 /**
-- 
2.34.1
Re: [PATCH v9 03/10] x86,fs/resctrl: Detect io_alloc feature
Posted by Reinette Chatre 2 weeks, 1 day ago
Hi Babu,

On 9/2/25 3:41 PM, Babu Moger wrote:
> Smart Data Cache Injection (SDCI) is a mechanism that enables direct
> insertion of data from I/O devices into the L3 cache. It can reduce the
> demands on DRAM bandwidth and reduces latency to the processor consuming
> the I/O data.

This copy&pasted text found in cover letter and patch 1 and now here seems to be the
type of annoying repetitive text that Boris referred to [1]. Looking at this changelog
again it may also be confusing to start with introduction of one feature (SDCI), but
end with another SDCIAE.

Here is a changelog that attempts to address issues, please feel free to improve:

	AMD's SDCIAE (SDCI Allocation Enforcement) PQE feature enables system software  
	to control the portions of L3 cache used for direct insertion of data from   
	I/O devices into the L3 cache.                                                  
                                                                                
	Introduce a generic resctrl cache resource property "io_alloc_capable" as the
	first part of the new "io_alloc" resctrl feature that will support AMD's
	SDCIAE.	Any architecture can set a cache resource as "io_alloc_capable" if a
	portion	of the cache can be allocated for I/O traffic.  
                                                                                
	Set the "io_alloc_capable" property for the L3 cache resource on x86       
	(AMD) systems that support SDCIAE.                          

 
> Introduce cache resource property "io_alloc_capable" that an architecture
> can set if a portion of the cache can be allocated for I/O traffic.
> 
> Set this property on x86 systems that support SDCIAE (L3 Smart Data Cache
> Injection Allocation Enforcement). This property is set only for the L3
> cache resource on systems that support SDCIAE.
> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
> ---

Reinette


[1] https://lore.kernel.org/lkml/20250911150850.GAaMLmAoi5fTIznQzY@fat_crate.local/
Re: [PATCH v9 03/10] x86,fs/resctrl: Detect io_alloc feature
Posted by Moger, Babu 1 week, 6 days ago
Hi Reinette,

On 9/18/2025 12:15 AM, Reinette Chatre wrote:
> Hi Babu,
> 
> On 9/2/25 3:41 PM, Babu Moger wrote:
>> Smart Data Cache Injection (SDCI) is a mechanism that enables direct
>> insertion of data from I/O devices into the L3 cache. It can reduce the
>> demands on DRAM bandwidth and reduces latency to the processor consuming
>> the I/O data.
> 
> This copy&pasted text found in cover letter and patch 1 and now here seems to be the
> type of annoying repetitive text that Boris referred to [1]. Looking at this changelog
> again it may also be confusing to start with introduction of one feature (SDCI), but
> end with another SDCIAE.
> 
> Here is a changelog that attempts to address issues, please feel free to improve:
> 
> 	AMD's SDCIAE (SDCI Allocation Enforcement) PQE feature enables system software
> 	to control the portions of L3 cache used for direct insertion of data from
> 	I/O devices into the L3 cache.
>                                                                                  
> 	Introduce a generic resctrl cache resource property "io_alloc_capable" as the
> 	first part of the new "io_alloc" resctrl feature that will support AMD's
> 	SDCIAE.	Any architecture can set a cache resource as "io_alloc_capable" if a
> 	portion	of the cache can be allocated for I/O traffic.
>                                                                                  
> 	Set the "io_alloc_capable" property for the L3 cache resource on x86
> 	(AMD) systems that support SDCIAE.
> 
>   

Looks good. thank you.

>> Introduce cache resource property "io_alloc_capable" that an architecture
>> can set if a portion of the cache can be allocated for I/O traffic.
>>
>> Set this property on x86 systems that support SDCIAE (L3 Smart Data Cache
>> Injection Allocation Enforcement). This property is set only for the L3
>> cache resource on systems that support SDCIAE.
>>
>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
>> ---
> 
> Reinette
> 
> 
> [1] https://lore.kernel.org/lkml/20250911150850.GAaMLmAoi5fTIznQzY@fat_crate.local/
> 
>