[PATCH v4 12/13] ARM: KVM: vgic: reduce the number of vcpu kick
Russell King - ARM Linux
linux at arm.linux.org.uk
Wed Dec 5 10:55:41 EST 2012
On Wed, Dec 05, 2012 at 01:40:24PM +0000, Marc Zyngier wrote:
> Admittedly, the whole sequence should be rewritten to be clearer. What
> it does is "If we're running a guest and there is no active interrupt,
> then kick the guest".
On the whole this entire thing should be written clearer; from the
explanations you've given it seems that the only reason this code works
is because you're relying on several behaviours all coming together to
achieve the right result - which makes for fragile code.
You're partly relying on atomic types to ensure that the increment and
decrement happen exclusively. You're then relying on a combination of
IRQ protection and cmpxchg() to ensure that the non-atomic read of the
atomic type won't be a problem.
This doesn't inspire confidence, and I have big concerns over whether
this code will still be understandable in a number of years time.
And I still wonder how safe this is even with your explanations. IRQ
disabling only works for the local CPU core so I still have questions
over this wrt a SMP host OS.
More information about the linux-arm-kernel
mailing list