Skip to contentSkip to conversation

module, param and stop_machine patches

GIT PULL Rusty Russell 4 participants 10 messages Oct 21, 2008 – Oct 26, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The following changes since commit 2515ddc6db8eb49a79f0fe5e67ff09ac7c81eab4:
Paul Mundt (1):
binfmt_elf_fdpic: Update for cputime changes.

are available in the git repository at:

ssh://master.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus.git master

Andi Kleen (1):
Remove stop_machine during module load v2

Heiko Carstens (4):
Call init_workqueues before pre smp initcalls.
workqueue: introduce create_rt_workqueue
stop_machine: use workqueues instead of kernel threads
stop_machine: fix error code handling on multiple cpus

Rusty Russell (6):
module: simplify load_module.
module: check kernel param length at compile time, not runtime
param: Fix duplicate module prefixes
core_param() for genuinely core kernel parameters Make initcall_debug a core_param
Make panic= and panic_on_oops into core_params

 include/linux/module.h      |    6 +-
 include/linux/moduleparam.h |   25 ++++-
 include/linux/workqueue.h   |   18 ++--
 init/main.c                 |   12 +--
 kernel/module.c             |  284 ++++++++++++++++++------------------------
 kernel/panic.c              |   17 +--
 kernel/params.c             |  274 ++++++++++++++++++++++-------------------
 kernel/stop_machine.c       |  120 +++++++-----------
 kernel/workqueue.c          |    7 +-
 9 files changed, 364 insertions(+), 399 deletions(-)
include/linux/module.h +3 -3
index 5d2970c..3bfed01 100644
@@ -29,7 +29,7 @@
 #define MODULE_SYMBOL_PREFIX ""
 #endif
 
-#define MODULE_NAME_LEN (64 - sizeof(unsigned long))
+#define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
 
 struct kernel_symbol
 {
@@ -60,6 +60,7 @@ struct module_kobject
 	struct kobject kobj;
 	struct module *mod;
 	struct kobject *drivers_dir;
+	struct module_param_attrs *mp;
 };
 
 /* These are either module local, or the kernel's dummy ones. */
@@ -242,7 +243,6 @@ struct module
 
 	/* Sysfs stuff. */
 	struct module_kobject mkobj;
-	struct module_param_attrs *param_attrs;
 	struct module_attribute *modinfo_attrs;
 	const char *version;
 	const char *srcversion;
@@ -277,7 +277,7 @@ struct module
 
 	/* Exception table */
 	unsigned int num_exentries;
-	const struct exception_table_entry *extable;
+	struct exception_table_entry *extable;
 
 	/* Startup function. */
 	int (*init)(void);
include/linux/moduleparam.h +24 -1
index ec62438..e4af339 100644
@@ -13,6 +13,9 @@
 #define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
 #endif
 
+/* Chosen so that structs with an unsigned long line up. */
+#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
+
 #ifdef MODULE
 #define ___module_cat(a,b) __mod_ ## a ## b
 #define __module_cat(a,b) ___module_cat(a,b)
@@ -79,7 +82,8 @@ struct kparam_array
 #define __module_param_call(prefix, name, set, get, arg, perm)		\
 	/* Default value instead of permissions? */			\
 	static int __param_perm_check_##name __attribute__((unused)) =	\
-	BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2));	\
+	BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2))	\
+	+ BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN);	\
 	static const char __param_str_##name[] = prefix #name;		\
 	static struct kernel_param __moduleparam_const __param_##name	\
 	__used								\
@@ -100,6 +104,25 @@ struct kparam_array
 #define module_param(name, type, perm)				\
 	module_param_named(name, name, type, perm)
 
