]> git.karo-electronics.de Git - karo-tx-linux.git/commit
xen/mce: schedule a workqueue to avoid sleep in atomic context
authorLiu, Jinsong <jinsong.liu@intel.com>
Tue, 12 Jun 2012 15:11:16 +0000 (23:11 +0800)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 12 Jun 2012 12:38:46 +0000 (08:38 -0400)
commit4bf10fa12973b82262aba78901736b1d1a13374f
tree7431b2c7f5cd4a292cc8c0c3a3330d7379e54730
parent363293ed0d3418610881bee6234199bcbb369654
xen/mce: schedule a workqueue to avoid sleep in atomic context

copy_to_user might sleep and print a stack trace if it is executed
in an atomic spinlock context. Like this:

(XEN) CMCI: send CMCI to DOM0 through virq
BUG: sleeping function called from invalid context at /home/konradinux/kernel.h:199
in_atomic(): 1, irqs_disabled(): 0, pid: 4581, name: mcelog
Pid: 4581, comm: mcelog Tainted: G           O 3.5.0-rc1upstream-00003-g149000b-dirty #1
 [<ffffffff8109ad9a>] __might_sleep+0xda/0x100
 [<ffffffff81329b0b>] xen_mce_chrdev_read+0xab/0x140
 [<ffffffff81148945>] vfs_read+0xc5/0x190
 [<ffffffff81148b0c>] sys_read+0x4c/0x90
 [<ffffffff815bd039>] system_call_fastpath+0x16

This patch schedule a workqueue for IRQ handler to poll the data,
and use mutex instead of spinlock, so copy_to_user sleep in atomic
context would not occur.

Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Suggested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/xen/mcelog.c