Re: [PATCH 1/1] x86: Convert cpuinfo_x86 array to a per_cpu array v3

2007-09-24 Thread Dave Jones
On Tue, Sep 25, 2007 at 02:20:01AM +0200, roel wrote:
 
 > >  > >   if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 5) ||
 > >  > >   ((c->x86_model != 12) && (c->x86_model != 13)))
 > >  > 
 > >  > while we're at it, we could change this to
 > >  > 
 > >  > if (!(c->x86_vendor == X86_VENDOR_AMD && c->x86 == 5 &&
 > >  > (c->x86_model == 12 || c->x86_model == 13)))
 > > 
 > > For what purpose?  There's nothing wrong with the code as it stands,
 > > and inverting the tests means we'd have to move a bunch of
 > > code inside the if arm instead of just returning -ENODEV.
 > 
 > It's not inverting the test, so you don't need to move code. It evaluates 
 > the same, only the combined negation is moved to the front. I suggested it
 > to increase clarity, it results in the same assembly language.

I don't see it as being particularly more readable after this change.
In fact, the reverse, as my previous comment implied, I missed the
initial !
Given this code works fine, and there's no discernable gain from
changing it, I'm not particularly enthusiastic about this modification.

Dave

-- 
http://www.codemonkey.org.uk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] x86: Convert cpuinfo_x86 array to a per_cpu array v3

2007-09-24 Thread roel
Dave Jones wrote:
>   to add a single line reply>

Ok, sorry, I don't know these rules

> On Tue, Sep 25, 2007 at 12:01:56AM +0200, roel wrote:
> 
>  > > --- a/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
>  > > +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
>  > > @@ -215,7 +215,7 @@ static struct cpufreq_driver powernow_k6
>  > >   */
>  > >  static int __init powernow_k6_init(void)
>  > >  {
>  > > -struct cpuinfo_x86  *c = cpu_data;
>  > > +struct cpuinfo_x86 *c = _data(0);
>  > >  
>  > >  if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 5) ||
>  > >  ((c->x86_model != 12) && (c->x86_model != 13)))
>  > 
>  > while we're at it, we could change this to
>  > 
>  >if (!(c->x86_vendor == X86_VENDOR_AMD && c->x86 == 5 &&
>  >(c->x86_model == 12 || c->x86_model == 13)))
> 
> For what purpose?  There's nothing wrong with the code as it stands,
> and inverting the tests means we'd have to move a bunch of
> code inside the if arm instead of just returning -ENODEV.

It's not inverting the test, so you don't need to move code. It evaluates 
the same, only the combined negation is moved to the front. I suggested it
to increase clarity, it results in the same assembly language.

Roel

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] x86: Convert cpuinfo_x86 array to a per_cpu array v3

2007-09-24 Thread Dave Jones


On Tue, Sep 25, 2007 at 12:01:56AM +0200, roel wrote:

 > > --- a/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
 > > +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
 > > @@ -215,7 +215,7 @@ static struct cpufreq_driver powernow_k6
 > >   */
 > >  static int __init powernow_k6_init(void)
 > >  {
 > > -  struct cpuinfo_x86  *c = cpu_data;
 > > +  struct cpuinfo_x86 *c = _data(0);
 > >  
 > >if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 5) ||
 > >((c->x86_model != 12) && (c->x86_model != 13)))
 > 
 > while we're at it, we could change this to
 > 
 >  if (!(c->x86_vendor == X86_VENDOR_AMD && c->x86 == 5 &&
 >  (c->x86_model == 12 || c->x86_model == 13)))

For what purpose?  There's nothing wrong with the code as it stands,
and inverting the tests means we'd have to move a bunch of
code inside the if arm instead of just returning -ENODEV.

Dave

-- 
http://www.codemonkey.org.uk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] x86: Convert cpuinfo_x86 array to a per_cpu array v3

