I found that the "spawn" program of UnixBench may get segfault/bus
error or other memory corruptions when we do CPU hotplug on quad-core
Loongson-3. We have debug this for a long time but have no solution,
so I want to know whether this is not a Loongson-specific but a
Linux kernel-3.6.11 with Loongson-3 patches (the linux-3.6 branch of
CPU hotplug script like this (hotplug.sh):
while true; do
echo 0 >/sys/devices/system/cpu/cpu1/online
echo 0 >/sys/devices/system/cpu/cpu2/online
echo 0 >/sys/devices/system/cpu/cpu3/online
echo 1 >/sys/devices/system/cpu/cpu1/online
echo 1 >/sys/devices/system/cpu/cpu2/online
echo 1 >/sys/devices/system/cpu/cpu3/online
1, run "hotplug.sh" and then run "spawn 10000", spawn will get
segfault after a few minutes.
2, run "hotplug.sh" and then run "taskset -c 0 spawn 10000" (spawn
runs only on core-0), spawn will get segfault in half an hour.
3, run "taskset -c 0 hotplug.sh" and then run "spawn 10000"
(hotplug.sh runs only on core-0), spawn will get segfault in half an
4, run "taskset -c 0 hotplug.sh" and then run "taskset -c 0 spawn
10000" (both spawn and hotplug.sh run only on core-0), spawn will
finish successfully after about 3 hours.
This looks like the bug fixed in the below commit, but Linux-3.6
already have merged this patch:
Author: Maksim Rayskiy <email@example.com>
Date: Thu Nov 10 17:59:45 2011 +0000
MIPS: ASID conflict after CPU hotplug
BTW, we found that if we do build_clear_page()/build_copy_page() in
cpu_cache_init() only on Core-0 at the first boot time (Don't do it
while CPU Hotplug, and don't do it on Core-1,2,3), the possibility of