+#ifndef MODULE
+/**
+ * core_param - define a historical core kernel parameter.
+ * @name: the name of the cmdline and sysfs parameter (often the same as var)
+ * @var: the variable
+ * @type: the type (for param_set_##type and param_get_##type)
+ * @perm: visibility in sysfs
+ *
+ * core_param is just like module_param(), but cannot be modular and
+ * doesn't add a prefix (such as "printk.").  This is for compatibility
+ * with __setup(), and it makes sense as truly core parameters aren't
+ * tied to the particular file they're in.
+ */
+#define core_param(name, var, type, perm)				\
+	param_check_##type(name, &(var));				\
+	__module_param_call("", name, param_set_##type, param_get_##type, \
+			    &var, perm)
+#endif /* !MODULE */
+
 /* Actually copy string: maxlen param is usually sizeof(string). */
 #define module_param_string(name, string, len, perm)			\
 	static const struct kparam_string __param_string_##name		\
include/linux/workqueue.h +10 -8
index 5c158c4..89a5a12 100644
@@ -149,11 +149,11 @@ struct execute_work {
 
 extern struct workqueue_struct *
 __create_workqueue_key(const char *name, int singlethread,
-		       int freezeable, struct lock_class_key *key,
+		       int freezeable, int rt, struct lock_class_key *key,
 		       const char *lock_name);
 
 #ifdef CONFIG_LOCKDEP
-#define __create_workqueue(name, singlethread, freezeable)	\
+#define __create_workqueue(name, singlethread, freezeable, rt)	\
 ({								\
 	static struct lock_class_key __key;			\
 	const char *__lock_name;				\
@@ -164,17 +164,19 @@ __create_workqueue_key(const char *name, int singlethread,
 		__lock_name = #name;				\
 								\
 	__create_workqueue_key((name), (singlethread),		\
-			       (freezeable), &__key,		\
+			       (freezeable), (rt), &__key,	\
 			       __lock_name);			\
 })
 #else
-#define __create_workqueue(name, singlethread, freezeable)	\
-	__create_workqueue_key((name), (singlethread), (freezeable), NULL, NULL)
+#define __create_workqueue(name, singlethread, freezeable, rt)	\
+	__create_workqueue_key((name), (singlethread), (freezeable), (rt), \
+			       NULL, NULL)
 #endif
 
-#define create_workqueue(name) __create_workqueue((name), 0, 0)
-#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1)
-#define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0)
+#define create_workqueue(name) __create_workqueue((name), 0, 0, 0)
+#define create_rt_workqueue(name) __create_workqueue((name), 0, 0, 1)
+#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1, 0)
+#define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0, 0)
 
 extern void destroy_workqueue(struct workqueue_struct *wq);
 
init/main.c +3 -9
index 3e17a3b..6c7fd13 100644
@@ -697,13 +697,7 @@ asmlinkage void __init start_kernel(void)
 }
 
 static int initcall_debug;
-
-static int __init initcall_debug_setup(char *str)
-{
-	initcall_debug = 1;
-	return 1;
-}
-__setup("initcall_debug", initcall_debug_setup);
+core_param(initcall_debug, initcall_debug, bool, 0644);
 
 int do_one_initcall(initcall_t fn)
 {
@@ -773,8 +767,6 @@ static void __init do_initcalls(void)
 static void __init do_basic_setup(void)
 {
 	rcu_init_sched(); /* needed by module_init stage. */
-	/* drivers will send hotplug events */
-	init_workqueues();
 	usermodehelper_init();
 	driver_init();
 	init_irq_proc();
@@ -858,6 +850,8 @@ static int __init kernel_init(void * unused)
 
 	cad_pid = task_pid(current);
 
+	init_workqueues();
+
 	smp_prepare_cpus(setup_max_cpus);
 
 	do_pre_smp_initcalls();
kernel/module.c +122 -162

461 lines not on this page · raw message

kernel/panic.c +3 -14
index bda561e..6513aac 100644
@@ -34,13 +34,6 @@ ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
 
 EXPORT_SYMBOL(panic_notifier_list);
 
-static int __init panic_setup(char *str)
-{
-	panic_timeout = simple_strtoul(str, NULL, 0);
-	return 1;
-}
-__setup("panic=", panic_setup);
-
 static long no_blink(long time)
 {
 	return 0;
@@ -218,13 +211,6 @@ void add_taint(unsigned flag)
 }
 EXPORT_SYMBOL(add_taint);
 
-static int __init pause_on_oops_setup(char *str)
-{
-	pause_on_oops = simple_strtoul(str, NULL, 0);
-	return 1;
-}
-__setup("pause_on_oops=", pause_on_oops_setup);
-
 static void spin_msec(int msecs)
 {
 	int i;
@@ -384,3 +370,6 @@ void __stack_chk_fail(void)
 }
 EXPORT_SYMBOL(__stack_chk_fail);
 #endif
+
+core_param(panic, panic_timeout, int, 0644);
+core_param(pause_on_oops, pause_on_oops, int, 0644);
kernel/params.c +146 -128

351 lines not on this page · raw message

kernel/stop_machine.c +47 -73

174 lines not on this page · raw message

kernel/workqueue.c +6 -1
index 714afad..f928f2a 100644
@@ -62,6 +62,7 @@ struct workqueue_struct {
 	const char *name;
 	int singlethread;
 	int freezeable;		/* Freeze threads during suspend */
+	int rt;
 #ifdef CONFIG_LOCKDEP
 	struct lockdep_map lockdep_map;
 #endif
@@ -766,6 +767,7 @@ init_cpu_workqueue(struct workqueue_struct *wq, int cpu)
 
 static int create_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)
 {
+	struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
 	struct workqueue_struct *wq = cwq->wq;
 	const char *fmt = is_single_threaded(wq) ? "%s" : "%s/%d";
 	struct task_struct *p;
@@ -781,7 +783,8 @@ static int create_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)
 	 */
 	if (IS_ERR(p))
 		return PTR_ERR(p);
-
+	if (cwq->wq->rt)
+		sched_setscheduler_nocheck(p, SCHED_FIFO, &param);
 	cwq->thread = p;
 
 	return 0;
@@ -801,6 +804,7 @@ static void start_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)
 struct workqueue_struct *__create_workqueue_key(const char *name,
 						int singlethread,
 						int freezeable,
+						int rt,
 						struct lock_class_key *key,
 						const char *lock_name)
 {
@@ -822,6 +826,7 @@ struct workqueue_struct *__create_workqueue_key(const char *name,
 	lockdep_init_map(&wq->lockdep_map, lock_name, key, 0);
 	wq->singlethread = singlethread;
 	wq->freezeable = freezeable;
+	wq->rt = rt;
 	INIT_LIST_HEAD(&wq->list);
 
 	if (singlethread) {
#1 lore raw
Quoted 3 lines · Rusty Russell

Heiko Carstens (4):
Call init_workqueues before pre smp initcalls.

This one actually causes a regression for me on one of my machines.

Don't ask me why, but it's very repeatable, and it goes away when that commit is reverted. See the appended commit that I have queued up (but not yet pushed out) in my tree for details..

Linus
---
From: Linus Torvalds <[email protected]>
Date: Sat, 25 Oct 2008 14:04:40 -0700
Subject: [PATCH] Revert "Call init_workqueues before pre smp initcalls."

This reverts commit a802dd0eb5fc97a50cf1abb1f788a8f6cc5db635, which causes an odd bootup failure on one of my machines. The boot hangs after printing out

Found volume group "VolGroup00" using metadata type lvm2

where the next message (that never prints out) should be

2 logical volume(s) in Volume Group"VolGroup00" now active.

Cc Heiko Carstens <[email protected]>
Cc Rusty Russell <[email protected]>
init/main.c +2 -2
index 130d1a0..70e4eed 100644
@@ -768,6 +768,8 @@ static void __init do_initcalls(void)
 static void __init do_basic_setup(void)
 {
 	rcu_init_sched(); /* needed by module_init stage. */
+	/* drivers will send hotplug events */
+	init_workqueues();
 	usermodehelper_init();
 	driver_init();
 	init_irq_proc();
@@ -851,8 +853,6 @@ static int __init kernel_init(void * unused)
 
 	cad_pid = task_pid(current);
 
-	init_workqueues();
-
 	smp_prepare_cpus(setup_max_cpus);
 
 	do_pre_smp_initcalls();
#2 lore raw
Quoted 5 lines · On Sunday 26 October 2008 08:17:38 Linus Torvalds wrote:
Quoted 2 lines · Rusty Russell

Heiko Carstens (4):
Call init_workqueues before pre smp initcalls.

This one actually causes a regression for me on one of my machines.

Thanks, Heiko tracked this down; he's probably sleeping now but Hugh and Walt reported this fixes it for them and it makes sense.

---
Subject: commit a802dd0e breaks console keyboard input
Date: Sat, 25 Oct 2008 16:16:22 +0200
From: Heiko Carstens <[email protected]>

The patch below moves the init call to its old place but makes the stop_machine initialization happen later. I added a BUG_ON to catch possible early calls, but there shouldn't be any. I think the patch should solve the regression you are seeing. Could you give it a try please? The patch applies on top of latest Linus' git tree.

---
 include/linux/stop_machine.h |    6 ++++++
 init/main.c                  |    5 +++--
 kernel/stop_machine.c        |    9 ++++++---
 3 files changed, 15 insertions(+), 5 deletions(-)
include/linux/stop_machine.h +6 -0
Index: linux-2.6/include/linux/stop_machine.h
===================================================================
@@ -35,6 +35,9 @@ int stop_machine(int (*fn)(void *), void
  * won't come or go while it's being called.  Used by hotplug cpu.
  */
 int __stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus);
+
+void stop_machine_init(void);
+
 #else
 
 static inline int stop_machine(int (*fn)(void *), void *data,
@@ -46,5 +49,8 @@ static inline int stop_machine(int (*fn)
 	local_irq_enable();
 	return ret;
 }
+
+static inline void stop_machine_init(void) { }
+
 #endif /* CONFIG_SMP */
 #endif /* _LINUX_STOP_MACHINE */
init/main.c +3 -2
Index: linux-2.6/init/main.c
===================================================================
@@ -38,6 +38,7 @@
 #include <linux/moduleparam.h>
 #include <linux/kallsyms.h>
 #include <linux/writeback.h>
+#include <linux/stop_machine.h>
 #include <linux/cpu.h>
 #include <linux/cpuset.h>
 #include <linux/cgroup.h>
@@ -768,6 +769,8 @@ static void __init do_initcalls(void)
 static void __init do_basic_setup(void)
 {
 	rcu_init_sched(); /* needed by module_init stage. */
+	init_workqueues();
+	stop_machine_init();
 	usermodehelper_init();
 	driver_init();
 	init_irq_proc();
@@ -851,8 +854,6 @@ static int __init kernel_init(void * unu
 
 	cad_pid = task_pid(current);
 
-	init_workqueues();
-
 	smp_prepare_cpus(setup_max_cpus);
 
 	do_pre_smp_initcalls();
kernel/stop_machine.c +6 -3
Index: linux-2.6/kernel/stop_machine.c
===================================================================
@@ -43,6 +43,7 @@ static struct workqueue_struct *stop_mac
 static struct stop_machine_data active, idle;
 static const cpumask_t *active_cpus;
 static void *stop_machine_work;
+static int stop_machine_initialized;
 
 static void set_state(enum stopmachine_state newstate)
 {
@@ -114,6 +115,7 @@ int __stop_machine(int (*fn)(void *), vo
 	struct work_struct *sm_work;
 	int i;
 
+	BUG_ON(!stop_machine_initialized);
 	/* Set up initial state. */
 	mutex_lock(&lock);
 	num_threads = num_online_cpus();
@@ -154,10 +156,11 @@ int stop_machine(int (*fn)(void *), void
 }
 EXPORT_SYMBOL_GPL(stop_machine);
 
-static int __init stop_machine_init(void)
+void __init stop_machine_init(void)
 {
 	stop_machine_wq = create_rt_workqueue("kstop");
+	BUG_ON(!stop_machine_wq);
 	stop_machine_work = alloc_percpu(struct work_struct);
-	return 0;
+	BUG_ON(!stop_machine_work);
+	stop_machine_initialized = 1;
 }
-early_initcall(stop_machine_init);
#3 lore raw
Quoted 3 lines · Rusty Russell

Thanks, Heiko tracked this down; he's probably sleeping now but Hugh and Walt reported this fixes it for them and it makes sense.

I'm not seeing any "tracked it down".

Yes, it moves it back to its old place, but doesn't say why the new one didn't work.

And it then mixes things up with 'stop_machine_init()' mess. Why does that need to run so early?

Is there any reason why the real patch isn't just to make 'stop_machine_init' a 'core_initcall()' instead of 'early_initcall()'?

IOW, I don't think that patch is anything but a "hey, test if it works with this". None of the changes or the problems are explained. Nor do I see a sign-off from Heiko on it.

I also don't want to see more BUG_ON()'s there. Make them warnings or something.

Linus

#4 lore raw
Quoted 3 lines · Linus Torvalds

Is there any reason why the real patch isn't just to make 'stop_machine_init' a 'core_initcall()' instead of 'early_initcall()'?

IOW, something like this (untested)

Linus

---
 init/main.c           |    3 +--
 kernel/stop_machine.c |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
init/main.c +1 -2
index 130d1a0..7e117a2 100644
@@ -768,6 +768,7 @@ static void __init do_initcalls(void)
 static void __init do_basic_setup(void)
 {
 	rcu_init_sched(); /* needed by module_init stage. */
+	init_workqueues();
 	usermodehelper_init();
 	driver_init();
 	init_irq_proc();
@@ -851,8 +852,6 @@ static int __init kernel_init(void * unused)
 
 	cad_pid = task_pid(current);
 
-	init_workqueues();
-
 	smp_prepare_cpus(setup_max_cpus);
 
 	do_pre_smp_initcalls();
kernel/stop_machine.c +1 -1
index 8aff79d..9bc4c00 100644
@@ -160,4 +160,4 @@ static int __init stop_machine_init(void)
 	stop_machine_work = alloc_percpu(struct work_struct);
 	return 0;
 }
-early_initcall(stop_machine_init);
+core_initcall(stop_machine_init);
#5 lore raw

kernel/stop_machine.c static int __init stop_machine_init(void) · line 163

Quoted 3 lines · Linus Torvalds
kernel/stop_machine.c +1 -1
-early_initcall(stop_machine_init);
+core_initcall(stop_machine_init);

Btw, this obviously implies that all stop_machine() users had better be later in the boot sequence.

And no, I didn't check that exhaustively. There's the tracing infrastructure, and it's also core_initcall(), but it should be linked later. And module loading will happen later. mm/page_alloc.c has special code for bootup, and intel-rng.c should be a normal driver.

So it _should_ be ok. But I really didn't test. And my default kernel config doesn't even have CONFIG_STOP_MACHINE enabled, so I'm not the best person to test.

Linus

#6 lore raw
In reply to Linus Torvalds
Quoted 8 lines · Linus Torvalds
Quoted 2 lines · Linus Torvalds

Is there any reason why the real patch isn't just to make 'stop_machine_init' a 'core_initcall()' instead of 'early_initcall()'?

IOW, something like this (untested)

Linus

<patch snipped for brevity>

This patch also fixes the keyboard problem I reported originally.

#7 lore raw
In reply to Linus Torvalds
Quoted 5 lines · On Sunday 26 October 2008 09:33:43 Linus Torvalds wrote:
Quoted 2 lines · Rusty Russell

Thanks, Heiko tracked this down; he's probably sleeping now but Hugh and Walt reported this fixes it for them and it makes sense.

I'm not seeing any "tracked it down".

He tracked it down to moving init_workqueues() too early, so he moved that back.

Quoted 2 lines

And it then mixes things up with 'stop_machine_init()' mess. Why does that need to run so early?

The S/390 guys want to run it stop_machine v. early, so when Heiko introduced stop_machine_init() he made it an early_initcall().

Quoted 2 lines

IOW, I don't think that patch is anything but a "hey, test if it works with this". None of the changes or the problems are explained.

Indeed.

Turns out it's the cpu_online_map difference. If init_workqueues() is called too early, only the boot cpu is set. We then only create_workqueue_thread() for the boot cpu.

If CONFIG_HOTPLUG_CPU=y, it's fine since the hotplug callback will create the workqueue threads for the other cpus as they come up. Without it, the kevent workqueues on non-boot cpus don't get processed.

Still boots for me, but was a bit sick (varying, but no keyboard was one symptom).

Quoted 1 line

Nor do I see a sign-off from Heiko on it.

I thought mine would be sufficient since we both work for IBM?

Quoted 2 lines

I also don't want to see more BUG_ON()'s there. Make them warnings or something.

OK, I just killed them. It'll crash anyway.

Rusty.

Subject: Fix boot problems caused by moving init_workqueues()
Date: Sat, 25 Oct 2008 16:16:22 +0200
From: Heiko Carstens <[email protected]>

The patch below moves the init_workqueues() call to its old place but makes the stop_machine initialization happen later (but still before core_initcalls).

---
 include/linux/stop_machine.h |    6 ++++++
 init/main.c                  |    5 +++--
 kernel/stop_machine.c        |    9 ++++++---
 3 files changed, 15 insertions(+), 5 deletions(-)
include/linux/stop_machine.h +6 -0
diff -r 2b5f764088ee include/linux/stop_machine.h
@@ -35,6 +35,9 @@ int stop_machine(int (*fn)(void *), void
  * won't come or go while it's being called.  Used by hotplug cpu.
  */
 int __stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus);
+
+void stop_machine_init(void);
+
 #else
 
 static inline int stop_machine(int (*fn)(void *), void *data,
@@ -46,5 +49,8 @@ static inline int stop_machine(int (*fn)
 	local_irq_enable();
 	return ret;
 }
+
+static inline void stop_machine_init(void) { }
+
 #endif /* CONFIG_SMP */
 #endif /* _LINUX_STOP_MACHINE */
init/main.c +3 -2
diff -r 2b5f764088ee init/main.c
@@ -38,6 +38,7 @@
 #include <linux/moduleparam.h>
 #include <linux/kallsyms.h>
 #include <linux/writeback.h>
+#include <linux/stop_machine.h>
 #include <linux/cpu.h>
 #include <linux/cpuset.h>
 #include <linux/cgroup.h>
@@ -767,6 +768,8 @@ static void __init do_basic_setup(void)
 static void __init do_basic_setup(void)
 {
 	rcu_init_sched(); /* needed by module_init stage. */
+	init_workqueues();
+	stop_machine_init();
 	usermodehelper_init();
 	driver_init();
 	init_irq_proc();
@@ -850,8 +853,6 @@ static int __init kernel_init(void * unu
 
 	cad_pid = task_pid(current);
 
-	init_workqueues();
-
 	smp_prepare_cpus(setup_max_cpus);
 
 	do_pre_smp_initcalls();
kernel/stop_machine.c +1 -3
diff -r 2b5f764088ee kernel/stop_machine.c
@@ -154,10 +154,8 @@ int stop_machine(int (*fn)(void *), void
 }
 EXPORT_SYMBOL_GPL(stop_machine);
 
-static int __init stop_machine_init(void)
+void __init stop_machine_init(void)
 {
 	stop_machine_wq = create_rt_workqueue("kstop");
 	stop_machine_work = alloc_percpu(struct work_struct);
-	return 0;
 }
-early_initcall(stop_machine_init);
#8 lore raw
Quoted 23 lines · Rusty Russell
Quoted 4 lines · On Sunday 26 October 2008 09:33:43 Linus Torvalds wrote:
Quoted 2 lines · Rusty Russell

Thanks, Heiko tracked this down; he's probably sleeping now but Hugh and Walt reported this fixes it for them and it makes sense.

I'm not seeing any "tracked it down".

He tracked it down to moving init_workqueues() too early, so he moved that back.

Quoted 2 lines

And it then mixes things up with 'stop_machine_init()' mess. Why does that need to run so early?

The S/390 guys want to run it stop_machine v. early, so when Heiko introduced stop_machine_init() he made it an early_initcall().

Quoted 2 lines

IOW, I don't think that patch is anything but a "hey, test if it works with this". None of the changes or the problems are explained.

Indeed.

Turns out it's the cpu_online_map difference. If init_workqueues() is called too early, only the boot cpu is set. We then only create_workqueue_thread() for the boot cpu.

Quoted 6 lines

If CONFIG_HOTPLUG_CPU=y, it's fine since the hotplug callback will create the workqueue threads for the other cpus as they come up. Without it, the kevent workqueues on non-boot cpus don't get processed.

Still boots for me, but was a bit sick (varying, but no keyboard was one symptom).

Yes, it's all my fault. I always think in terms of CONFIG_HOTPLUG_CPU=y, so I couldn't make any sense of the bug reports and just reverted the init_workqueues() call move and added an explicit stop_machine_init() call, so that we don't depend on linkage order.
Thanks for tracking it down, Rusty!

Quoted 1 line
Quoted 1 line

Nor do I see a sign-off from Heiko on it.

But I guess you don't need that anymore since you already committed a fix for this.

Thanks,
Heiko

#9 lore raw
In reply to Rusty Russell
Quoted 6 lines · Rusty Russell
Quoted 2 lines · On Sunday 26 October 2008 09:33:43 Linus Torvalds wrote:

I'm not seeing any "tracked it down".

He tracked it down to moving init_workqueues() too early, so he moved that back.

Yeah. I had done as well by my bisection. One of the reasons I didn't push out my initial fix (just the plain revert) was exactly the fact that I don't think that is sufficient. I want to _understand_ what was going on, and get a feel from the commit message that makes me go "yeah, ok, makes sense".

Quoted 3 lines

Turns out it's the cpu_online_map difference. If init_workqueues() is called too early, only the boot cpu is set. We then only create_workqueue_thread() for the boot cpu.

Indeed. I figured it out yesterday, since I didn't get an explanation soon enough for my impatient self. So I ended up committing the fix as the minimal patch I sent out earlier, with a fairly minimal explanation. I'll happily take more fixes, but I think it should be ok.

If S390 wants to do stop_machine() even before some of the basic core_initcalls, I suspect it will have to change, but nothing I saw indicated that it really needs to.

Quoted 3 lines

If CONFIG_HOTPLUG_CPU=y, it's fine since the hotplug callback will create the workqueue threads for the other cpus as they come up. Without it, the kevent workqueues on non-boot cpus don't get processed.

.. and my default workstation config indeed hit this, since I normally have a fairly minimal setup.

Quoted 3 lines
Quoted 1 line

Nor do I see a sign-off from Heiko on it.

I thought mine would be sufficient since we both work for IBM?

Technically, yes, since you all sign your life away and do this for work, but he normally signs off his patches, so the lack of sign-off didn't make me go "hmm, this looks odd from a legal copyright standpoint", but rather "hmm, maybe Heiko doesn't feel comfy with the patch since he didn't sign off".

To me, the legal side of the sign-off is actually secondary. The whole thing was designed to be useful even in the absense of it. I've grown very fond of seeing who has seen the patch (including who _should_ have seen it but didn't react - the "cc" part ;)

Linus