x86: add locking to map_pages_to_xen()
authorJan Beulich <jbeulich@suse.com>
Mon, 15 Jul 2013 12:17:56 +0000 (14:17 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 15 Jul 2013 12:17:56 +0000 (14:17 +0200)
commit8bfaa2c23fb96d8d6bc5c0383373f9be918b82ec
tree12b3972374a80addd69f0d786f74233383016cdb
parent395f777ae0eed67b03596fe38d6d90f307ddd036
x86: add locking to map_pages_to_xen()

While boot time calls don't need this, run time uses of the function
which may result in L2 page tables getting populated need to be
serialized to avoid two CPUs populating the same L2 (or L3) entry,
overwriting each other's results.

This is expected to fix what would seem to be a regression from commit
b0581b92 ("x86: make map_domain_page_global() a simple wrapper around
vmap()"), albeit that change only made more readily visible the already
existing issue.

This patch intentionally does not
- add locking to the page table de-allocation logic in
  destroy_xen_mappings() (the only user having potential races here,
  msix_put_fixmap(), gets converted to use __set_fixmap() instead)
- avoid races between super page splitting and reconstruction in
  map_pages_to_xen() (no such uses exist; races between multiple
  splitting attempts or between multiple reconstruction attempts are
  being taken care of)
If we wanted to take care of these, we'd need to alter the behavior
of virt_to_xen_l?e() - they would need to return with the lock held
then.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/mm.c
xen/arch/x86/msi.c
xen/arch/x86/x86_64/mm.c
xen/include/asm-x86/page.h