x86/hyperv: Don't use percpu areas for pcpu_flush/pcpu_flush_ex structures
authorVitaly Kuznetsov <vkuznets@redhat.com>
Thu, 5 Oct 2017 11:39:24 +0000 (13:39 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 10 Oct 2017 10:54:56 +0000 (12:54 +0200)
commit60d73a7c96601434dfdb56d5b9167ff3b850d8d7
tree12248a7085e4fac767e9e20236d7a91fd47e40cf
parenta3b7424392924e778b608e30ee321f7b10cc94b8
x86/hyperv: Don't use percpu areas for pcpu_flush/pcpu_flush_ex structures

hv_do_hypercall() does virt_to_phys() translation and with some configs
(CONFIG_SLAB) this doesn't work for percpu areas, we pass wrong memory to
hypervisor and get #GP. We could use working slow_virt_to_phys() instead
but doing so kills the performance.

Move pcpu_flush/pcpu_flush_ex structures out of percpu areas and
allocate memory on first call. The additional level of indirection gives
us a small performance penalty, in future we may consider introducing
hypercall functions which avoid virt_to_phys() conversion and cache
physical addresses of pcpu_flush/pcpu_flush_ex structures somewhere.

Reported-by: Simon Xiao <sixiao@microsoft.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Jork Loeser <Jork.Loeser@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: devel@linuxdriverproject.org
Link: http://lkml.kernel.org/r/20171005113924.28021-1-vkuznets@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/hyperv/mmu.c