Skip to contentSkip to conversation

fix task migration code boot hang

PATCH In review James Bottomley 2 participants 2 messages Feb 27, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix task migration code boot hang

The task migration code of change set 1.373 actually only works on architectures where the physical and logical CPU numberings are the same. It they aren't, the boot sequence hangs forever. The attached fixes the code to work on all architectures.

James Bottomley

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.425 -> 1.426
# kernel/sched.c 1.51 -> 1.52
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/02/27 [email protected] 1.426
# Fix new SMP migration thread code (introduced in change set 1.373) #
# - make migration_mask a logical bitmap with correct conversions. # --------------------------------------------
#

kernel/sched.c +5 -3
diff -Nru a/kernel/sched.c b/kernel/sched.c
@@ -1555,7 +1555,8 @@
 	down(&req.sem);
 }
 
-static volatile unsigned long migration_mask;
+/* NOTE: migration_mask is a bitmap of logical CPUs */
+static volatile unsigned long migration_mask = 0;
 
 static int migration_thread(void * unused)
 {
@@ -1585,7 +1586,8 @@
 
 	for (;;) {
 		preempt_disable();
-		if (test_and_clear_bit(smp_processor_id(), &migration_mask))
+		if (test_and_clear_bit(cpu_number_map(smp_processor_id()),
+				       &migration_mask))
 			current->cpus_allowed = 1 << smp_processor_id();
 		if (test_thread_flag(TIF_NEED_RESCHED))
 			schedule();
@@ -1656,7 +1658,7 @@
 	migration_mask = (1 << smp_num_cpus) - 1;
 
 	for (cpu = 0; cpu < smp_num_cpus; cpu++)
-		while (!cpu_rq(cpu)->migration_thread)
+		while (!cpu_rq(cpu_logical_map(cpu))->migration_thread)
 			schedule_timeout(2);
 	if (migration_mask)
 		BUG();

This BitKeeper patch contains the following changesets:
+
## Wrapped with gzip_uu ##

begin 664 bkpatch1387 M'XL(`(1+?3P``[55VX[;-A!]%K]BB@"%E<0R24F6[<+!-INT#=(DQB;[;-#2 MV%)6(A62MFO'Y^1O,E>DF+;H)4(4Y?A.3-G#N5'<.G0SH*/^''%'L$?QOE9 MT*BZQD-4U9'SB'2)46X:>GUA#+T>-=K+4;=B]/SU:&<.:H-V**.44<A"^;R$ M'5HW"T04?WWB#RW.@HN7OU_^^>L%8_,YG)=*;_]>IC/F3=VI^K"G2E?UD9' MWBKM&O2J8SY^#3U*SB6=J<ABGHZ/8LR3[)B+0@B5""RX3";CA'6YG37;>F/5 M#J.!-AK#;T!D)M)DS"=''O-LREZB!(Y!BY'-&0&(IFEXQG/AIQ^.9PP3\H0 MDD/=*NLU%5I6;9<E/!$PY.PY_+>UG+,<?JO^HU[>/]F4U%5?G*:/"E155 M;@J$0:6]-<4VQP(J#7E/`H[$I29D<4@@-(;0J"N\@5@VREV!@MILJES5L*I\
MHUK85[XD6&LQ]S3KKIL4[2+V&E*1"+:X:1X;_LN#,:XX>_:`2E=H-=8CEY=8 M1/EMJ:;Q])AD,I;'=+62L<AD/N9%C-/XX19]'U9FA)S&G#HPX:+WYMVXAPWZ M(^FRIM(;<X:UQZC<_DUJJ90\%M,CGZ33I/=H*N]:-)W%_)];-(5A_+]8--^2 M7;2O#_?=53EH2ZL<&5.Y6U[+V^VUWR*@[\X>R66$XYIVV5J3HW/&+JMB$)X0 M#JY;1:%OD9"\@37MB6U+FZ"WN2<M06G:#34J2S<$9=;W<W&&XI7O%Q&WXNM M1=+)WTZK]_G)"^]@:/?](.,N[MGB!ZS_0J3I!1[U<^2C1[#VW<?7LZ^(YKZ MLANIC"_)G2\N'3P>,><I-H>=J6FN$;;:51M-NEO-_>QYL!_Z8@GU\23CC@( MJC4,/#J_)-66O6I+(AQ0_4N];59H:74[^+8=X5-:'1P.GZ^2Q:&Q#1.ISW3 M:0Z"?=GE./BI@[:?>H;K@GH*N@_#X;,;H--W+;SY-R&Y\RNW;>9K*5?K9)6P )SZ-TOJZW!@``
`
end

#1 lore raw
Quoted 4 lines · James Bottomley

The task migration code of change set 1.373 actually only works on architectures where the physical and logical CPU numberings are the same. It they aren't, the boot sequence hangs forever. The attached fixes the code to work on all architectures.

yep. DaveM has sent me a fix for this already which is in my tree.

Ingo