* [patch, -rc6] x86_64: UP build fixes
@ 2006-11-16 8:48 Ingo Molnar
2006-11-16 8:58 ` Andrew Morton
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: Ingo Molnar @ 2006-11-16 8:48 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andi Kleen, Linus Torvalds, linux-kernel
Subject: x86_64: UP build fixes
From: Ingo Molnar <mingo@elte.hu>
x86_64 does not build cleanly on UP:
arch/x86_64/kernel/vsyscall.c: In function 'cpu_vsyscall_notifier':
arch/x86_64/kernel/vsyscall.c:282: warning: implicit declaration of function 'smp_call_function_single'
arch/x86_64/kernel/vsyscall.c: At top level:
arch/x86_64/kernel/vsyscall.c:279: warning: 'cpu_vsyscall_notifier' defined but not used
this patch fixes it.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
include/asm-x86_64/smp.h | 11 ++---------
include/linux/cpu.h | 2 +-
include/linux/smp.h | 9 +++++++++
3 files changed, 12 insertions(+), 10 deletions(-)
Index: linux/include/asm-x86_64/smp.h
===================================================================
--- linux.orig/include/asm-x86_64/smp.h
+++ linux/include/asm-x86_64/smp.h
@@ -115,16 +115,9 @@ static __inline int logical_smp_processo
}
#ifdef CONFIG_SMP
-#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
+# define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
#else
-#define cpu_physical_id(cpu) boot_cpu_id
-static inline int smp_call_function_single(int cpuid, void (*func) (void *info),
- void *info, int retry, int wait)
-{
- /* Disable interrupts here? */
- func(info);
- return 0;
-}
+# define cpu_physical_id(cpu) boot_cpu_id
#endif /* !CONFIG_SMP */
#endif
Index: linux/include/linux/cpu.h
===================================================================
--- linux.orig/include/linux/cpu.h
+++ linux/include/linux/cpu.h
@@ -81,7 +81,7 @@ int cpu_down(unsigned int cpu);
#define lock_cpu_hotplug() do { } while (0)
#define unlock_cpu_hotplug() do { } while (0)
#define lock_cpu_hotplug_interruptible() 0
-#define hotcpu_notifier(fn, pri) do { } while (0)
+#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
#define register_hotcpu_notifier(nb) do { } while (0)
#define unregister_hotcpu_notifier(nb) do { } while (0)
Index: linux/include/linux/smp.h
===================================================================
--- linux.orig/include/linux/smp.h
+++ linux/include/linux/smp.h
@@ -100,6 +100,15 @@ static inline void smp_send_reschedule(i
#define num_booting_cpus() 1
#define smp_prepare_boot_cpu() do {} while (0)
+static inline int
+smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
+ int retry, int wait)
+{
+ func(info);
+
+ return 0;
+}
+
#endif /* !SMP */
/*
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch, -rc6] x86_64: UP build fixes
2006-11-16 8:48 [patch, -rc6] x86_64: UP build fixes Ingo Molnar
@ 2006-11-16 8:58 ` Andrew Morton
2006-11-16 9:28 ` Ingo Molnar
2006-11-16 9:01 ` Andi Kleen
2006-11-16 9:03 ` Ingo Molnar
2 siblings, 1 reply; 16+ messages in thread
From: Andrew Morton @ 2006-11-16 8:58 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andi Kleen, Linus Torvalds, linux-kernel
On Thu, 16 Nov 2006 09:48:55 +0100
Ingo Molnar <mingo@elte.hu> wrote:
> +static inline int
> +smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
> + int retry, int wait)
> +{
> + func(info);
> +
> + return 0;
> +}
> +
Given that on SMP the function is called with local interrupts disabled,
I'd suggest that it should be called with local interrupts disabled on UP
as well.
on_each_cpu() does this and one caller (at least) relies upon it
(invalidate_bh_lrus(), iirc).
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch, -rc6] x86_64: UP build fixes
2006-11-16 8:48 [patch, -rc6] x86_64: UP build fixes Ingo Molnar
2006-11-16 8:58 ` Andrew Morton
@ 2006-11-16 9:01 ` Andi Kleen
2006-11-16 9:17 ` Andrew Morton
2006-11-16 9:03 ` Ingo Molnar
2 siblings, 1 reply; 16+ messages in thread
From: Andi Kleen @ 2006-11-16 9:01 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andrew Morton, Linus Torvalds, linux-kernel
On Thursday 16 November 2006 09:48, Ingo Molnar wrote:
> arch/x86_64/kernel/vsyscall.c: In function 'cpu_vsyscall_notifier':
> arch/x86_64/kernel/vsyscall.c:282: warning: implicit declaration of function 'smp_call_function_single'
> arch/x86_64/kernel/vsyscall.c: At top level:
> arch/x86_64/kernel/vsyscall.c:279: warning: 'cpu_vsyscall_notifier' defined but not used
Oops. My fault indeed.
Here's a simpler patch to fix it.
-Andi
Fix vsyscall.c compilation on UP
Broken by earlier patch by me.
Index: linux/arch/x86_64/kernel/vsyscall.c
===================================================================
--- linux.orig/arch/x86_64/kernel/vsyscall.c
+++ linux/arch/x86_64/kernel/vsyscall.c
@@ -274,6 +274,7 @@ static void __cpuinit cpu_vsyscall_init(
vsyscall_set_cpu(raw_smp_processor_id());
}
+#ifdef CONFIG_HOTPLUG_CPU
static int __cpuinit
cpu_vsyscall_notifier(struct notifier_block *n, unsigned long action, void *arg)
{
@@ -282,6 +283,7 @@ cpu_vsyscall_notifier(struct notifier_bl
smp_call_function_single(cpu, cpu_vsyscall_init, NULL, 0, 1);
return NOTIFY_DONE;
}
+#endif
static void __init map_vsyscall(void)
{
@@ -303,7 +305,9 @@ static int __init vsyscall_init(void)
register_sysctl_table(kernel_root_table2, 0);
#endif
on_each_cpu(cpu_vsyscall_init, NULL, 0, 1);
+#ifdef CONFIG_HOTPLUG_CPU
hotcpu_notifier(cpu_vsyscall_notifier, 0);
+#endif
return 0;
}
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch, -rc6] x86_64: UP build fixes
2006-11-16 8:48 [patch, -rc6] x86_64: UP build fixes Ingo Molnar
2006-11-16 8:58 ` Andrew Morton
2006-11-16 9:01 ` Andi Kleen
@ 2006-11-16 9:03 ` Ingo Molnar
2006-11-16 9:32 ` [patch] hotplug CPU: clean up hotcpu_notifier() use Ingo Molnar
2 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2006-11-16 9:03 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andi Kleen, Linus Torvalds, linux-kernel
* Ingo Molnar <mingo@elte.hu> wrote:
> x86_64 does not build cleanly on UP:
updated patch below - i left out the cpu.h bits because they caused
problems elsewhere.
Ingo
--------------->
Subject: x86_64: build fixes
From: Ingo Molnar <mingo@elte.hu>
x86_64 does not build cleanly on UP:
arch/x86_64/kernel/vsyscall.c: In function 'cpu_vsyscall_notifier':
arch/x86_64/kernel/vsyscall.c:282: warning: implicit declaration of function 'smp_call_function_single'
arch/x86_64/kernel/vsyscall.c: At top level:
arch/x86_64/kernel/vsyscall.c:279: warning: 'cpu_vsyscall_notifier' defined but not used
this patch fixes it.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
include/asm-x86_64/smp.h | 11 ++---------
include/linux/smp.h | 9 +++++++++
2 files changed, 11 insertions(+), 10 deletions(-)
Index: linux/include/asm-x86_64/smp.h
===================================================================
--- linux.orig/include/asm-x86_64/smp.h
+++ linux/include/asm-x86_64/smp.h
@@ -115,16 +115,9 @@ static __inline int logical_smp_processo
}
#ifdef CONFIG_SMP
-#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
+# define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
#else
-#define cpu_physical_id(cpu) boot_cpu_id
-static inline int smp_call_function_single(int cpuid, void (*func) (void *info),
- void *info, int retry, int wait)
-{
- /* Disable interrupts here? */
- func(info);
- return 0;
-}
+# define cpu_physical_id(cpu) boot_cpu_id
#endif /* !CONFIG_SMP */
#endif
Index: linux/include/linux/smp.h
===================================================================
--- linux.orig/include/linux/smp.h
+++ linux/include/linux/smp.h
@@ -100,6 +100,15 @@ static inline void smp_send_reschedule(i
#define num_booting_cpus() 1
#define smp_prepare_boot_cpu() do {} while (0)
+static inline int
+smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
+ int retry, int wait)
+{
+ func(info);
+
+ return 0;
+}
+
#endif /* !SMP */
/*
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch, -rc6] x86_64: UP build fixes
2006-11-16 9:01 ` Andi Kleen
@ 2006-11-16 9:17 ` Andrew Morton
2006-11-16 9:22 ` Andi Kleen
0 siblings, 1 reply; 16+ messages in thread
From: Andrew Morton @ 2006-11-16 9:17 UTC (permalink / raw)
To: Andi Kleen; +Cc: Ingo Molnar, Linus Torvalds, linux-kernel
On Thu, 16 Nov 2006 10:01:01 +0100
Andi Kleen <ak@suse.de> wrote:
> +#ifdef CONFIG_HOTPLUG_CPU
> hotcpu_notifier(cpu_vsyscall_notifier, 0);
> +#endif
this part isn't needed - the definition handles that.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch, -rc6] x86_64: UP build fixes
2006-11-16 9:17 ` Andrew Morton
@ 2006-11-16 9:22 ` Andi Kleen
2006-11-16 9:48 ` Ingo Molnar
0 siblings, 1 reply; 16+ messages in thread
From: Andi Kleen @ 2006-11-16 9:22 UTC (permalink / raw)
To: Andrew Morton; +Cc: Ingo Molnar, Linus Torvalds, linux-kernel
On Thursday 16 November 2006 10:17, Andrew Morton wrote:
> On Thu, 16 Nov 2006 10:01:01 +0100
> Andi Kleen <ak@suse.de> wrote:
>
> > +#ifdef CONFIG_HOTPLUG_CPU
> > hotcpu_notifier(cpu_vsyscall_notifier, 0);
> > +#endif
>
> this part isn't needed - the definition handles that.
Thanks. Updated patch appended.
-Andi
Fix vsyscall.c compilation on UP
Broken by earlier patch by me.
Signed-off-by: Andi Kleen <ak@suse.de>
Index: linux/arch/x86_64/kernel/vsyscall.c
===================================================================
--- linux.orig/arch/x86_64/kernel/vsyscall.c
+++ linux/arch/x86_64/kernel/vsyscall.c
@@ -274,6 +274,7 @@ static void __cpuinit cpu_vsyscall_init(
vsyscall_set_cpu(raw_smp_processor_id());
}
+#ifdef CONFIG_HOTPLUG_CPU
static int __cpuinit
cpu_vsyscall_notifier(struct notifier_block *n, unsigned long action, void *arg)
{
@@ -282,6 +283,7 @@ cpu_vsyscall_notifier(struct notifier_bl
smp_call_function_single(cpu, cpu_vsyscall_init, NULL, 0, 1);
return NOTIFY_DONE;
}
+#endif
static void __init map_vsyscall(void)
{
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch, -rc6] x86_64: UP build fixes
2006-11-16 8:58 ` Andrew Morton
@ 2006-11-16 9:28 ` Ingo Molnar
2006-11-16 9:45 ` Ingo Molnar
0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2006-11-16 9:28 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andi Kleen, Linus Torvalds, linux-kernel
* Andrew Morton <akpm@osdl.org> wrote:
> On Thu, 16 Nov 2006 09:48:55 +0100
> Ingo Molnar <mingo@elte.hu> wrote:
>
> > +static inline int
> > +smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
> > + int retry, int wait)
> > +{
> > + func(info);
> > +
> > + return 0;
> > +}
> > +
>
> Given that on SMP the function is called with local interrupts
> disabled, I'd suggest that it should be called with local interrupts
> disabled on UP as well.
>
> on_each_cpu() does this and one caller (at least) relies upon it
> (invalidate_bh_lrus(), iirc).
ok, fair enough. Then this is a (minor) bugfix as well.
Ingo
--------------->
Subject: x86_64: build fixes
From: Ingo Molnar <mingo@elte.hu>
x86_64 does not build cleanly on UP:
arch/x86_64/kernel/vsyscall.c: In function 'cpu_vsyscall_notifier':
arch/x86_64/kernel/vsyscall.c:282: warning: implicit declaration of function 'smp_call_function_single'
arch/x86_64/kernel/vsyscall.c: At top level:
arch/x86_64/kernel/vsyscall.c:279: warning: 'cpu_vsyscall_notifier' defined but not used
this patch fixes it.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
include/asm-x86_64/smp.h | 11 ++---------
include/linux/smp.h | 13 +++++++++++++
2 files changed, 15 insertions(+), 9 deletions(-)
Index: linux/include/asm-x86_64/smp.h
===================================================================
--- linux.orig/include/asm-x86_64/smp.h
+++ linux/include/asm-x86_64/smp.h
@@ -115,16 +115,9 @@ static __inline int logical_smp_processo
}
#ifdef CONFIG_SMP
-#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
+# define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
#else
-#define cpu_physical_id(cpu) boot_cpu_id
-static inline int smp_call_function_single(int cpuid, void (*func) (void *info),
- void *info, int retry, int wait)
-{
- /* Disable interrupts here? */
- func(info);
- return 0;
-}
+# define cpu_physical_id(cpu) boot_cpu_id
#endif /* !CONFIG_SMP */
#endif
Index: linux/include/linux/smp.h
===================================================================
--- linux.orig/include/linux/smp.h
+++ linux/include/linux/smp.h
@@ -100,6 +100,19 @@ static inline void smp_send_reschedule(i
#define num_booting_cpus() 1
#define smp_prepare_boot_cpu() do {} while (0)
+static inline int
+smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
+ int retry, int wait)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ func(info);
+ local_irq_restore(flags);
+
+ return 0;
+}
+
#endif /* !SMP */
/*
^ permalink raw reply [flat|nested] 16+ messages in thread
* [patch] hotplug CPU: clean up hotcpu_notifier() use
2006-11-16 9:03 ` Ingo Molnar
@ 2006-11-16 9:32 ` Ingo Molnar
2006-11-16 21:59 ` Linus Torvalds
0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2006-11-16 9:32 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andi Kleen, Linus Torvalds, linux-kernel
* Ingo Molnar <mingo@elte.hu> wrote:
> > x86_64 does not build cleanly on UP:
>
> updated patch below - i left out the cpu.h bits because they caused
> problems elsewhere.
the cpu-hotplug related warning is solved by the cleanup below.
Identity patch, does not change the code.
Ingo
---------------------------->
Subject: [patch] hotplug CPU: clean up hotcpu_notifier() use
From: Ingo Molnar <mingo@elte.hu>
There was lots of #ifdef noise in the kernel due to
hotcpu_notifier(fn, prio) not correctly marking 'fn'
as used in the !HOTPLUG_CPU case, and thus generating
compiler warnings of unused symbols, hence forcing
people to add #ifdefs.
the compiler can skip truly unused functions just fine:
text data bss dec hex filename
1624412 728710 3674856 6027978 5bfaca vmlinux.before
1624412 728710 3674856 6027978 5bfaca vmlinux.after
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/i386/kernel/cpu/mcheck/therm_throt.c | 2 --
arch/i386/kernel/cpuid.c | 2 --
arch/i386/kernel/microcode.c | 2 --
arch/i386/kernel/msr.c | 2 --
arch/ia64/kernel/palinfo.c | 2 --
arch/ia64/kernel/salinfo.c | 2 --
arch/s390/appldata/appldata_base.c | 2 --
arch/x86_64/kernel/mce.c | 2 --
arch/x86_64/kernel/mce_amd.c | 2 --
block/ll_rw_blk.c | 4 ----
drivers/cpufreq/cpufreq.c | 2 --
fs/buffer.c | 2 --
fs/xfs/xfs_mount.c | 4 +---
include/linux/cpu.h | 6 +++---
kernel/cpuset.c | 4 ----
kernel/profile.c | 3 +--
kernel/sched.c | 3 ---
kernel/workqueue.c | 2 --
lib/radix-tree.c | 2 --
mm/page_alloc.c | 4 ----
mm/swap.c | 2 ++
mm/vmscan.c | 2 --
net/core/dev.c | 2 --
net/core/flow.c | 2 --
24 files changed, 7 insertions(+), 55 deletions(-)
Index: linux/arch/i386/kernel/cpu/mcheck/therm_throt.c
===================================================================
--- linux.orig/arch/i386/kernel/cpu/mcheck/therm_throt.c
+++ linux/arch/i386/kernel/cpu/mcheck/therm_throt.c
@@ -115,7 +115,6 @@ static __cpuinit int thermal_throttle_ad
return sysfs_create_group(&sys_dev->kobj, &thermal_throttle_attr_group);
}
-#ifdef CONFIG_HOTPLUG_CPU
static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev)
{
return sysfs_remove_group(&sys_dev->kobj, &thermal_throttle_attr_group);
@@ -152,7 +151,6 @@ static struct notifier_block thermal_thr
{
.notifier_call = thermal_throttle_cpu_callback,
};
-#endif /* CONFIG_HOTPLUG_CPU */
static __init int thermal_throttle_init_device(void)
{
Index: linux/arch/i386/kernel/cpuid.c
===================================================================
--- linux.orig/arch/i386/kernel/cpuid.c
+++ linux/arch/i386/kernel/cpuid.c
@@ -167,7 +167,6 @@ static int cpuid_class_device_create(int
return err;
}
-#ifdef CONFIG_HOTPLUG_CPU
static int cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
{
unsigned int cpu = (unsigned long)hcpu;
@@ -187,7 +186,6 @@ static struct notifier_block __cpuinitda
{
.notifier_call = cpuid_class_cpu_callback,
};
-#endif /* !CONFIG_HOTPLUG_CPU */
static int __init cpuid_init(void)
{
Index: linux/arch/i386/kernel/microcode.c
===================================================================
--- linux.orig/arch/i386/kernel/microcode.c
+++ linux/arch/i386/kernel/microcode.c
@@ -703,7 +703,6 @@ static struct sysdev_driver mc_sysdev_dr
.resume = mc_sysdev_resume,
};
-#ifdef CONFIG_HOTPLUG_CPU
static __cpuinit int
mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
{
@@ -726,7 +725,6 @@ mc_cpu_callback(struct notifier_block *n
static struct notifier_block mc_cpu_notifier = {
.notifier_call = mc_cpu_callback,
};
-#endif
static int __init microcode_init (void)
{
Index: linux/arch/i386/kernel/msr.c
===================================================================
--- linux.orig/arch/i386/kernel/msr.c
+++ linux/arch/i386/kernel/msr.c
@@ -250,7 +250,6 @@ static int msr_class_device_create(int i
return err;
}
-#ifdef CONFIG_HOTPLUG_CPU
static int msr_class_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
@@ -271,7 +270,6 @@ static struct notifier_block __cpuinitda
{
.notifier_call = msr_class_cpu_callback,
};
-#endif
static int __init msr_init(void)
{
Index: linux/arch/ia64/kernel/palinfo.c
===================================================================
--- linux.orig/arch/ia64/kernel/palinfo.c
+++ linux/arch/ia64/kernel/palinfo.c
@@ -952,7 +952,6 @@ remove_palinfo_proc_entries(unsigned int
}
}
-#ifdef CONFIG_HOTPLUG_CPU
static int palinfo_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
@@ -974,7 +973,6 @@ static struct notifier_block palinfo_cpu
.notifier_call = palinfo_cpu_callback,
.priority = 0,
};
-#endif
static int __init
palinfo_init(void)
Index: linux/arch/ia64/kernel/salinfo.c
===================================================================
--- linux.orig/arch/ia64/kernel/salinfo.c
+++ linux/arch/ia64/kernel/salinfo.c
@@ -575,7 +575,6 @@ static struct file_operations salinfo_da
.write = salinfo_log_write,
};
-#ifdef CONFIG_HOTPLUG_CPU
static int __devinit
salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
{
@@ -620,7 +619,6 @@ static struct notifier_block salinfo_cpu
.notifier_call = salinfo_cpu_callback,
.priority = 0,
};
-#endif /* CONFIG_HOTPLUG_CPU */
static int __init
salinfo_init(void)
Index: linux/arch/s390/appldata/appldata_base.c
===================================================================
--- linux.orig/arch/s390/appldata/appldata_base.c
+++ linux/arch/s390/appldata/appldata_base.c
@@ -561,7 +561,6 @@ appldata_offline_cpu(int cpu)
spin_unlock(&appldata_timer_lock);
}
-#ifdef CONFIG_HOTPLUG_CPU
static int __cpuinit
appldata_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu)
@@ -582,7 +581,6 @@ appldata_cpu_notify(struct notifier_bloc
static struct notifier_block appldata_nb = {
.notifier_call = appldata_cpu_notify,
};
-#endif
/*
* appldata_init()
Index: linux/arch/x86_64/kernel/mce.c
===================================================================
--- linux.orig/arch/x86_64/kernel/mce.c
+++ linux/arch/x86_64/kernel/mce.c
@@ -641,7 +641,6 @@ static __cpuinit int mce_create_device(u
return err;
}
-#ifdef CONFIG_HOTPLUG_CPU
static void mce_remove_device(unsigned int cpu)
{
int i;
@@ -674,7 +673,6 @@ mce_cpu_callback(struct notifier_block *
static struct notifier_block mce_cpu_notifier = {
.notifier_call = mce_cpu_callback,
};
-#endif
static __init int mce_init_device(void)
{
Index: linux/arch/x86_64/kernel/mce_amd.c
===================================================================
--- linux.orig/arch/x86_64/kernel/mce_amd.c
+++ linux/arch/x86_64/kernel/mce_amd.c
@@ -551,7 +551,6 @@ out:
return err;
}
-#ifdef CONFIG_HOTPLUG_CPU
/*
* let's be hotplug friendly.
* in case of multiple core processors, the first core always takes ownership
@@ -656,7 +655,6 @@ static int threshold_cpu_callback(struct
static struct notifier_block threshold_cpu_notifier = {
.notifier_call = threshold_cpu_callback,
};
-#endif /* CONFIG_HOTPLUG_CPU */
static __init int threshold_init_device(void)
{
Index: linux/block/ll_rw_blk.c
===================================================================
--- linux.orig/block/ll_rw_blk.c
+++ linux/block/ll_rw_blk.c
@@ -3374,8 +3374,6 @@ static void blk_done_softirq(struct soft
}
}
-#ifdef CONFIG_HOTPLUG_CPU
-
static int blk_cpu_notify(struct notifier_block *self, unsigned long action,
void *hcpu)
{
@@ -3401,8 +3399,6 @@ static struct notifier_block __devinitda
.notifier_call = blk_cpu_notify,
};
-#endif /* CONFIG_HOTPLUG_CPU */
-
/**
* blk_complete_request - end I/O on a request
* @req: the request being processed
Index: linux/drivers/cpufreq/cpufreq.c
===================================================================
--- linux.orig/drivers/cpufreq/cpufreq.c
+++ linux/drivers/cpufreq/cpufreq.c
@@ -1535,7 +1535,6 @@ int cpufreq_update_policy(unsigned int c
}
EXPORT_SYMBOL(cpufreq_update_policy);
-#ifdef CONFIG_HOTPLUG_CPU
static int cpufreq_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
@@ -1575,7 +1574,6 @@ static struct notifier_block __cpuinitda
{
.notifier_call = cpufreq_cpu_callback,
};
-#endif /* CONFIG_HOTPLUG_CPU */
/*********************************************************************
* REGISTER / UNREGISTER CPUFREQ DRIVER *
Index: linux/fs/buffer.c
===================================================================
--- linux.orig/fs/buffer.c
+++ linux/fs/buffer.c
@@ -2972,7 +2972,6 @@ init_buffer_head(void *data, kmem_cache_
}
}
-#ifdef CONFIG_HOTPLUG_CPU
static void buffer_exit_cpu(int cpu)
{
int i;
@@ -2994,7 +2993,6 @@ static int buffer_cpu_notify(struct noti
buffer_exit_cpu((unsigned long)hcpu);
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
void __init buffer_init(void)
{
Index: linux/fs/xfs/xfs_mount.c
===================================================================
--- linux.orig/fs/xfs/xfs_mount.c
+++ linux/fs/xfs/xfs_mount.c
@@ -1704,7 +1704,6 @@ xfs_mount_log_sbunit(
* is present to prevent thrashing).
*/
-#ifdef CONFIG_HOTPLUG_CPU
/*
* hot-plug CPU notifier support.
*
@@ -1761,7 +1760,6 @@ xfs_icsb_cpu_notify(
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
int
xfs_icsb_init_counters(
@@ -1777,8 +1775,8 @@ xfs_icsb_init_counters(
#ifdef CONFIG_HOTPLUG_CPU
mp->m_icsb_notifier.notifier_call = xfs_icsb_cpu_notify;
mp->m_icsb_notifier.priority = 0;
- register_hotcpu_notifier(&mp->m_icsb_notifier);
#endif /* CONFIG_HOTPLUG_CPU */
+ register_hotcpu_notifier(&mp->m_icsb_notifier);
for_each_online_cpu(i) {
cntp = (xfs_icsb_cnts_t *)per_cpu_ptr(mp->m_sb_cnts, i);
Index: linux/include/linux/cpu.h
===================================================================
--- linux.orig/include/linux/cpu.h
+++ linux/include/linux/cpu.h
@@ -81,9 +81,9 @@ int cpu_down(unsigned int cpu);
#define lock_cpu_hotplug() do { } while (0)
#define unlock_cpu_hotplug() do { } while (0)
#define lock_cpu_hotplug_interruptible() 0
-#define hotcpu_notifier(fn, pri) do { } while (0)
-#define register_hotcpu_notifier(nb) do { } while (0)
-#define unregister_hotcpu_notifier(nb) do { } while (0)
+#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
+#define register_hotcpu_notifier(nb) do { (void)(nb); } while (0)
+#define unregister_hotcpu_notifier(nb) do { (void)(nb); } while (0)
/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */
static inline int cpu_is_offline(int cpu) { return 0; }
Index: linux/kernel/cpuset.c
===================================================================
--- linux.orig/kernel/cpuset.c
+++ linux/kernel/cpuset.c
@@ -2045,7 +2045,6 @@ out:
return err;
}
-#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_MEMORY_HOTPLUG)
/*
* If common_cpu_mem_hotplug_unplug(), below, unplugs any CPUs
* or memory nodes, we need to walk over the cpuset hierarchy,
@@ -2109,9 +2108,7 @@ static void common_cpu_mem_hotplug_unplu
mutex_unlock(&callback_mutex);
mutex_unlock(&manage_mutex);
}
-#endif
-#ifdef CONFIG_HOTPLUG_CPU
/*
* The top_cpuset tracks what CPUs and Memory Nodes are online,
* period. This is necessary in order to make cpusets transparent
@@ -2128,7 +2125,6 @@ static int cpuset_handle_cpuhp(struct no
common_cpu_mem_hotplug_unplug();
return 0;
}
-#endif
#ifdef CONFIG_MEMORY_HOTPLUG
/*
Index: linux/kernel/profile.c
===================================================================
--- linux.orig/kernel/profile.c
+++ linux/kernel/profile.c
@@ -298,7 +298,6 @@ out:
put_cpu();
}
-#ifdef CONFIG_HOTPLUG_CPU
static int __devinit profile_cpu_callback(struct notifier_block *info,
unsigned long action, void *__cpu)
{
@@ -351,10 +350,10 @@ static int __devinit profile_cpu_callbac
}
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
#else /* !CONFIG_SMP */
#define profile_flip_buffers() do { } while (0)
#define profile_discard_flip_buffers() do { } while (0)
+#define profile_cpu_callback NULL
void profile_hit(int type, void *__pc)
{
Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -6723,8 +6723,6 @@ SYSDEV_ATTR(sched_smt_power_savings, 064
sched_smt_power_savings_store);
#endif
-
-#ifdef CONFIG_HOTPLUG_CPU
/*
* Force a reinitialization of the sched domains hierarchy. The domains
* and groups cannot be updated in place without racing with the balancing
@@ -6757,7 +6755,6 @@ static int update_sched_domains(struct n
return NOTIFY_OK;
}
-#endif
void __init sched_init_smp(void)
{
Index: linux/kernel/workqueue.c
===================================================================
--- linux.orig/kernel/workqueue.c
+++ linux/kernel/workqueue.c
@@ -609,7 +609,6 @@ int current_is_keventd(void)
}
-#ifdef CONFIG_HOTPLUG_CPU
/* Take the work from this (downed) CPU. */
static void take_over_work(struct workqueue_struct *wq, unsigned int cpu)
{
@@ -692,7 +691,6 @@ static int __devinit workqueue_cpu_callb
return NOTIFY_OK;
}
-#endif
void init_workqueues(void)
{
Index: linux/lib/radix-tree.c
===================================================================
--- linux.orig/lib/radix-tree.c
+++ linux/lib/radix-tree.c
@@ -869,7 +869,6 @@ static __init void radix_tree_init_maxin
height_to_maxindex[i] = __maxindex(i);
}
-#ifdef CONFIG_HOTPLUG_CPU
static int radix_tree_callback(struct notifier_block *nfb,
unsigned long action,
void *hcpu)
@@ -889,7 +888,6 @@ static int radix_tree_callback(struct no
}
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
void __init radix_tree_init(void)
{
Index: linux/mm/page_alloc.c
===================================================================
--- linux.orig/mm/page_alloc.c
+++ linux/mm/page_alloc.c
@@ -700,7 +700,6 @@ void drain_node_pages(int nodeid)
}
#endif
-#if defined(CONFIG_PM) || defined(CONFIG_HOTPLUG_CPU)
static void __drain_pages(unsigned int cpu)
{
unsigned long flags;
@@ -722,7 +721,6 @@ static void __drain_pages(unsigned int c
}
}
}
-#endif /* CONFIG_PM || CONFIG_HOTPLUG_CPU */
#ifdef CONFIG_PM
@@ -2736,7 +2734,6 @@ void __init free_area_init(unsigned long
__pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL);
}
-#ifdef CONFIG_HOTPLUG_CPU
static int page_alloc_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu)
{
@@ -2751,7 +2748,6 @@ static int page_alloc_cpu_notify(struct
}
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
void __init page_alloc_init(void)
{
Index: linux/mm/swap.c
===================================================================
--- linux.orig/mm/swap.c
+++ linux/mm/swap.c
@@ -514,5 +514,7 @@ void __init swap_setup(void)
* Right now other parts of the system means that we
* _really_ don't want to cluster much more
*/
+#ifdef CONFIG_HOTPLUG_CPU
hotcpu_notifier(cpu_swap_callback, 0);
+#endif
}
Index: linux/mm/vmscan.c
===================================================================
--- linux.orig/mm/vmscan.c
+++ linux/mm/vmscan.c
@@ -1508,7 +1508,6 @@ out:
}
#endif
-#ifdef CONFIG_HOTPLUG_CPU
/* It's optimal to keep kswapds on the same CPUs as their memory, but
not required for correctness. So if the last cpu in a node goes
away, we get changed to run anywhere: as the first one comes back,
@@ -1529,7 +1528,6 @@ static int __devinit cpu_callback(struct
}
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
/*
* This kswapd start function will be called by init and node-hot-add.
Index: linux/net/core/dev.c
===================================================================
--- linux.orig/net/core/dev.c
+++ linux/net/core/dev.c
@@ -3361,7 +3361,6 @@ void unregister_netdev(struct net_device
EXPORT_SYMBOL(unregister_netdev);
-#ifdef CONFIG_HOTPLUG_CPU
static int dev_cpu_callback(struct notifier_block *nfb,
unsigned long action,
void *ocpu)
@@ -3405,7 +3404,6 @@ static int dev_cpu_callback(struct notif
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
#ifdef CONFIG_NET_DMA
/**
Index: linux/net/core/flow.c
===================================================================
--- linux.orig/net/core/flow.c
+++ linux/net/core/flow.c
@@ -340,7 +340,6 @@ static void __devinit flow_cache_cpu_pre
tasklet_init(tasklet, flow_cache_flush_tasklet, 0);
}
-#ifdef CONFIG_HOTPLUG_CPU
static int flow_cache_cpu(struct notifier_block *nfb,
unsigned long action,
void *hcpu)
@@ -349,7 +348,6 @@ static int flow_cache_cpu(struct notifie
__flow_cache_shrink((unsigned long)hcpu, 0);
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
static int __init flow_cache_init(void)
{
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch, -rc6] x86_64: UP build fixes
2006-11-16 9:28 ` Ingo Molnar
@ 2006-11-16 9:45 ` Ingo Molnar
0 siblings, 0 replies; 16+ messages in thread
From: Ingo Molnar @ 2006-11-16 9:45 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andi Kleen, Linus Torvalds, linux-kernel
* Ingo Molnar <mingo@elte.hu> wrote:
> > on_each_cpu() does this and one caller (at least) relies upon it
> > (invalidate_bh_lrus(), iirc).
>
> ok, fair enough. Then this is a (minor) bugfix as well.
ok, this doesnt build on some configs - so the replacement patch below
moves the UP variant to a function (which makes sense anyway).
Ingo
--------------->
Subject: x86_64: build fixes
From: Ingo Molnar <mingo@elte.hu>
x86_64 does not build cleanly on UP:
arch/x86_64/kernel/vsyscall.c: In function 'cpu_vsyscall_notifier':
arch/x86_64/kernel/vsyscall.c:282: warning: implicit declaration of function 'smp_call_function_single'
arch/x86_64/kernel/vsyscall.c: At top level:
arch/x86_64/kernel/vsyscall.c:279: warning: 'cpu_vsyscall_notifier' defined but not used
this patch fixes it by making smp_call_function_single() globally available.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
include/asm-x86_64/smp.h | 11 ++---------
include/linux/smp.h | 10 +++++++---
kernel/sched.c | 19 +++++++++++++++++++
3 files changed, 28 insertions(+), 12 deletions(-)
Index: linux/include/asm-x86_64/smp.h
===================================================================
--- linux.orig/include/asm-x86_64/smp.h
+++ linux/include/asm-x86_64/smp.h
@@ -115,16 +115,9 @@ static __inline int logical_smp_processo
}
#ifdef CONFIG_SMP
-#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
+# define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
#else
-#define cpu_physical_id(cpu) boot_cpu_id
-static inline int smp_call_function_single(int cpuid, void (*func) (void *info),
- void *info, int retry, int wait)
-{
- /* Disable interrupts here? */
- func(info);
- return 0;
-}
+# define cpu_physical_id(cpu) boot_cpu_id
#endif /* !CONFIG_SMP */
#endif
Index: linux/include/linux/smp.h
===================================================================
--- linux.orig/include/linux/smp.h
+++ linux/include/linux/smp.h
@@ -53,9 +53,6 @@ extern void smp_cpus_done(unsigned int m
*/
int smp_call_function(void(*func)(void *info), void *info, int retry, int wait);
-int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
- int retry, int wait);
-
/*
* Call a function on all processors
*/
@@ -103,6 +100,13 @@ static inline void smp_send_reschedule(i
#endif /* !SMP */
/*
+ * Call a function on a specific CPU (on UP the function gets executed
+ * on the current CPU, immediately):
+ */
+int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
+ int retry, int wait);
+
+/*
* smp_processor_id(): get the current CPU ID.
*
* if DEBUG_PREEMPT is enabled the we check whether it is
Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -1110,6 +1110,25 @@ repeat:
task_rq_unlock(rq, &flags);
}
+#ifndef CONFIG_SMP
+/*
+ * Call a function on a specific CPU (on UP the function gets executed
+ * on the current CPU, immediately):
+ */
+int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
+ int retry, int wait)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ func(info);
+ local_irq_restore(flags);
+
+ return 0;
+}
+EXPORT_SYMBOL(smp_call_function_single);
+#endif
+
/***
* kick_process - kick a running thread to enter/exit the kernel
* @p: the to-be-kicked thread
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch, -rc6] x86_64: UP build fixes
2006-11-16 9:22 ` Andi Kleen
@ 2006-11-16 9:48 ` Ingo Molnar
2006-11-16 10:09 ` Andi Kleen
0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2006-11-16 9:48 UTC (permalink / raw)
To: Andi Kleen; +Cc: Andrew Morton, Linus Torvalds, linux-kernel
* Andi Kleen <ak@suse.de> wrote:
> On Thursday 16 November 2006 10:17, Andrew Morton wrote:
> > On Thu, 16 Nov 2006 10:01:01 +0100
> > Andi Kleen <ak@suse.de> wrote:
> >
> > > +#ifdef CONFIG_HOTPLUG_CPU
> > > hotcpu_notifier(cpu_vsyscall_notifier, 0);
> > > +#endif
> >
> > this part isn't needed - the definition handles that.
>
> Thanks. Updated patch appended.
my hotplug-CPU cleanup patch solves this in a cleaner way: by removing
all those #ifdefs as well.
Ingo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch, -rc6] x86_64: UP build fixes
2006-11-16 9:48 ` Ingo Molnar
@ 2006-11-16 10:09 ` Andi Kleen
2006-11-16 12:29 ` Ingo Molnar
0 siblings, 1 reply; 16+ messages in thread
From: Andi Kleen @ 2006-11-16 10:09 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andrew Morton, Linus Torvalds, linux-kernel
On Thursday 16 November 2006 10:48, Ingo Molnar wrote:
>
> * Andi Kleen <ak@suse.de> wrote:
>
> > On Thursday 16 November 2006 10:17, Andrew Morton wrote:
> > > On Thu, 16 Nov 2006 10:01:01 +0100
> > > Andi Kleen <ak@suse.de> wrote:
> > >
> > > > +#ifdef CONFIG_HOTPLUG_CPU
> > > > hotcpu_notifier(cpu_vsyscall_notifier, 0);
> > > > +#endif
> > >
> > > this part isn't needed - the definition handles that.
> >
> > Thanks. Updated patch appended.
>
> my hotplug-CPU cleanup patch solves this in a cleaner way: by removing
> all those #ifdefs as well.
Fine, but I suspect that late in the release it's better to go
for minimal "obvious" fixes. Later it can then be cleaned up properly.
-Andi
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch, -rc6] x86_64: UP build fixes
2006-11-16 10:09 ` Andi Kleen
@ 2006-11-16 12:29 ` Ingo Molnar
0 siblings, 0 replies; 16+ messages in thread
From: Ingo Molnar @ 2006-11-16 12:29 UTC (permalink / raw)
To: Andi Kleen; +Cc: Andrew Morton, Linus Torvalds, linux-kernel
* Andi Kleen <ak@suse.de> wrote:
> > my hotplug-CPU cleanup patch solves this in a cleaner way: by
> > removing all those #ifdefs as well.
>
> Fine, but I suspect that late in the release it's better to go for
> minimal "obvious" fixes. Later it can then be cleaned up properly.
we are not /that/ late to not apply trivial cleanups. If my patch breaks
anything then it's easy enough to fix it. But 'lets clean this up later'
is bound to be forgotten and puts the onus on the person doing the
cleanups. You yourself have sent more complex partly-cleanup patches
upstream just 2 days ago:
[PATCH for 2.6.19] [8/9] x86_64: Fix vgetcpu when CONFIG_HOTPLUG_CPU is disabled
Ingo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch] hotplug CPU: clean up hotcpu_notifier() use
2006-11-16 9:32 ` [patch] hotplug CPU: clean up hotcpu_notifier() use Ingo Molnar
@ 2006-11-16 21:59 ` Linus Torvalds
2006-11-17 3:52 ` Ingo Molnar
0 siblings, 1 reply; 16+ messages in thread
From: Linus Torvalds @ 2006-11-16 21:59 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andrew Morton, Andi Kleen, linux-kernel
On Thu, 16 Nov 2006, Ingo Molnar wrote:
>
> the cpu-hotplug related warning is solved by the cleanup below.
I do not believe this is a cleanup, at least not in this kind of form:
> @@ -1777,8 +1775,8 @@ xfs_icsb_init_counters(
> #ifdef CONFIG_HOTPLUG_CPU
> mp->m_icsb_notifier.notifier_call = xfs_icsb_cpu_notify;
> mp->m_icsb_notifier.priority = 0;
> - register_hotcpu_notifier(&mp->m_icsb_notifier);
> #endif /* CONFIG_HOTPLUG_CPU */
> + register_hotcpu_notifier(&mp->m_icsb_notifier);
That's just horrible. Now you "register" that notifier that you've never
actually even initialized.
The new code is a lot worse than the old code at least in this case.
Linus
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch] hotplug CPU: clean up hotcpu_notifier() use
2006-11-16 21:59 ` Linus Torvalds
@ 2006-11-17 3:52 ` Ingo Molnar
2006-11-17 6:02 ` Linus Torvalds
0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2006-11-17 3:52 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Andrew Morton, Andi Kleen, linux-kernel
* Linus Torvalds <torvalds@osdl.org> wrote:
> > #ifdef CONFIG_HOTPLUG_CPU
> > mp->m_icsb_notifier.notifier_call = xfs_icsb_cpu_notify;
> > mp->m_icsb_notifier.priority = 0;
> > - register_hotcpu_notifier(&mp->m_icsb_notifier);
> > #endif /* CONFIG_HOTPLUG_CPU */
> > + register_hotcpu_notifier(&mp->m_icsb_notifier);
>
> That's just horrible. Now you "register" that notifier that you've
> never actually even initialized.
yeah - this could only be done cleanly if there was a 'set notifier
parameters and register it' call, but there isnt. Find below the patch
with this bit taken out. (and with the mce_amd.c fix merged in). It
still removes ~25 #ifdef blocks total.
Ingo
---------------------------->
Subject: [patch] hotplug CPU: clean up hotcpu_notifier() use
From: Ingo Molnar <mingo@elte.hu>
There was lots of #ifdef noise in the kernel due to
hotcpu_notifier(fn, prio) not correctly marking 'fn'
as used in the !HOTPLUG_CPU case, and thus generating
compiler warnings of unused symbols, hence forcing
people to add #ifdefs.
the compiler can skip truly unused functions just fine:
text data bss dec hex filename
1624412 728710 3674856 6027978 5bfaca vmlinux.before
1624412 728710 3674856 6027978 5bfaca vmlinux.after
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/i386/kernel/cpu/mcheck/therm_throt.c | 2 --
arch/i386/kernel/cpuid.c | 2 --
arch/i386/kernel/microcode.c | 2 --
arch/i386/kernel/msr.c | 2 --
arch/ia64/kernel/palinfo.c | 2 --
arch/ia64/kernel/salinfo.c | 2 --
arch/s390/appldata/appldata_base.c | 2 --
arch/x86_64/kernel/mce.c | 2 --
arch/x86_64/kernel/mce_amd.c | 2 --
block/ll_rw_blk.c | 4 ----
drivers/cpufreq/cpufreq.c | 2 --
fs/buffer.c | 2 --
fs/xfs/xfs_mount.c | 4 +---
include/linux/cpu.h | 6 +++---
kernel/cpuset.c | 4 ----
kernel/profile.c | 3 +--
kernel/sched.c | 3 ---
kernel/workqueue.c | 2 --
lib/radix-tree.c | 2 --
mm/page_alloc.c | 4 ----
mm/swap.c | 2 ++
mm/vmscan.c | 2 --
net/core/dev.c | 2 --
net/core/flow.c | 2 --
24 files changed, 7 insertions(+), 55 deletions(-)
Index: linux/arch/i386/kernel/cpu/mcheck/therm_throt.c
===================================================================
--- linux.orig/arch/i386/kernel/cpu/mcheck/therm_throt.c
+++ linux/arch/i386/kernel/cpu/mcheck/therm_throt.c
@@ -115,7 +115,6 @@ static __cpuinit int thermal_throttle_ad
return sysfs_create_group(&sys_dev->kobj, &thermal_throttle_attr_group);
}
-#ifdef CONFIG_HOTPLUG_CPU
static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev)
{
return sysfs_remove_group(&sys_dev->kobj, &thermal_throttle_attr_group);
@@ -152,7 +151,6 @@ static struct notifier_block thermal_thr
{
.notifier_call = thermal_throttle_cpu_callback,
};
-#endif /* CONFIG_HOTPLUG_CPU */
static __init int thermal_throttle_init_device(void)
{
Index: linux/arch/i386/kernel/cpuid.c
===================================================================
--- linux.orig/arch/i386/kernel/cpuid.c
+++ linux/arch/i386/kernel/cpuid.c
@@ -167,7 +167,6 @@ static int cpuid_class_device_create(int
return err;
}
-#ifdef CONFIG_HOTPLUG_CPU
static int cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
{
unsigned int cpu = (unsigned long)hcpu;
@@ -187,7 +186,6 @@ static struct notifier_block __cpuinitda
{
.notifier_call = cpuid_class_cpu_callback,
};
-#endif /* !CONFIG_HOTPLUG_CPU */
static int __init cpuid_init(void)
{
Index: linux/arch/i386/kernel/microcode.c
===================================================================
--- linux.orig/arch/i386/kernel/microcode.c
+++ linux/arch/i386/kernel/microcode.c
@@ -703,7 +703,6 @@ static struct sysdev_driver mc_sysdev_dr
.resume = mc_sysdev_resume,
};
-#ifdef CONFIG_HOTPLUG_CPU
static __cpuinit int
mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
{
@@ -726,7 +725,6 @@ mc_cpu_callback(struct notifier_block *n
static struct notifier_block mc_cpu_notifier = {
.notifier_call = mc_cpu_callback,
};
-#endif
static int __init microcode_init (void)
{
Index: linux/arch/i386/kernel/msr.c
===================================================================
--- linux.orig/arch/i386/kernel/msr.c
+++ linux/arch/i386/kernel/msr.c
@@ -250,7 +250,6 @@ static int msr_class_device_create(int i
return err;
}
-#ifdef CONFIG_HOTPLUG_CPU
static int msr_class_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
@@ -271,7 +270,6 @@ static struct notifier_block __cpuinitda
{
.notifier_call = msr_class_cpu_callback,
};
-#endif
static int __init msr_init(void)
{
Index: linux/arch/ia64/kernel/palinfo.c
===================================================================
--- linux.orig/arch/ia64/kernel/palinfo.c
+++ linux/arch/ia64/kernel/palinfo.c
@@ -952,7 +952,6 @@ remove_palinfo_proc_entries(unsigned int
}
}
-#ifdef CONFIG_HOTPLUG_CPU
static int palinfo_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
@@ -974,7 +973,6 @@ static struct notifier_block palinfo_cpu
.notifier_call = palinfo_cpu_callback,
.priority = 0,
};
-#endif
static int __init
palinfo_init(void)
Index: linux/arch/ia64/kernel/salinfo.c
===================================================================
--- linux.orig/arch/ia64/kernel/salinfo.c
+++ linux/arch/ia64/kernel/salinfo.c
@@ -575,7 +575,6 @@ static struct file_operations salinfo_da
.write = salinfo_log_write,
};
-#ifdef CONFIG_HOTPLUG_CPU
static int __devinit
salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
{
@@ -620,7 +619,6 @@ static struct notifier_block salinfo_cpu
.notifier_call = salinfo_cpu_callback,
.priority = 0,
};
-#endif /* CONFIG_HOTPLUG_CPU */
static int __init
salinfo_init(void)
Index: linux/arch/s390/appldata/appldata_base.c
===================================================================
--- linux.orig/arch/s390/appldata/appldata_base.c
+++ linux/arch/s390/appldata/appldata_base.c
@@ -561,7 +561,6 @@ appldata_offline_cpu(int cpu)
spin_unlock(&appldata_timer_lock);
}
-#ifdef CONFIG_HOTPLUG_CPU
static int __cpuinit
appldata_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu)
@@ -582,7 +581,6 @@ appldata_cpu_notify(struct notifier_bloc
static struct notifier_block appldata_nb = {
.notifier_call = appldata_cpu_notify,
};
-#endif
/*
* appldata_init()
Index: linux/arch/x86_64/kernel/mce.c
===================================================================
--- linux.orig/arch/x86_64/kernel/mce.c
+++ linux/arch/x86_64/kernel/mce.c
@@ -641,7 +641,6 @@ static __cpuinit int mce_create_device(u
return err;
}
-#ifdef CONFIG_HOTPLUG_CPU
static void mce_remove_device(unsigned int cpu)
{
int i;
@@ -674,7 +673,6 @@ mce_cpu_callback(struct notifier_block *
static struct notifier_block mce_cpu_notifier = {
.notifier_call = mce_cpu_callback,
};
-#endif
static __init int mce_init_device(void)
{
Index: linux/arch/x86_64/kernel/mce_amd.c
===================================================================
--- linux.orig/arch/x86_64/kernel/mce_amd.c
+++ linux/arch/x86_64/kernel/mce_amd.c
@@ -551,7 +551,6 @@ out:
return err;
}
-#ifdef CONFIG_HOTPLUG_CPU
/*
* let's be hotplug friendly.
* in case of multiple core processors, the first core always takes ownership
@@ -593,12 +593,14 @@ static void threshold_remove_bank(unsign
sprintf(name, "threshold_bank%i", bank);
+#ifdef CONFIG_SMP
/* sibling symlink */
if (shared_bank[bank] && b->blocks->cpu != cpu) {
sysfs_remove_link(&per_cpu(device_mce, cpu).kobj, name);
per_cpu(threshold_banks, cpu)[bank] = NULL;
return;
}
+#endif
/* remove all sibling symlinks before unregistering */
for_each_cpu_mask(i, b->cpus) {
@@ -656,7 +655,6 @@ static int threshold_cpu_callback(struct
static struct notifier_block threshold_cpu_notifier = {
.notifier_call = threshold_cpu_callback,
};
-#endif /* CONFIG_HOTPLUG_CPU */
static __init int threshold_init_device(void)
{
Index: linux/block/ll_rw_blk.c
===================================================================
--- linux.orig/block/ll_rw_blk.c
+++ linux/block/ll_rw_blk.c
@@ -3374,8 +3374,6 @@ static void blk_done_softirq(struct soft
}
}
-#ifdef CONFIG_HOTPLUG_CPU
-
static int blk_cpu_notify(struct notifier_block *self, unsigned long action,
void *hcpu)
{
@@ -3401,8 +3399,6 @@ static struct notifier_block __devinitda
.notifier_call = blk_cpu_notify,
};
-#endif /* CONFIG_HOTPLUG_CPU */
-
/**
* blk_complete_request - end I/O on a request
* @req: the request being processed
Index: linux/drivers/cpufreq/cpufreq.c
===================================================================
--- linux.orig/drivers/cpufreq/cpufreq.c
+++ linux/drivers/cpufreq/cpufreq.c
@@ -1535,7 +1535,6 @@ int cpufreq_update_policy(unsigned int c
}
EXPORT_SYMBOL(cpufreq_update_policy);
-#ifdef CONFIG_HOTPLUG_CPU
static int cpufreq_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
@@ -1575,7 +1574,6 @@ static struct notifier_block __cpuinitda
{
.notifier_call = cpufreq_cpu_callback,
};
-#endif /* CONFIG_HOTPLUG_CPU */
/*********************************************************************
* REGISTER / UNREGISTER CPUFREQ DRIVER *
Index: linux/fs/buffer.c
===================================================================
--- linux.orig/fs/buffer.c
+++ linux/fs/buffer.c
@@ -2972,7 +2972,6 @@ init_buffer_head(void *data, kmem_cache_
}
}
-#ifdef CONFIG_HOTPLUG_CPU
static void buffer_exit_cpu(int cpu)
{
int i;
@@ -2994,7 +2993,6 @@ static int buffer_cpu_notify(struct noti
buffer_exit_cpu((unsigned long)hcpu);
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
void __init buffer_init(void)
{
Index: linux/include/linux/cpu.h
===================================================================
--- linux.orig/include/linux/cpu.h
+++ linux/include/linux/cpu.h
@@ -81,9 +81,9 @@ int cpu_down(unsigned int cpu);
#define lock_cpu_hotplug() do { } while (0)
#define unlock_cpu_hotplug() do { } while (0)
#define lock_cpu_hotplug_interruptible() 0
-#define hotcpu_notifier(fn, pri) do { } while (0)
-#define register_hotcpu_notifier(nb) do { } while (0)
-#define unregister_hotcpu_notifier(nb) do { } while (0)
+#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
+#define register_hotcpu_notifier(nb) do { (void)(nb); } while (0)
+#define unregister_hotcpu_notifier(nb) do { (void)(nb); } while (0)
/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */
static inline int cpu_is_offline(int cpu) { return 0; }
Index: linux/kernel/cpuset.c
===================================================================
--- linux.orig/kernel/cpuset.c
+++ linux/kernel/cpuset.c
@@ -2045,7 +2045,6 @@ out:
return err;
}
-#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_MEMORY_HOTPLUG)
/*
* If common_cpu_mem_hotplug_unplug(), below, unplugs any CPUs
* or memory nodes, we need to walk over the cpuset hierarchy,
@@ -2109,9 +2108,7 @@ static void common_cpu_mem_hotplug_unplu
mutex_unlock(&callback_mutex);
mutex_unlock(&manage_mutex);
}
-#endif
-#ifdef CONFIG_HOTPLUG_CPU
/*
* The top_cpuset tracks what CPUs and Memory Nodes are online,
* period. This is necessary in order to make cpusets transparent
@@ -2128,7 +2125,6 @@ static int cpuset_handle_cpuhp(struct no
common_cpu_mem_hotplug_unplug();
return 0;
}
-#endif
#ifdef CONFIG_MEMORY_HOTPLUG
/*
Index: linux/kernel/profile.c
===================================================================
--- linux.orig/kernel/profile.c
+++ linux/kernel/profile.c
@@ -298,7 +298,6 @@ out:
put_cpu();
}
-#ifdef CONFIG_HOTPLUG_CPU
static int __devinit profile_cpu_callback(struct notifier_block *info,
unsigned long action, void *__cpu)
{
@@ -351,10 +350,10 @@ static int __devinit profile_cpu_callbac
}
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
#else /* !CONFIG_SMP */
#define profile_flip_buffers() do { } while (0)
#define profile_discard_flip_buffers() do { } while (0)
+#define profile_cpu_callback NULL
void profile_hit(int type, void *__pc)
{
Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -6723,8 +6723,6 @@ SYSDEV_ATTR(sched_smt_power_savings, 064
sched_smt_power_savings_store);
#endif
-
-#ifdef CONFIG_HOTPLUG_CPU
/*
* Force a reinitialization of the sched domains hierarchy. The domains
* and groups cannot be updated in place without racing with the balancing
@@ -6757,7 +6755,6 @@ static int update_sched_domains(struct n
return NOTIFY_OK;
}
-#endif
void __init sched_init_smp(void)
{
Index: linux/kernel/workqueue.c
===================================================================
--- linux.orig/kernel/workqueue.c
+++ linux/kernel/workqueue.c
@@ -609,7 +609,6 @@ int current_is_keventd(void)
}
-#ifdef CONFIG_HOTPLUG_CPU
/* Take the work from this (downed) CPU. */
static void take_over_work(struct workqueue_struct *wq, unsigned int cpu)
{
@@ -692,7 +691,6 @@ static int __devinit workqueue_cpu_callb
return NOTIFY_OK;
}
-#endif
void init_workqueues(void)
{
Index: linux/lib/radix-tree.c
===================================================================
--- linux.orig/lib/radix-tree.c
+++ linux/lib/radix-tree.c
@@ -869,7 +869,6 @@ static __init void radix_tree_init_maxin
height_to_maxindex[i] = __maxindex(i);
}
-#ifdef CONFIG_HOTPLUG_CPU
static int radix_tree_callback(struct notifier_block *nfb,
unsigned long action,
void *hcpu)
@@ -889,7 +888,6 @@ static int radix_tree_callback(struct no
}
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
void __init radix_tree_init(void)
{
Index: linux/mm/page_alloc.c
===================================================================
--- linux.orig/mm/page_alloc.c
+++ linux/mm/page_alloc.c
@@ -700,7 +700,6 @@ void drain_node_pages(int nodeid)
}
#endif
-#if defined(CONFIG_PM) || defined(CONFIG_HOTPLUG_CPU)
static void __drain_pages(unsigned int cpu)
{
unsigned long flags;
@@ -722,7 +721,6 @@ static void __drain_pages(unsigned int c
}
}
}
-#endif /* CONFIG_PM || CONFIG_HOTPLUG_CPU */
#ifdef CONFIG_PM
@@ -2736,7 +2734,6 @@ void __init free_area_init(unsigned long
__pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL);
}
-#ifdef CONFIG_HOTPLUG_CPU
static int page_alloc_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu)
{
@@ -2751,7 +2748,6 @@ static int page_alloc_cpu_notify(struct
}
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
void __init page_alloc_init(void)
{
Index: linux/mm/swap.c
===================================================================
--- linux.orig/mm/swap.c
+++ linux/mm/swap.c
@@ -514,5 +514,7 @@ void __init swap_setup(void)
* Right now other parts of the system means that we
* _really_ don't want to cluster much more
*/
+#ifdef CONFIG_HOTPLUG_CPU
hotcpu_notifier(cpu_swap_callback, 0);
+#endif
}
Index: linux/mm/vmscan.c
===================================================================
--- linux.orig/mm/vmscan.c
+++ linux/mm/vmscan.c
@@ -1508,7 +1508,6 @@ out:
}
#endif
-#ifdef CONFIG_HOTPLUG_CPU
/* It's optimal to keep kswapds on the same CPUs as their memory, but
not required for correctness. So if the last cpu in a node goes
away, we get changed to run anywhere: as the first one comes back,
@@ -1529,7 +1528,6 @@ static int __devinit cpu_callback(struct
}
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
/*
* This kswapd start function will be called by init and node-hot-add.
Index: linux/net/core/dev.c
===================================================================
--- linux.orig/net/core/dev.c
+++ linux/net/core/dev.c
@@ -3361,7 +3361,6 @@ void unregister_netdev(struct net_device
EXPORT_SYMBOL(unregister_netdev);
-#ifdef CONFIG_HOTPLUG_CPU
static int dev_cpu_callback(struct notifier_block *nfb,
unsigned long action,
void *ocpu)
@@ -3405,7 +3404,6 @@ static int dev_cpu_callback(struct notif
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
#ifdef CONFIG_NET_DMA
/**
Index: linux/net/core/flow.c
===================================================================
--- linux.orig/net/core/flow.c
+++ linux/net/core/flow.c
@@ -340,7 +340,6 @@ static void __devinit flow_cache_cpu_pre
tasklet_init(tasklet, flow_cache_flush_tasklet, 0);
}
-#ifdef CONFIG_HOTPLUG_CPU
static int flow_cache_cpu(struct notifier_block *nfb,
unsigned long action,
void *hcpu)
@@ -349,7 +348,6 @@ static int flow_cache_cpu(struct notifie
__flow_cache_shrink((unsigned long)hcpu, 0);
return NOTIFY_OK;
}
-#endif /* CONFIG_HOTPLUG_CPU */
static int __init flow_cache_init(void)
{
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch] hotplug CPU: clean up hotcpu_notifier() use
2006-11-17 3:52 ` Ingo Molnar
@ 2006-11-17 6:02 ` Linus Torvalds
2006-11-17 7:28 ` Ingo Molnar
0 siblings, 1 reply; 16+ messages in thread
From: Linus Torvalds @ 2006-11-17 6:02 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andrew Morton, Andi Kleen, linux-kernel
On Fri, 17 Nov 2006, Ingo Molnar wrote:
>
> yeah - this could only be done cleanly if there was a 'set notifier
> parameters and register it' call, but there isnt. Find below the patch
> with this bit taken out. (and with the mce_amd.c fix merged in). It
> still removes ~25 #ifdef blocks total.
Ok, looks better, although I just don't feel comfy merging this at this
point, since it looks unlikely to fix any real bugs.
Will happily take it post-2.6.19 as a cleanup, though.
Linus
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [patch] hotplug CPU: clean up hotcpu_notifier() use
2006-11-17 6:02 ` Linus Torvalds
@ 2006-11-17 7:28 ` Ingo Molnar
0 siblings, 0 replies; 16+ messages in thread
From: Ingo Molnar @ 2006-11-17 7:28 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Andrew Morton, Andi Kleen, linux-kernel
* Linus Torvalds <torvalds@osdl.org> wrote:
> On Fri, 17 Nov 2006, Ingo Molnar wrote:
> >
> > yeah - this could only be done cleanly if there was a 'set notifier
> > parameters and register it' call, but there isnt. Find below the
> > patch with this bit taken out. (and with the mce_amd.c fix merged
> > in). It still removes ~25 #ifdef blocks total.
>
> Ok, looks better, although I just don't feel comfy merging this at
> this point, since it looks unlikely to fix any real bugs.
>
> Will happily take it post-2.6.19 as a cleanup, though.
ok - we are closer to 2.6.19-final than i thought :-)
Ingo
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2006-11-17 7:40 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-16 8:48 [patch, -rc6] x86_64: UP build fixes Ingo Molnar
2006-11-16 8:58 ` Andrew Morton
2006-11-16 9:28 ` Ingo Molnar
2006-11-16 9:45 ` Ingo Molnar
2006-11-16 9:01 ` Andi Kleen
2006-11-16 9:17 ` Andrew Morton
2006-11-16 9:22 ` Andi Kleen
2006-11-16 9:48 ` Ingo Molnar
2006-11-16 10:09 ` Andi Kleen
2006-11-16 12:29 ` Ingo Molnar
2006-11-16 9:03 ` Ingo Molnar
2006-11-16 9:32 ` [patch] hotplug CPU: clean up hotcpu_notifier() use Ingo Molnar
2006-11-16 21:59 ` Linus Torvalds
2006-11-17 3:52 ` Ingo Molnar
2006-11-17 6:02 ` Linus Torvalds
2006-11-17 7:28 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox