lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260106110107.GC2393663@noisy.programming.kicks-ass.net>
Date: Tue, 6 Jan 2026 12:01:07 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Zide Chen <zide.chen@...el.com>
Cc: Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>, Ian Rogers <irogers@...gle.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Andi Kleen <ak@...ux.intel.com>,
	Eranian Stephane <eranian@...gle.com>, linux-kernel@...r.kernel.org,
	linux-perf-users@...r.kernel.org,
	Dapeng Mi <dapeng1.mi@...ux.intel.com>,
	Xudong Hao <xudong.hao@...el.com>,
	Falcon Thomas <thomas.falcon@...el.com>
Subject: Re: [PATCH V2 02/13] perf/x86/intel/uncore: Support per-platform
 discovery base devices

On Wed, Dec 31, 2025 at 02:42:19PM -0800, Zide Chen wrote:
> @@ -1897,6 +1899,17 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = {
>  };
>  MODULE_DEVICE_TABLE(x86cpu, intel_uncore_match);
>  
> +static bool ucore_use_discovery(struct uncore_plat_init *config)
> +{
> +	int i;
> +
> +	for (i = 0; i < UNCORE_DISCOVERY_DOMAINS; i++)
> +		if (config->domain[i].discovery_base)
> +			return true;
> +
> +	return false;
> +}
> +
>  static int __init intel_uncore_init(void)
>  {
>  	const struct x86_cpu_id *id;
> @@ -1911,15 +1924,14 @@ static int __init intel_uncore_init(void)
>  
>  	id = x86_match_cpu(intel_uncore_match);
>  	if (!id) {
> -		if (!uncore_no_discover && uncore_discovery(NULL))
> -			uncore_init = (struct uncore_plat_init *)&generic_uncore_init;
> -		else
> +		uncore_init = (struct uncore_plat_init *)&generic_uncore_init;
> +		if (uncore_no_discover || !uncore_discovery(uncore_init))
>  			return -ENODEV;
>  	} else {
>  		uncore_init = (struct uncore_plat_init *)id->driver_data;
> -		if (uncore_no_discover && uncore_init->use_discovery)
> +		if (uncore_no_discover && ucore_use_discovery(uncore_init))
>  			return -ENODEV;
> -		if (uncore_init->use_discovery &&
> +		if (ucore_use_discovery(uncore_init) &&
>  		    !uncore_discovery(uncore_init))
>  			return -ENODEV;
>  	}

I got triggered by that naming oddity, but then couldn't help but also
fix the lack of { } and then use for-scoped variables.

--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -1899,13 +1899,12 @@ static const struct x86_cpu_id intel_unc
 };
 MODULE_DEVICE_TABLE(x86cpu, intel_uncore_match);
 
-static bool ucore_use_discovery(struct uncore_plat_init *config)
+static bool uncore_use_discovery(struct uncore_plat_init *config)
 {
-	int i;
-
-	for (i = 0; i < UNCORE_DISCOVERY_DOMAINS; i++)
+	for (int i = 0; i < UNCORE_DISCOVERY_DOMAINS; i++) {
 		if (config->domain[i].discovery_base)
 			return true;
+	}
 
 	return false;
 }
@@ -1929,9 +1928,9 @@ static int __init intel_uncore_init(void
 			return -ENODEV;
 	} else {
 		uncore_init = (struct uncore_plat_init *)id->driver_data;
-		if (uncore_no_discover && ucore_use_discovery(uncore_init))
+		if (uncore_no_discover && uncore_use_discovery(uncore_init))
 			return -ENODEV;
-		if (ucore_use_discovery(uncore_init) &&
+		if (uncore_use_discovery(uncore_init) &&
 		    !uncore_discovery(uncore_init))
 			return -ENODEV;
 	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