linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Kevin Winchester <kjwinchester@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Nick Bowler <nbowler@elliptictech.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c
Date: Tue, 21 Feb 2012 16:39:35 +0100	[thread overview]
Message-ID: <20120221153935.GE2486@x1.osrc.amd.com> (raw)
In-Reply-To: <1329789966-693-6-git-send-email-kjwinchester@gmail.com>

On Mon, Feb 20, 2012 at 10:06:06PM -0400, Kevin Winchester wrote:
> smp_num_siblings was defined in arch/x86/kernel/smpboot.c, making it
> necessary to wrap any UP relevant code referencing it with #ifdef
> CONFIG_SMP.
> 
> Instead, move the definition to arch/x86/kernel/cpu/common.c, thus
> making it available always.
> 
> Signed-off-by: Kevin Winchester <kjwinchester@gmail.com>
> ---
>  arch/x86/include/asm/perf_event_p4.h |    9 +++------
>  arch/x86/include/asm/smp.h           |    6 +-----
>  arch/x86/include/asm/topology.h      |    4 +---
>  arch/x86/kernel/cpu/amd.c            |    4 ----
>  arch/x86/kernel/cpu/common.c         |    6 ++++--
>  arch/x86/kernel/cpu/proc.c           |    5 ++---
>  arch/x86/kernel/cpu/topology.c       |    2 --
>  arch/x86/kernel/process.c            |    3 +--
>  arch/x86/kernel/smpboot.c            |    4 ----
>  arch/x86/oprofile/nmi_int.c          |    6 ------
>  arch/x86/oprofile/op_model_p4.c      |    6 ------
>  11 files changed, 12 insertions(+), 43 deletions(-)
> 
> diff --git a/arch/x86/include/asm/perf_event_p4.h b/arch/x86/include/asm/perf_event_p4.h
> index 29a65c2..0d50f33 100644
> --- a/arch/x86/include/asm/perf_event_p4.h
> +++ b/arch/x86/include/asm/perf_event_p4.h
> @@ -8,6 +8,8 @@
>  #include <linux/cpu.h>
>  #include <linux/bitops.h>
>  
> +#include <asm/smp.h>
> +
>  /*
>   * NetBurst has performance MSRs shared between
>   * threads if HT is turned on, ie for both logical
> @@ -179,18 +181,13 @@ static inline u64 p4_clear_ht_bit(u64 config)
>  
>  static inline int p4_ht_active(void)
>  {
> -#ifdef CONFIG_SMP
>  	return smp_num_siblings > 1;
> -#endif
> -	return 0;
>  }

You could drop this function completely now and use the equal
smt_capable() macro below.

>  
>  static inline int p4_ht_thread(int cpu)
>  {
> -#ifdef CONFIG_SMP
>  	if (smp_num_siblings == 2)
> -		return cpu != cpumask_first(&cpu_data(cpu).sibling_map));
> -#endif
> +		return cpu != cpumask_first(&cpu_data(cpu).sibling_map);
>  	return 0;
>  }
>  
> diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
> index 75aea4d..787127e 100644
> --- a/arch/x86/include/asm/smp.h
> +++ b/arch/x86/include/asm/smp.h
> @@ -24,11 +24,7 @@ extern unsigned int num_processors;
>  
>  static inline bool cpu_has_ht_siblings(void)
>  {
> -	bool has_siblings = false;
> -#ifdef CONFIG_SMP
> -	has_siblings = cpu_has_ht && smp_num_siblings > 1;
> -#endif
> -	return has_siblings;
> +	return cpu_has_ht && smp_num_siblings > 1;
>  }
>  
>  DECLARE_PER_CPU(int, cpu_number);
> diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
> index 58438a1b..7250ad1 100644
> --- a/arch/x86/include/asm/topology.h
> +++ b/arch/x86/include/asm/topology.h
> @@ -174,11 +174,9 @@ static inline void arch_fix_phys_package_id(int num, u32 slot)
>  struct pci_bus;
>  void x86_pci_root_bus_resources(int bus, struct list_head *resources);
>  
> -#ifdef CONFIG_SMP
>  #define mc_capable()	((boot_cpu_data.x86_max_cores > 1) && \
>  			(cpumask_weight(&boot_cpu_data.core_map) != nr_cpu_ids))
> -#define smt_capable()			(smp_num_siblings > 1)
> -#endif
> +#define smt_capable()	(smp_num_siblings > 1)
>  
>  #ifdef CONFIG_NUMA
>  extern int get_mp_bus_to_node(int busnum);
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 1cd9d51..a8b46df 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -263,7 +263,6 @@ static int __cpuinit nearby_node(int apicid)
>   *     Assumption: Number of cores in each internal node is the same.
>   * (2) AMD processors supporting compute units
>   */
> -#ifdef CONFIG_X86_HT
>  static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)
>  {
>  	u32 nodes, cores_per_cu = 1;
> @@ -307,7 +306,6 @@ static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)
>  		c->compute_unit_id %= cus_per_node;
>  	}
>  }
> -#endif

