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] [day] [month] [year] [list]
Message-ID: <87le29ug0x.ffs@tglx>
Date: Wed, 10 Jul 2024 22:51:42 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Jiaxun Yang <jiaxun.yang@...goat.com>, Peter Zijlstra
 <peterz@...radead.org>, Huacai Chen <chenhuacai@...nel.org>, WANG Xuerui
 <kernel@...0n.name>
Cc: linux-kernel@...r.kernel.org, loongarch@...ts.linux.dev, Jiaxun Yang
 <jiaxun.yang@...goat.com>
Subject: Re: [PATCH 1/3] cpu/hotplug: Make HOTPLUG_PARALLEL independent of
 HOTPLUG_SMT

On Fri, Jul 05 2024 at 11:29, Jiaxun Yang wrote:
>  
> +#ifdef CONFIG_HOTPLUG_SMT
>  static inline bool cpuhp_smt_aware(void)
>  {
>  	return cpu_smt_max_threads > 1;
> @@ -1817,6 +1818,7 @@ static inline const struct cpumask *cpuhp_get_primary_thread_mask(void)
>  {
>  	return cpu_primary_thread_mask;
>  }
> +#endif

Please provide stub functions in an #else clause

#else
static inline bool cpuhp_smt_aware(void) { return false; }
static inline cpumask *cpuhp_get_primary_thread_mask(void) { return NULL; }
#endif

or something to that effect.

>  /*
>   * On architectures which have enabled parallel bringup this invokes all BP
> @@ -1837,6 +1839,7 @@ static bool __init cpuhp_bringup_cpus_parallel(unsigned int ncpus)
>  	if (!__cpuhp_parallel_bringup)
>  		return false;
>  
> +#ifdef CONFIG_HOTPLUG_SMT

That way you spare the ugly #ifdef here in the middle of the code and
the compiler can optimize it out.

>  	if (cpuhp_smt_aware()) {
>  		const struct cpumask *pmask = cpuhp_get_primary_thread_mask();
>  		static struct cpumask tmp_mask __initdata;
> @@ -1857,6 +1860,7 @@ static bool __init cpuhp_bringup_cpus_parallel(unsigned int ncpus)
>  		cpumask_andnot(&tmp_mask, mask, pmask);
>  		mask = &tmp_mask;
>  	}
> +#endif

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