From 2.6.24 to 2.6.25-rc2, CPU can not do hotplug when one task set affinity to it

youquan_song
2008-02-21T09:50:32Z

In SMP sever platform, with kernel 2.6.24-rc2 and kernel 2.6.25-rc2,
Set one task affinity to one CPU core, then set offline the CPU core.
After that we can not set online the CPU core again.

1. run the test.sh script: test.sh 1 ( 1 is the logical CPU )
test.sh script:

#!/bin/bash

main(){

typeset -i CPU=$1
./task.sh > /dev/null&
PID=$!

if [ `cat /sys/devices/system/cpu/cpu${CPU}/online` = "0" ]; then
echo "1" > /sys/devices/system/cpu/cpu${CPU}/online
fi

MASK=$((1<<${CPU}))

`taskset -p ${MASK} ${PID} > /dev/null 2>&1`

echo "0" > /sys/devices/system/cpu/cpu${CPU}/online

echo "1" > /sys/devices/system/cpu/cpu${CPU}/online

kill -9 $PID > /dev/null 2>&1

echo "PASS\n"

}

typeset -i TEST_CPU=$1
main $TEST_CPU

2. task.sh script as following

#!/bin/bash

while :
do
NOOP=1
done

Actual Result:
The test.sh will block at set online the CPU ( echo "1" >
/sys/devices/system/cpu/cpu${CPU}/online ).

we check the test.sh has dead by 'ps -aux'.