[BUG] events process running on wrong cpu

From: Heiko Carstens
Date: Mon Sep 21 2009 - 04:52:06 EST


Hi,

with todays git from time to time I get this (s390 defconfig):


BUG: using smp_processor_id() in preemptible [00000000] code: events/1/16
caller is vmstat_update+0x28/0x74
CPU: 0 Not tainted 2.6.31-06618-gebc79c4-dirty #3
Process events/1 (pid: 16, task: 000000003fcbea00, ksp: 000000003fcd7cd8)
000000003fcd7da8 000000003fcd7d28 0000000000000002 0000000000000000
000000003fcd7dc8 000000003fcd7d40 000000003fcd7d40 00000000003fe46a
000000000001ffff 000000003fcd7e70 000000000192b128 ffffffffffffc000
000000000000000d 000000000000000c 000000003fcd7d90 0000000000000000
0000000000000000 0000000000016bda 000000003fcd7d28 000000003fcd7d68
Call Trace:
([<0000000000016aea>] show_trace+0xe6/0x134)
[<0000000000202a5e>] debug_smp_processor_id+0x112/0x12c
[<00000000000b302c>] vmstat_update+0x28/0x74
[<000000000005fb9a>] worker_thread+0x19a/0x27c
[<0000000000065f80>] kthread+0xa0/0xa8
[<000000000001b786>] kernel_thread_starter+0x6/0xc
[<000000000001b780>] kernel_thread_starter+0x0/0xc

Please note that events/1 is running in cpu 0 (!).

But (with a patched procfs output):

[root@h4245004 ~]# cat /proc/16/status
Name: events/1
State: S (sleeping)
Tgid: 16
Pid: 16
PPid: 2
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 64
Groups:
Threads: 1
SigQ: 0/4096
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: ffffffffffffffff
SigCgt: 0000000000000000
CapInh: 0000000000000000
CapPrm: ffffffffffffffff
CapEff: fffffffffffffeff
CapBnd: fffffffffffffeff
Cpus_allowed: 00000002 <----------
Cpus_allowed_list: 1 <----------
task: 000000003fcbea00, ksp: 000000003fcd7cd8
User PSW : 0704000180000000 000000000001b780
User GPRS: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000065ee0 000000003fe73cf8 000000000004d414
0000000000000000 0000000000000000 0000000000000000 000000003fcd7eb8
User ACRS: 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
voluntary_ctxt_switches: 55
nonvoluntary_ctxt_switches: 1

So the cpus_allowed mask is correct (later on at least). Looks like the
created kthread ran before its cpus_allowed mask was set.
Looking at the code this shouldn't happen. But still...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/