diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-01-18 20:17:10 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-03-14 11:17:09 -0400 |
commit | c7617798771ad588d585986d896197c04b737621 (patch) | |
tree | 120b3d73e9e8c808083489770e5324c60e1ce8ec | |
parent | fb38923ead10aa8a28db191548e176e8856614d7 (diff) |
xen/mmu: WARN_ON when racing to swap middle leaf.
The initial bootup code uses set_phys_to_machine quite a lot, and after
bootup it would be used by the balloon driver. The balloon driver does have
mutex lock so this should not be necessary - but just in case, add
a WARN_ON if we do hit this scenario. If we do fail this, it is OK
to continue as there is a backup mechanism (VM_IO) that can bypass
the P2M and still set the _PAGE_IOMAP flags.
[v2: Change from WARN to BUG_ON]
[v3: Rebased on top of xen->p2m code split]
[v4: Change from BUG_ON to WARN]
Reviewed-by: Ian Campbell <Ian.Campbell@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r-- | arch/x86/xen/p2m.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 809fe3536301..4631cf99e714 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
@@ -605,7 +605,8 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) | |||
605 | 605 | ||
606 | /* Swap over from MISSING to IDENTITY if needed. */ | 606 | /* Swap over from MISSING to IDENTITY if needed. */ |
607 | if (p2m_top[topidx][mididx] == p2m_missing) { | 607 | if (p2m_top[topidx][mididx] == p2m_missing) { |
608 | p2m_top[topidx][mididx] = p2m_identity; | 608 | WARN_ON(cmpxchg(&p2m_top[topidx][mididx], p2m_missing, |
609 | p2m_identity) != p2m_missing); | ||
609 | return true; | 610 | return true; |
610 | } | 611 | } |
611 | } | 612 | } |