mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf/x86/amd/core: Make amd_core_pmu_init() return void
@ 2026-11-01  4:03 Ingyu Jang
  2026-11-02 13:49 ` Sandipan Das
  0 siblings, 1 reply; 2+ messages in thread
From: Ingyu Jang @ 2026-11-01  4:03 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, linux-perf-users, linux-kernel, Ingyu Jang

amd_core_pmu_init() has always returned 0 since commit 471af006a747
("perf/x86/amd: Constrain Large Increment per Cycle events") removed
its -ENODEV path for unknown CPU families, so the error check in
amd_pmu_init() never triggers.

Change the function's return type to void and remove the dead check.

Signed-off-by: Ingyu Jang <ingyujang25@korea.ac.kr>
---
 arch/x86/events/amd/core.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index 49b6b8fce5664..c72e745b2591d 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -1412,7 +1412,7 @@ static const struct attribute_group *amd_attr_update[] = {
 	NULL,
 };
 
-static int __init amd_core_pmu_init(void)
+static void __init amd_core_pmu_init(void)
 {
 	union cpuid_0x80000022_ebx ebx;
 	u64 even_ctr_mask = 0ULL;
@@ -1422,7 +1422,7 @@ static int __init amd_core_pmu_init(void)
 	perf_nmi_window = msecs_to_jiffies(100);
 
 	if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
-		return 0;
+		return;
 
 	/*
 	 * If core performance counter extensions exists, we must use
@@ -1523,22 +1523,17 @@ static int __init amd_core_pmu_init(void)
 	x86_pmu.attr_update = amd_attr_update;
 
 	pr_cont("core perfctr, ");
-	return 0;
 }
 
 __init int amd_pmu_init(void)
 {
-	int ret;
-
 	/* Performance-monitoring supported from K7 and later: */
 	if (boot_cpu_data.x86 < 6)
 		return -ENODEV;
 
 	x86_pmu = amd_pmu;
 
-	ret = amd_core_pmu_init();
-	if (ret)
-		return ret;
+	amd_core_pmu_init();
 
 	if (num_possible_cpus() == 1) {
 		/*
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf/x86/amd/core: Make amd_core_pmu_init() return void
  2026-11-01  4:03 [PATCH] perf/x86/amd/core: Make amd_core_pmu_init() return void Ingyu Jang
@ 2026-11-02 13:49 ` Sandipan Das
  0 siblings, 0 replies; 2+ messages in thread
From: Sandipan Das @ 2026-11-02 13:49 UTC (permalink / raw)
  To: Ingyu Jang, Peter Zijlstra, Ingo Molnar
  Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, linux-perf-users, linux-kernel

On 01-11-2026 09:33, Ingyu Jang wrote:
> amd_core_pmu_init() has always returned 0 since commit 471af006a747
> ("perf/x86/amd: Constrain Large Increment per Cycle events") removed
> its -ENODEV path for unknown CPU families, so the error check in
> amd_pmu_init() never triggers.
> 
> Change the function's return type to void and remove the dead check.
> 
> Signed-off-by: Ingyu Jang <ingyujang25@korea.ac.kr>
> ---
>  arch/x86/events/amd/core.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
> index 49b6b8fce5664..c72e745b2591d 100644
> --- a/arch/x86/events/amd/core.c
> +++ b/arch/x86/events/amd/core.c
> @@ -1412,7 +1412,7 @@ static const struct attribute_group *amd_attr_update[] = {
>  	NULL,
>  };
>  
> -static int __init amd_core_pmu_init(void)
> +static void __init amd_core_pmu_init(void)
>  {
>  	union cpuid_0x80000022_ebx ebx;
>  	u64 even_ctr_mask = 0ULL;
> @@ -1422,7 +1422,7 @@ static int __init amd_core_pmu_init(void)
>  	perf_nmi_window = msecs_to_jiffies(100);
>  
>  	if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
> -		return 0;
> +		return;
>  
>  	/*
>  	 * If core performance counter extensions exists, we must use
> @@ -1523,22 +1523,17 @@ static int __init amd_core_pmu_init(void)
>  	x86_pmu.attr_update = amd_attr_update;
>  
>  	pr_cont("core perfctr, ");
> -	return 0;
>  }
>  
>  __init int amd_pmu_init(void)
>  {
> -	int ret;
> -
>  	/* Performance-monitoring supported from K7 and later: */
>  	if (boot_cpu_data.x86 < 6)
>  		return -ENODEV;
>  
>  	x86_pmu = amd_pmu;
>  
> -	ret = amd_core_pmu_init();
> -	if (ret)
> -		return ret;
> +	amd_core_pmu_init();
>  
>  	if (num_possible_cpus() == 1) {
>  		/*

Reviewed-by: Sandipan Das <sandipan.das@amd.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-02 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-01  4:03 [PATCH] perf/x86/amd/core: Make amd_core_pmu_init() return void Ingyu Jang
2026-11-02 13:49 ` Sandipan Das

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®