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]
Date:	Thu, 12 May 2016 10:07:24 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>, acme@...nel.org,
	jolsa@...nel.org, linux-kernel@...r.kernel.org,
	Andi Kleen <ak@...ux.intel.com>, x86@...nel.org
Subject: Re: [UPDATED PATCH 01/10] x86: Add topology_max_smt_threads()


* Andi Kleen <andi@...stfloor.org> wrote:

> For SMT specific workarounds it is useful to know if SMT is active
> on any online CPU in the system. This currently requires a loop
> over all online CPUs.
>     
> Add a global variable that is updated with the maximum number
> of smt threads on any CPU on online/offline, and use it for
> topology_max_smt_threads()
>     
> The single call is easier to use than a loop.
>     
> Not exported to user space because user space already can use
> the existing sibling interfaces to find this out.
>     
> v2: Code formatting changes and use __ for variable name
> Cc: tglx@...utronix.de
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> 
> diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
> index 7f991bd5031b..f79181c03561 100644
> --- a/arch/x86/include/asm/topology.h
> +++ b/arch/x86/include/asm/topology.h
> @@ -129,6 +129,10 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
>  
>  extern unsigned int __max_logical_packages;
>  #define topology_max_packages()			(__max_logical_packages)
> +
> +extern int __max_smt_threads;
> +#define topology_max_smt_threads()		__max_smt_threads
> +
>  int topology_update_package_map(unsigned int apicid, unsigned int cpu);
>  extern int topology_phys_to_logical_pkg(unsigned int pkg);
>  #else
> @@ -136,6 +140,7 @@ extern int topology_phys_to_logical_pkg(unsigned int pkg);
>  static inline int
>  topology_update_package_map(unsigned int apicid, unsigned int cpu) { return 0; }
>  static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; }
> +#define topology_max_smt_threads()		1

Is there a good reason why this is a CPP macro instead of an inline function like 
the code above it uses?

> +/* Recompute SMT state for all CPUs on offline */

s/when a CPU gets offlined/

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