2007-09-24 Thread roel
[EMAIL PROTECTED] wrote:
> v3: fix compile errors in arch-i386-allmodconfig build
> 
> v2: rebasing on 2.6.23-rc6-mm1
> 
> cpu_data is currently an array defined using NR_CPUS. This means that
> we overallocate since we will rarely really use maximum configured cpus.
> When NR_CPU count is raised to 4096 the size of cpu_data becomes
> 3,145,728 bytes.
> 
> These changes were adopted from the sparc64 (and ia64) code.  An
> additional field was added to cpuinfo_x86 to be a non-ambiguous
> cpu index.  This corresponds to the index into a cpumask_t as
> well as the per_cpu index.  It's used in various places like
> show_cpuinfo().
> 
> cpu_data is defined to be the boot_cpu_data structure for the
> NON-SMP case.
> 
> Signed-off-by: Mike Travis <[EMAIL PROTECTED]>
> Acked-by: Christoph Lameter <[EMAIL PROTECTED]>
> ---
>  arch/i386/kernel/acpi/cstate.c|4 -
>  arch/i386/kernel/acpi/processor.c |2 
>  arch/i386/kernel/alternative.c|6 +-
>  arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c   |4 -
>  arch/i386/kernel/cpu/cpufreq/e_powersaver.c   |2 
>  arch/i386/kernel/cpu/cpufreq/elanfreq.c   |4 -
>  arch/i386/kernel/cpu/cpufreq/longhaul.c   |4 -
>  arch/i386/kernel/cpu/cpufreq/longrun.c|4 -
>  arch/i386/kernel/cpu/cpufreq/p4-clockmod.c|4 -
>  arch/i386/kernel/cpu/cpufreq/powernow-k6.c|2 
>  arch/i386/kernel/cpu/cpufreq/powernow-k7.c|2 
>  arch/i386/kernel/cpu/cpufreq/sc520_freq.c |4 -
>  arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c |6 +-
>  arch/i386/kernel/cpu/cpufreq/speedstep-lib.c  |2 
>  arch/i386/kernel/cpu/intel_cacheinfo.c|8 +--
>  arch/i386/kernel/cpu/proc.c   |   11 +++-
>  arch/i386/kernel/cpuid.c  |2 
>  arch/i386/kernel/microcode.c  |6 +-
>  arch/i386/kernel/msr.c|2 
>  arch/i386/kernel/sched-clock.c|2 
>  arch/i386/kernel/smp.c|2 
>  arch/i386/kernel/smpboot.c|   51 
> +++---
>  arch/i386/kernel/tsc.c|8 +--
>  arch/i386/lib/delay.c |2 
>  arch/i386/mach-voyager/voyager_smp.c  |   12 ++---
>  arch/x86_64/kernel/mce.c  |2 
>  arch/x86_64/kernel/mce_amd.c  |4 -
>  arch/x86_64/kernel/setup.c|   20 +---
>  arch/x86_64/kernel/smpboot.c  |   45 +--
>  arch/x86_64/kernel/tsc.c  |4 -
>  arch/x86_64/kernel/vsyscall.c |2 
>  arch/x86_64/lib/delay.c   |3 -
>  drivers/hwmon/coretemp.c  |6 +-
>  drivers/hwmon/hwmon-vid.c |2 
>  drivers/input/gameport/gameport.c |3 -
>  drivers/video/geode/video_gx.c|2 
>  include/asm-i386/processor.h  |   10 ++--
>  include/asm-i386/topology.h   |4 -
>  include/asm-x86_64/processor.h|   10 ++--
>  include/asm-x86_64/topology.h |4 -
>  40 files changed, 148 insertions(+), 129 deletions(-)
> 
> --- a/arch/x86_64/kernel/smpboot.c
> +++ b/arch/x86_64/kernel/smpboot.c
> @@ -84,8 +84,8 @@ cpumask_t cpu_possible_map;
>  EXPORT_SYMBOL(cpu_possible_map);
>  
>  /* Per CPU bogomips and other parameters */
> -struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
> -EXPORT_SYMBOL(cpu_data);
> +DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
> +EXPORT_PER_CPU_SYMBOL(cpu_info);
>  
>  /* Set when the idlers are all forked */
>  int smp_threads_ready;
> @@ -138,9 +138,10 @@ static unsigned long __cpuinit setup_tra
>  
>  static void __cpuinit smp_store_cpu_info(int id)
>  {
> - struct cpuinfo_x86 *c = cpu_data + id;
> + struct cpuinfo_x86 *c = _data(id);
>  
>   *c = boot_cpu_data;
> + c->cpu_index = id;
>   identify_cpu(c);
>   print_cpu_info(c);
>  }
> @@ -238,7 +239,7 @@ void __cpuinit smp_callin(void)
>  /* maps the cpu to the sched domain representing multi-core */
>  cpumask_t cpu_coregroup_map(int cpu)
>  {
> - struct cpuinfo_x86 *c = cpu_data + cpu;
> + struct cpuinfo_x86 *c = _data(cpu);
>   /*
>* For perf, we return last level cache shared map.
>* And for power savings, we return cpu_core_map
> @@ -255,41 +256,41 @@ static cpumask_t cpu_sibling_setup_map;
>  static inline void set_cpu_sibling_map(int cpu)
>  {
>   int i;
> - struct cpuinfo_x86 *c = cpu_data;
> + struct cpuinfo_x86 *c = _data(cpu);
>  
>   cpu_set(cpu, cpu_sibling_setup_map);
>  
>   if (smp_num_siblings > 1) {
>   for_each_cpu_mask(i, cpu_sibling_setup_map) {
> -  

[PATCH 1/1] x86: Convert cpuinfo_x86 array to a per_cpu array v3

2007-09-24 Thread travis
v3: fix compile errors in arch-i386-allmodconfig build

v2: rebasing on 2.6.23-rc6-mm1

cpu_data is currently an array defined using NR_CPUS. This means that
we overallocate since we will rarely really use maximum configured cpus.
When NR_CPU count is raised to 4096 the size of cpu_data becomes
3,145,728 bytes.

These changes were adopted from the sparc64 (and ia64) code.  An
additional field was added to cpuinfo_x86 to be a non-ambiguous
cpu index.  This corresponds to the index into a cpumask_t as
well as the per_cpu index.  It's used in various places like
show_cpuinfo().

cpu_data is defined to be the boot_cpu_data structure for the
NON-SMP case.

Signed-off-by: Mike Travis <[EMAIL PROTECTED]>
Acked-by: Christoph Lameter <[EMAIL PROTECTED]>
---
 arch/i386/kernel/acpi/cstate.c|4 -
 arch/i386/kernel/acpi/processor.c |2 
 arch/i386/kernel/alternative.c|6 +-
 arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c   |4 -
 arch/i386/kernel/cpu/cpufreq/e_powersaver.c   |2 
 arch/i386/kernel/cpu/cpufreq/elanfreq.c   |4 -
 arch/i386/kernel/cpu/cpufreq/longhaul.c   |4 -
 arch/i386/kernel/cpu/cpufreq/longrun.c|4 -
 arch/i386/kernel/cpu/cpufreq/p4-clockmod.c|4 -
 arch/i386/kernel/cpu/cpufreq/powernow-k6.c|2 
 arch/i386/kernel/cpu/cpufreq/powernow-k7.c|2 
 arch/i386/kernel/cpu/cpufreq/sc520_freq.c |4 -
 arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c |6 +-
 arch/i386/kernel/cpu/cpufreq/speedstep-lib.c  |2 
 arch/i386/kernel/cpu/intel_cacheinfo.c|8 +--
 arch/i386/kernel/cpu/proc.c   |   11 +++-
 arch/i386/kernel/cpuid.c  |2 
 arch/i386/kernel/microcode.c  |6 +-
 arch/i386/kernel/msr.c|2 
 arch/i386/kernel/sched-clock.c|2 
 arch/i386/kernel/smp.c|2 
 arch/i386/kernel/smpboot.c|   51 +++---
 arch/i386/kernel/tsc.c|8 +--
 arch/i386/lib/delay.c |2 
 arch/i386/mach-voyager/voyager_smp.c  |   12 ++---
 arch/x86_64/kernel/mce.c  |2 
 arch/x86_64/kernel/mce_amd.c  |4 -
 arch/x86_64/kernel/setup.c|   20 +---
 arch/x86_64/kernel/smpboot.c  |   45 +--
 arch/x86_64/kernel/tsc.c  |4 -
 arch/x86_64/kernel/vsyscall.c |2 
 arch/x86_64/lib/delay.c   |3 -
 drivers/hwmon/coretemp.c  |6 +-
 drivers/hwmon/hwmon-vid.c |2 
 drivers/input/gameport/gameport.c |3 -
 drivers/video/geode/video_gx.c|2 
 include/asm-i386/processor.h  |   10 ++--
 include/asm-i386/topology.h   |4 -
 include/asm-x86_64/processor.h|   10 ++--
 include/asm-x86_64/topology.h |4 -
 40 files changed, 148 insertions(+), 129 deletions(-)

--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -84,8 +84,8 @@ cpumask_t cpu_possible_map;
 EXPORT_SYMBOL(cpu_possible_map);
 
 /* Per CPU bogomips and other parameters */
-struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
-EXPORT_SYMBOL(cpu_data);
+DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
+EXPORT_PER_CPU_SYMBOL(cpu_info);
 
 /* Set when the idlers are all forked */
 int smp_threads_ready;
@@ -138,9 +138,10 @@ static unsigned long __cpuinit setup_tra
 
 static void __cpuinit smp_store_cpu_info(int id)
 {
-   struct cpuinfo_x86 *c = cpu_data + id;
+   struct cpuinfo_x86 *c = _data(id);
 
*c = boot_cpu_data;
+   c->cpu_index = id;
identify_cpu(c);
print_cpu_info(c);
 }
@@ -238,7 +239,7 @@ void __cpuinit smp_callin(void)
 /* maps the cpu to the sched domain representing multi-core */
 cpumask_t cpu_coregroup_map(int cpu)
 {
-   struct cpuinfo_x86 *c = cpu_data + cpu;
+   struct cpuinfo_x86 *c = _data(cpu);
/*
 * For perf, we return last level cache shared map.
 * And for power savings, we return cpu_core_map
@@ -255,41 +256,41 @@ static cpumask_t cpu_sibling_setup_map;
 static inline void set_cpu_sibling_map(int cpu)
 {
int i;
-   struct cpuinfo_x86 *c = cpu_data;
+   struct cpuinfo_x86 *c = _data(cpu);
 
cpu_set(cpu, cpu_sibling_setup_map);
 
if (smp_num_siblings > 1) {
for_each_cpu_mask(i, cpu_sibling_setup_map) {
-   if (c[cpu].phys_proc_id == c[i].phys_proc_id &&
-   c[cpu].cpu_core_id == c[i].cpu_core_id) {
+   if (c->phys_proc_id == cpu_data(i).phys_proc_id &&
+ 

[PATCH 1/1] x86: Convert cpuinfo_x86 array to a per_cpu array v3

2007-09-24 Thread travis
v3: fix compile errors in arch-i386-allmodconfig build

v2: rebasing on 2.6.23-rc6-mm1

cpu_data is currently an array defined using NR_CPUS. This means that
we overallocate since we will rarely really use maximum configured cpus.
When NR_CPU count is raised to 4096 the size of cpu_data becomes
3,145,728 bytes.

These changes were adopted from the sparc64 (and ia64) code.  An
additional field was added to cpuinfo_x86 to be a non-ambiguous
cpu index.  This corresponds to the index into a cpumask_t as
well as the per_cpu index.  It's used in various places like
show_cpuinfo().

cpu_data is defined to be the boot_cpu_data structure for the
NON-SMP case.

Signed-off-by: Mike Travis [EMAIL PROTECTED]
Acked-by: Christoph Lameter [EMAIL PROTECTED]
---
 arch/i386/kernel/acpi/cstate.c|4 -
 arch/i386/kernel/acpi/processor.c |2 
 arch/i386/kernel/alternative.c|6 +-
 arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c   |4 -
 arch/i386/kernel/cpu/cpufreq/e_powersaver.c   |2 
 arch/i386/kernel/cpu/cpufreq/elanfreq.c   |4 -
 arch/i386/kernel/cpu/cpufreq/longhaul.c   |4 -
 arch/i386/kernel/cpu/cpufreq/longrun.c|4 -
 arch/i386/kernel/cpu/cpufreq/p4-clockmod.c|4 -
 arch/i386/kernel/cpu/cpufreq/powernow-k6.c|2 
 arch/i386/kernel/cpu/cpufreq/powernow-k7.c|2 
 arch/i386/kernel/cpu/cpufreq/sc520_freq.c |4 -
 arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c |6 +-
 arch/i386/kernel/cpu/cpufreq/speedstep-lib.c  |2 
 arch/i386/kernel/cpu/intel_cacheinfo.c|8 +--
 arch/i386/kernel/cpu/proc.c   |   11 +++-
 arch/i386/kernel/cpuid.c  |2 
 arch/i386/kernel/microcode.c  |6 +-
 arch/i386/kernel/msr.c|2 
 arch/i386/kernel/sched-clock.c|2 
 arch/i386/kernel/smp.c|2 
 arch/i386/kernel/smpboot.c|   51 +++---
 arch/i386/kernel/tsc.c|8 +--
 arch/i386/lib/delay.c |2 
 arch/i386/mach-voyager/voyager_smp.c  |   12 ++---
 arch/x86_64/kernel/mce.c  |2 
 arch/x86_64/kernel/mce_amd.c  |4 -
 arch/x86_64/kernel/setup.c|   20 +---
 arch/x86_64/kernel/smpboot.c  |   45 +--
 arch/x86_64/kernel/tsc.c  |4 -
 arch/x86_64/kernel/vsyscall.c |2 
 arch/x86_64/lib/delay.c   |3 -
 drivers/hwmon/coretemp.c  |6 +-
 drivers/hwmon/hwmon-vid.c |2 
 drivers/input/gameport/gameport.c |3 -
 drivers/video/geode/video_gx.c|2 
 include/asm-i386/processor.h  |   10 ++--
 include/asm-i386/topology.h   |4 -
 include/asm-x86_64/processor.h|   10 ++--
 include/asm-x86_64/topology.h |4 -
 40 files changed, 148 insertions(+), 129 deletions(-)

--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -84,8 +84,8 @@ cpumask_t cpu_possible_map;
 EXPORT_SYMBOL(cpu_possible_map);
 
 /* Per CPU bogomips and other parameters */
-struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
-EXPORT_SYMBOL(cpu_data);
+DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
+EXPORT_PER_CPU_SYMBOL(cpu_info);
 
 /* Set when the idlers are all forked */
 int smp_threads_ready;
@@ -138,9 +138,10 @@ static unsigned long __cpuinit setup_tra
 
 static void __cpuinit smp_store_cpu_info(int id)
 {
-   struct cpuinfo_x86 *c = cpu_data + id;
+   struct cpuinfo_x86 *c = cpu_data(id);
 
*c = boot_cpu_data;
+   c-cpu_index = id;
identify_cpu(c);
print_cpu_info(c);
 }
@@ -238,7 +239,7 @@ void __cpuinit smp_callin(void)
 /* maps the cpu to the sched domain representing multi-core */
 cpumask_t cpu_coregroup_map(int cpu)
 {
-   struct cpuinfo_x86 *c = cpu_data + cpu;
+   struct cpuinfo_x86 *c = cpu_data(cpu);
/*
 * For perf, we return last level cache shared map.
 * And for power savings, we return cpu_core_map
@@ -255,41 +256,41 @@ static cpumask_t cpu_sibling_setup_map;
 static inline void set_cpu_sibling_map(int cpu)
 {
int i;
-   struct cpuinfo_x86 *c = cpu_data;
+   struct cpuinfo_x86 *c = cpu_data(cpu);
 
cpu_set(cpu, cpu_sibling_setup_map);
 
if (smp_num_siblings  1) {
for_each_cpu_mask(i, cpu_sibling_setup_map) {
-   if (c[cpu].phys_proc_id == c[i].phys_proc_id 
-   c[cpu].cpu_core_id == c[i].cpu_core_id) {
+   if (c-phys_proc_id == cpu_data(i).phys_proc_id 
+   

Re: [PATCH 1/1] x86: Convert cpuinfo_x86 array to a per_cpu array v3

2007-09-24 Thread roel
[EMAIL PROTECTED] wrote:
 v3: fix compile errors in arch-i386-allmodconfig build
 
 v2: rebasing on 2.6.23-rc6-mm1
 
 cpu_data is currently an array defined using NR_CPUS. This means that
 we overallocate since we will rarely really use maximum configured cpus.
 When NR_CPU count is raised to 4096 the size of cpu_data becomes
 3,145,728 bytes.
 
 These changes were adopted from the sparc64 (and ia64) code.  An
 additional field was added to cpuinfo_x86 to be a non-ambiguous
 cpu index.  This corresponds to the index into a cpumask_t as
 well as the per_cpu index.  It's used in various places like
 show_cpuinfo().
 
 cpu_data is defined to be the boot_cpu_data structure for the
 NON-SMP case.
 
 Signed-off-by: Mike Travis [EMAIL PROTECTED]
 Acked-by: Christoph Lameter [EMAIL PROTECTED]
 ---
  arch/i386/kernel/acpi/cstate.c|4 -
  arch/i386/kernel/acpi/processor.c |2 
  arch/i386/kernel/alternative.c|6 +-
  arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c   |4 -
  arch/i386/kernel/cpu/cpufreq/e_powersaver.c   |2 
  arch/i386/kernel/cpu/cpufreq/elanfreq.c   |4 -
  arch/i386/kernel/cpu/cpufreq/longhaul.c   |4 -
  arch/i386/kernel/cpu/cpufreq/longrun.c|4 -
  arch/i386/kernel/cpu/cpufreq/p4-clockmod.c|4 -
  arch/i386/kernel/cpu/cpufreq/powernow-k6.c|2 
  arch/i386/kernel/cpu/cpufreq/powernow-k7.c|2 
  arch/i386/kernel/cpu/cpufreq/sc520_freq.c |4 -
  arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c |6 +-
  arch/i386/kernel/cpu/cpufreq/speedstep-lib.c  |2 
  arch/i386/kernel/cpu/intel_cacheinfo.c|8 +--
  arch/i386/kernel/cpu/proc.c   |   11 +++-
  arch/i386/kernel/cpuid.c  |2 
  arch/i386/kernel/microcode.c  |6 +-
  arch/i386/kernel/msr.c|2 
  arch/i386/kernel/sched-clock.c|2 
  arch/i386/kernel/smp.c|2 
  arch/i386/kernel/smpboot.c|   51 
 +++---
  arch/i386/kernel/tsc.c|8 +--
  arch/i386/lib/delay.c |2 
  arch/i386/mach-voyager/voyager_smp.c  |   12 ++---
  arch/x86_64/kernel/mce.c  |2 
  arch/x86_64/kernel/mce_amd.c  |4 -
  arch/x86_64/kernel/setup.c|   20 +---
  arch/x86_64/kernel/smpboot.c  |   45 +--
  arch/x86_64/kernel/tsc.c  |4 -
  arch/x86_64/kernel/vsyscall.c |2 
  arch/x86_64/lib/delay.c   |3 -
  drivers/hwmon/coretemp.c  |6 +-
  drivers/hwmon/hwmon-vid.c |2 
  drivers/input/gameport/gameport.c |3 -
  drivers/video/geode/video_gx.c|2 
  include/asm-i386/processor.h  |   10 ++--
  include/asm-i386/topology.h   |4 -
  include/asm-x86_64/processor.h|   10 ++--
  include/asm-x86_64/topology.h |4 -
  40 files changed, 148 insertions(+), 129 deletions(-)
 
 --- a/arch/x86_64/kernel/smpboot.c
 +++ b/arch/x86_64/kernel/smpboot.c
 @@ -84,8 +84,8 @@ cpumask_t cpu_possible_map;
  EXPORT_SYMBOL(cpu_possible_map);
  
  /* Per CPU bogomips and other parameters */
 -struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
 -EXPORT_SYMBOL(cpu_data);
 +DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
 +EXPORT_PER_CPU_SYMBOL(cpu_info);
  
  /* Set when the idlers are all forked */
  int smp_threads_ready;
 @@ -138,9 +138,10 @@ static unsigned long __cpuinit setup_tra
  
  static void __cpuinit smp_store_cpu_info(int id)
  {
 - struct cpuinfo_x86 *c = cpu_data + id;
 + struct cpuinfo_x86 *c = cpu_data(id);
  
   *c = boot_cpu_data;
 + c-cpu_index = id;
   identify_cpu(c);
   print_cpu_info(c);
  }
 @@ -238,7 +239,7 @@ void __cpuinit smp_callin(void)
  /* maps the cpu to the sched domain representing multi-core */
  cpumask_t cpu_coregroup_map(int cpu)
  {
 - struct cpuinfo_x86 *c = cpu_data + cpu;
 + struct cpuinfo_x86 *c = cpu_data(cpu);
   /*
* For perf, we return last level cache shared map.
* And for power savings, we return cpu_core_map
 @@ -255,41 +256,41 @@ static cpumask_t cpu_sibling_setup_map;
  static inline void set_cpu_sibling_map(int cpu)
  {
   int i;
 - struct cpuinfo_x86 *c = cpu_data;
 + struct cpuinfo_x86 *c = cpu_data(cpu);
  
   cpu_set(cpu, cpu_sibling_setup_map);
  
   if (smp_num_siblings  1) {
   for_each_cpu_mask(i, cpu_sibling_setup_map) {
 - if (c[cpu].phys_proc_id == c[i].phys_proc_id 
 - c[cpu].cpu_core_id == 

Re: [PATCH 1/1] x86: Convert cpuinfo_x86 array to a per_cpu array v3

2007-09-24 Thread Dave Jones
excessive quoting trimmed, please don't quote 40K of text
 to add a single line reply

On Tue, Sep 25, 2007 at 12:01:56AM +0200, roel wrote:

   --- a/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
   +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
   @@ -215,7 +215,7 @@ static struct cpufreq_driver powernow_k6
 */
static int __init powernow_k6_init(void)
{
   -  struct cpuinfo_x86  *c = cpu_data;
   +  struct cpuinfo_x86 *c = cpu_data(0);

  if ((c-x86_vendor != X86_VENDOR_AMD) || (c-x86 != 5) ||
  ((c-x86_model != 12)  (c-x86_model != 13)))
  
  while we're at it, we could change this to
  
   if (!(c-x86_vendor == X86_VENDOR_AMD  c-x86 == 5 
   (c-x86_model == 12 || c-x86_model == 13)))

For what purpose?  There's nothing wrong with the code as it stands,
and inverting the tests means we'd have to move a bunch of
code inside the if arm instead of just returning -ENODEV.

Dave

-- 
http://www.codemonkey.org.uk
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] x86: Convert cpuinfo_x86 array to a per_cpu array v3

2007-09-24 Thread roel
Dave Jones wrote:
 excessive quoting trimmed, please don't quote 40K of text
  to add a single line reply

Ok, sorry, I don't know these rules

 On Tue, Sep 25, 2007 at 12:01:56AM +0200, roel wrote:
 
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
@@ -215,7 +215,7 @@ static struct cpufreq_driver powernow_k6
  */
 static int __init powernow_k6_init(void)
 {
-struct cpuinfo_x86  *c = cpu_data;
+struct cpuinfo_x86 *c = cpu_data(0);
 
 if ((c-x86_vendor != X86_VENDOR_AMD) || (c-x86 != 5) ||
 ((c-x86_model != 12)  (c-x86_model != 13)))
   
   while we're at it, we could change this to
   
  if (!(c-x86_vendor == X86_VENDOR_AMD  c-x86 == 5 
  (c-x86_model == 12 || c-x86_model == 13)))
 
 For what purpose?  There's nothing wrong with the code as it stands,
 and inverting the tests means we'd have to move a bunch of
 code inside the if arm instead of just returning -ENODEV.

It's not inverting the test, so you don't need to move code. It evaluates 
the same, only the combined negation is moved to the front. I suggested it
to increase clarity, it results in the same assembly language.

Roel

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] x86: Convert cpuinfo_x86 array to a per_cpu array v3

2007-09-24 Thread Dave Jones
On Tue, Sep 25, 2007 at 02:20:01AM +0200, roel wrote:
 
if ((c-x86_vendor != X86_VENDOR_AMD) || (c-x86 != 5) ||
((c-x86_model != 12)  (c-x86_model != 13)))
 
 while we're at it, we could change this to
 
 if (!(c-x86_vendor == X86_VENDOR_AMD  c-x86 == 5 
 (c-x86_model == 12 || c-x86_model == 13)))
   
   For what purpose?  There's nothing wrong with the code as it stands,
   and inverting the tests means we'd have to move a bunch of
   code inside the if arm instead of just returning -ENODEV.
  
  It's not inverting the test, so you don't need to move code. It evaluates 
  the same, only the combined negation is moved to the front. I suggested it
  to increase clarity, it results in the same assembly language.

I don't see it as being particularly more readable after this change.
In fact, the reverse, as my previous comment implied, I missed the
initial !
Given this code works fine, and there's no discernable gain from
changing it, I'm not particularly enthusiastic about this modification.

Dave

-- 
http://www.codemonkey.org.uk
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/