I'm assuming all those X86_HT changes have been built and boot-tested
also with CONFIG_X86_HT unset?

Thanks.

-- 
Regards/Gruss,
Boris.

  reply	other threads:[~2012-02-21 15:39 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 19:10 [PATCH] MCE, AMD: Select SMP explicitly Borislav Petkov
2012-02-02 19:37 ` Nick Bowler
2012-02-02 20:24   ` Borislav Petkov
2012-02-03 19:18     ` MCE, AMD: Hide smp-only code around CONFIG_SMP Borislav Petkov
2012-02-03 22:05       ` Randy Dunlap
2012-02-07  9:57       ` Ingo Molnar
2012-02-08  0:41         ` Kevin Winchester
2012-02-08 10:19         ` Borislav Petkov
2012-02-08 12:22           ` Kevin Winchester
2012-02-08 13:05             ` Borislav Petkov
2012-02-09  8:06           ` Ingo Molnar
2012-02-10  0:00             ` Kevin Winchester
2012-02-11 14:07               ` Ingo Molnar
2012-02-12  0:24                 ` [PATCH] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-12  2:18                   ` Kevin Winchester
2012-02-12 11:19                     ` Ingo Molnar
2012-02-14  0:12                       ` [PATCH v2] " Kevin Winchester
2012-02-17 11:56                         ` Ingo Molnar
2012-02-17 13:12                           ` Kevin Winchester
2012-02-21  2:06                           ` [PATCH 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-21  2:06                             ` [PATCH 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-21 15:42                               ` Borislav Petkov
2012-02-21  2:06                             ` [PATCH 2/5] x86: Move per cpu cpu_llc_id " Kevin Winchester
2012-02-21 10:37                               ` Borislav Petkov
2012-02-21 10:40                               ` Borislav Petkov
2012-02-21  2:06                             ` [PATCH 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-02-21 11:35                               ` Borislav Petkov
2012-02-21  2:06                             ` [PATCH 4/5] x86: Move per cpu cpu_core_map " Kevin Winchester
2012-02-21 14:21                               ` Borislav Petkov
2012-02-21  2:06                             ` [PATCH 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester
2012-02-21 15:39                               ` Borislav Petkov [this message]
2012-02-22  1:44                                 ` Kevin Winchester
2012-02-22  1:45                                 ` [PATCH v2 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-22  1:45                                   ` [PATCH v2 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-22  6:39                                     ` H. Peter Anvin
2012-02-22  9:27                                       ` Ingo Molnar
2012-02-22 12:24                                         ` Kevin Winchester
2012-02-22 23:32                                         ` [PATCH v3 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-22 23:32                                           ` [PATCH v3 1/5] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-22 23:32                                           ` [PATCH v3 2/5] x86: Move per cpu cpu_llc_id " Kevin Winchester
2012-02-22 23:32                                           ` [PATCH v3 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-02-22 23:32                                           ` [PATCH v3 4/5] x86: Move per cpu cpu_core_map " Kevin Winchester
2012-02-22 23:32                                           ` [PATCH v3 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester
2012-02-22 23:43                                           ` [PATCH v3 0/5] x86: Cleanup and simplify cpu-specific data Kevin Winchester
2012-02-23  7:32                                           ` Ingo Molnar
2012-02-22  1:45                                   ` [PATCH v2 2/5] x86: Move per cpu cpu_llc_id to a field in struct cpuinfo_x86 Kevin Winchester
2012-02-22  1:45                                   ` [PATCH v2 3/5] x86: Move per cpu cpu_sibling_map " Kevin Winchester
2012-02-22  1:45                                   ` [PATCH v2 4/5] x86: Move per cpu cpu_core_map " Kevin Winchester
2012-02-22  1:45                                   ` [PATCH v2 5/5] x86: Remove #ifdef CONFIG_SMP sections by moving smp_num_siblings into common.c Kevin Winchester
2012-02-12 11:23                     ` [PATCH] x86: Move per cpu cpu_llc_shared_map to a field in struct cpuinfo_x86 Borislav Petkov
2012-02-12  0:31                 ` MCE, AMD: Hide smp-only code around CONFIG_SMP Kevin Winchester
2012-02-22 16:13       ` [tip:x86/urgent] x86/mce/AMD: Fix UP build error tip-bot for Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120221153935.GE2486@x1.osrc.amd.com \
    --to=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=kjwinchester@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nbowler@elliptictech.com \
    --cc=rdunlap@xenotime.net \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).