xen: fix RMW when unmasking events
authorJeremy Fitzhardinge <jeremy@goop.org>
Mon, 17 Mar 2008 23:36:52 +0000 (16:36 -0700)
committerIngo Molnar <mingo@elte.hu>
Thu, 27 Mar 2008 15:08:45 +0000 (16:08 +0100)
commit04c44a080d2f699a3042d4e743f7ad2ffae9d538
treef198aa2f653a8b2cd0e4d33ccc68587e9027cd81
parent5abbcf29928966b28d70f8a0da424f55582f8603
xen: fix RMW when unmasking events

xen_irq_enable_direct and xen_sysexit were using "andw $0x00ff,
XEN_vcpu_info_pending(vcpu)" to unmask events and test for pending ones
in one instuction.

Unfortunately, the pending flag must be modified with a locked operation
since it can be set by another CPU, and the unlocked form of this
operation was causing the pending flag to get lost, allowing the processor
to return to usermode with pending events and ultimately deadlock.

The simple fix would be to make it a locked operation, but that's rather
costly and unnecessary.  The fix here is to split the mask-clearing and
pending-testing into two instructions; the interrupt window between
them is of no concern because either way pending or new events will
be processed.

This should fix lingering bugs in using direct vcpu structure access too.

[ Stable: needed in 2.6.24.x ]

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Stable <stable@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/xen/enlighten.c
arch/x86/xen/xen-asm.S