[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: Assert !in_atomic() before exiting to guest context.
# HG changeset patch # User Keir Fraser <keir@xxxxxxx> # Date 1358171745 0 # Node ID e6f74afc78d26e0201c64d08b8a3ed089c2120ff # Parent 5db9c4e12fbf1c1ae8d50d6e3676521c06b1183c x86: Assert !in_atomic() before exiting to guest context. Signed-off-by: Keir Fraser <keir@xxxxxxx> --- diff -r 5db9c4e12fbf -r e6f74afc78d2 xen/arch/x86/hvm/svm/entry.S --- a/xen/arch/x86/hvm/svm/entry.S Sun Jan 13 10:20:52 2013 +0000 +++ b/xen/arch/x86/hvm/svm/entry.S Mon Jan 14 13:55:45 2013 +0000 @@ -42,6 +42,7 @@ ENTRY(svm_asm_do_resume) call svm_intr_assist call_with_regs(nsvm_vcpu_switch) + ASSERT_NOT_IN_ATOMIC get_current(bx) CLGI diff -r 5db9c4e12fbf -r e6f74afc78d2 xen/arch/x86/hvm/vmx/entry.S --- a/xen/arch/x86/hvm/vmx/entry.S Sun Jan 13 10:20:52 2013 +0000 +++ b/xen/arch/x86/hvm/vmx/entry.S Mon Jan 14 13:55:45 2013 +0000 @@ -98,6 +98,7 @@ vmx_asm_vmexit_handler: vmx_asm_do_vmentry: call vmx_intr_assist call nvmx_switch_guest + ASSERT_NOT_IN_ATOMIC get_current(bx) cli diff -r 5db9c4e12fbf -r e6f74afc78d2 xen/arch/x86/x86_64/compat/entry.S --- a/xen/arch/x86/x86_64/compat/entry.S Sun Jan 13 10:20:52 2013 +0000 +++ b/xen/arch/x86/x86_64/compat/entry.S Mon Jan 14 13:55:45 2013 +0000 @@ -92,6 +92,7 @@ compat_skip_clobber: /* %rbx: struct vcpu */ ENTRY(compat_test_all_events) + ASSERT_NOT_IN_ATOMIC cli # tests must not race interrupts /*compat_test_softirqs:*/ movl VCPU_processor(%rbx),%eax diff -r 5db9c4e12fbf -r e6f74afc78d2 xen/arch/x86/x86_64/entry.S --- a/xen/arch/x86/x86_64/entry.S Sun Jan 13 10:20:52 2013 +0000 +++ b/xen/arch/x86/x86_64/entry.S Mon Jan 14 13:55:45 2013 +0000 @@ -190,6 +190,7 @@ skip_clobber: /* %rbx: struct vcpu */ test_all_events: + ASSERT_NOT_IN_ATOMIC cli # tests must not race interrupts /*test_softirqs:*/ movl VCPU_processor(%rbx),%eax diff -r 5db9c4e12fbf -r e6f74afc78d2 xen/common/preempt.c --- a/xen/common/preempt.c Sun Jan 13 10:20:52 2013 +0000 +++ b/xen/common/preempt.c Mon Jan 14 13:55:45 2013 +0000 @@ -30,3 +30,9 @@ bool_t in_atomic(void) { return preempt_count() || in_irq() || !local_irq_is_enabled(); } + +/* asm helper */ +void bug_if_in_atomic(void) +{ + BUG_ON(in_atomic()); +} diff -r 5db9c4e12fbf -r e6f74afc78d2 xen/include/asm-x86/asm_defns.h --- a/xen/include/asm-x86/asm_defns.h Sun Jan 13 10:20:52 2013 +0000 +++ b/xen/include/asm-x86/asm_defns.h Mon Jan 14 13:55:45 2013 +0000 @@ -59,6 +59,14 @@ void ret_from_intr(void); GET_STACK_BASE(reg); \ __GET_CURRENT(reg) +#ifndef NDEBUG +#define ASSERT_NOT_IN_ATOMIC \ + sti; /* sometimes called with interrupts disabled: safe to enable */ \ + call bug_if_in_atomic +#else +#define ASSERT_NOT_IN_ATOMIC +#endif + #endif #endif /* __X86_ASM_DEFNS_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |