[PATCH 1/2] x86/resctrl: Add missing resctrl initialization for Hygon

Xiaochen Shen posted 2 patches 2 weeks, 1 day ago
There is a newer version of this series
[PATCH 1/2] x86/resctrl: Add missing resctrl initialization for Hygon
Posted by Xiaochen Shen 2 weeks, 1 day ago
Hygon CPUs supporting Platform QoS features currently undergo partial
resctrl initialization through resctrl_cpu_detect() in the Hygon BSP
init helper and AMD/Hygon common initialization code. However, several
critical data structures remain uninitialized for Hygon CPUs in the
following paths:

 - get_mem_config()-> __rdt_get_mem_config_amd():
     rdt_resource::membw,alloc_capable
     hw_res::num_closid

 - rdt_init_res_defs()->rdt_init_res_defs_amd():
     rdt_resource::cache
     hw_res::msr_base,msr_update

Add the missing AMD/Hygon common initialization to ensure proper
Platform QoS functionality on Hygon CPUs.

Fixes: d8df126349da ("x86/cpu/hygon: Add missing resctrl_cpu_detect() in bsp_init helper")
Fixes: 923f3a2b48bd ("x86/resctrl: Query LLC monitoring properties once during boot")
Cc: stable@vger.kernel.org
Signed-off-by: Xiaochen Shen <shenxiaochen@open-hieco.net>
---
 arch/x86/kernel/cpu/resctrl/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index 3792ab4819dc..10de1594d328 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -825,7 +825,8 @@ static __init bool get_mem_config(void)
 
 	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
 		return __get_mem_config_intel(&hw_res->r_resctrl);
-	else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
+	else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
+		 boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
 		return __rdt_get_mem_config_amd(&hw_res->r_resctrl);
 
 	return false;
@@ -987,7 +988,8 @@ static __init void rdt_init_res_defs(void)
 {
 	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
 		rdt_init_res_defs_intel();
-	else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
+	else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
+		 boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
 		rdt_init_res_defs_amd();
 }
 
-- 
2.47.3
Re: [PATCH 1/2] x86/resctrl: Add missing resctrl initialization for Hygon
Posted by Fenghua Yu 1 week, 6 days ago
Hi, Xiaochen,

On 12/3/25 18:37, Xiaochen Shen wrote:
> Hygon CPUs supporting Platform QoS features currently undergo partial
> resctrl initialization through resctrl_cpu_detect() in the Hygon BSP
> init helper and AMD/Hygon common initialization code. However, several
> critical data structures remain uninitialized for Hygon CPUs in the
> following paths:
> 
>   - get_mem_config()-> __rdt_get_mem_config_amd():
>       rdt_resource::membw,alloc_capable
>       hw_res::num_closid
> 
>   - rdt_init_res_defs()->rdt_init_res_defs_amd():
>       rdt_resource::cache
>       hw_res::msr_base,msr_update
> 
> Add the missing AMD/Hygon common initialization to ensure proper
> Platform QoS functionality on Hygon CPUs.
> 
> Fixes: d8df126349da ("x86/cpu/hygon: Add missing resctrl_cpu_detect() in bsp_init helper")

This commit triggers the issue on Hygon. You may keep this fix.

> Fixes: 923f3a2b48bd ("x86/resctrl: Query LLC monitoring properties once during boot")
This commit just calls resctrl_cpu_detect() on AMD and Intel. The commit 
itself doesn't have an issue. Remove this Fixes?

> Cc: stable@vger.kernel.org

> Signed-off-by: Xiaochen Shen <shenxiaochen@open-hieco.net>
> ---
>   arch/x86/kernel/cpu/resctrl/core.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 3792ab4819dc..10de1594d328 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -825,7 +825,8 @@ static __init bool get_mem_config(void)
>   
>   	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
>   		return __get_mem_config_intel(&hw_res->r_resctrl);
> -	else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
> +	else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
> +		 boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
>   		return __rdt_get_mem_config_amd(&hw_res->r_resctrl);
>   
>   	return false;
> @@ -987,7 +988,8 @@ static __init void rdt_init_res_defs(void)
>   {
>   	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
>   		rdt_init_res_defs_intel();
> -	else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
> +	else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
> +		 boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
>   		rdt_init_res_defs_amd();
>   }
>   

Thanks.

-Fenghua
Re: [PATCH 1/2] x86/resctrl: Add missing resctrl initialization for Hygon
Posted by Xiaochen Shen 1 week, 6 days ago
Hi Fenghua,

Thank you very much for code review!

On 12/6/2025 11:30 AM, Fenghua Yu wrote:
>> Add the missing AMD/Hygon common initialization to ensure proper
>> Platform QoS functionality on Hygon CPUs.
>>
>> Fixes: d8df126349da ("x86/cpu/hygon: Add missing resctrl_cpu_detect() in bsp_init helper")
> 
> This commit triggers the issue on Hygon. You may keep this fix.
> 

Sure. Thank you!


>> Fixes: 923f3a2b48bd ("x86/resctrl: Query LLC monitoring properties once during boot")
> This commit just calls resctrl_cpu_detect() on AMD and Intel. The commit itself doesn't have an issue. Remove this Fixes?
> 

Yes, you are correct. I will remove this Fixes: tag as you suggested.
Thank you!


>> Cc: stable@vger.kernel.org
> Thanks.
> 
> -Fenghua


Best regards,
Xiaochen Shen