mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fixes for rcu_offline_cpu, rcu_move_batch (2.6.8-rc2)
@ 2004-07-26 19:37 Nathan Lynch
  2004-07-27  0:01 ` Andrew Morton
  0 siblings, 1 reply; 11+ messages in thread
From: Nathan Lynch @ 2004-07-26 19:37 UTC (permalink / raw)
  To: lkml; +Cc: Rusty Russell, Andrew Morton

Hi,

rcu_offline_cpu and rcu_move_batch have been broken since the
list_head's in struct rcu_head and struct rcu_data were replaced with
singly-linked lists:

  CC      kernel/rcupdate.o
kernel/rcupdate.c: In function `rcu_move_batch':
kernel/rcupdate.c:222: warning: passing arg 2 of `list_add_tail' from
incompatible pointer type
kernel/rcupdate.c: In function `rcu_offline_cpu':
kernel/rcupdate.c:239: warning: passing arg 1 of `rcu_move_batch' from
incompatible pointer type
kernel/rcupdate.c:240: warning: passing arg 1 of `rcu_move_batch' from
incompatible pointer type
kernel/rcupdate.c:236: warning: label `unlock' defined but not used

Kernel crashes when you try to offline a cpu, not surprisingly.

It also looks like rcu_move_batch isn't preempt-safe so I touched that
up, and got rid of an unused label in rcu_offline_cpu.

This fixes the crash for me; does it look ok?


Signed-off-by: Nathan Lynch <nathanl@austin.ibm.com>

diff -prauNX /home/nathanl/working/dontdiff 2.6.8-rc2/kernel/rcupdate.c 2.6.8-rc2-ntl/kernel/rcupdate.c
--- 2.6.8-rc2/kernel/rcupdate.c	2004-07-23 19:58:35.000000000 -0500
+++ 2.6.8-rc2-ntl/kernel/rcupdate.c	2004-07-26 13:41:15.000000000 -0500
@@ -210,16 +210,18 @@ static void rcu_check_quiescent_state(vo
  * locking requirements, the list it's pulling from has to belong to a cpu
  * which is dead and hence not processing interrupts.
  */
-static void rcu_move_batch(struct list_head *list)
+static void rcu_move_batch(struct rcu_head *list)
 {
-	struct list_head *entry;
-	int cpu = smp_processor_id();
+	int cpu;
 
 	local_irq_disable();
-	while (!list_empty(list)) {
-		entry = list->next;
-		list_del(entry);
-		list_add_tail(entry, &RCU_nxtlist(cpu));
+
+	cpu = smp_processor_id();
+
+	while (list != NULL) {
+		*RCU_nxttail(cpu) = list;
+		RCU_nxttail(cpu) = &list->next;
+		list = list->next;
 	}
 	local_irq_enable();
 }
@@ -233,11 +235,10 @@ static void rcu_offline_cpu(int cpu)
 	spin_lock_bh(&rcu_state.mutex);
 	if (rcu_ctrlblk.cur != rcu_ctrlblk.completed)
 		cpu_quiet(cpu);
-unlock:
 	spin_unlock_bh(&rcu_state.mutex);
 
-	rcu_move_batch(&RCU_curlist(cpu));
-	rcu_move_batch(&RCU_nxtlist(cpu));
+	rcu_move_batch(RCU_curlist(cpu));
+	rcu_move_batch(RCU_nxtlist(cpu));
 
 	tasklet_kill_immediate(&RCU_tasklet(cpu), cpu);
 }



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-08-15 14:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-26 19:37 [PATCH] fixes for rcu_offline_cpu, rcu_move_batch (2.6.8-rc2) Nathan Lynch
2004-07-27  0:01 ` Andrew Morton
2004-07-27  5:49   ` Zwane Mwaikambo
2004-07-31 20:53     ` [PATCH][2.6-mm] i386 Hotplug CPU Zwane Mwaikambo
2004-07-31 21:01       ` Zwane Mwaikambo
2004-08-01  3:19       ` Zwane Mwaikambo
2004-08-11 13:50       ` Pavel Machek
2004-08-12  0:44         ` [lhcs-devel] " Zwane Mwaikambo
2004-08-15  3:19           ` Zwane Mwaikambo
2004-08-15 14:46             ` Pavel Machek
2004-08-15 15:03               ` Zwane Mwaikambo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®