linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/3] KVM/ARM Fixes for v4.6-rc1
@ 2016-03-22  8:19 Christoffer Dall
  2016-03-22  8:19 ` [PULL 1/3] KVM: arm/arm64: disable preemption when calling smp_call_function_many Christoffer Dall
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Christoffer Dall @ 2016-03-22  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

The following changes since commit 643ad15d47410d37d43daf3ef1c8ac52c281efa5:

  Merge branch 'mm-pkeys-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (2016-03-20 19:08:56 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git tags/kvm-arm-for-4.6-rc1

for you to fetch changes up to a6cdf1c08cbfe0818a3d8042844d75bf74fd82bd:

  kvm: arm64: Disable compiler instrumentation for hypervisor code (2016-03-21 14:02:17 +0100)

----------------------------------------------------------------
KVM/ARM Changes for v4.6-rc1

Second round of patches for v4.6-rc1, fixing a small handful of issue:
 - disable preemption when calling smp_call_function_many
 - Make kvm_ksym_ref work on VHE systems again after KASRL breakage
 - Disable compiler instrumentation for hypervisor code that could make
   KVM/arm64 blow up.

----------------------------------------------------------------
Catalin Marinas (1):
      kvm: arm64: Disable compiler instrumentation for hypervisor code

Eric Auger (1):
      KVM: arm/arm64: disable preemption when calling smp_call_function_many

Marc Zyngier (1):
      arm64: KVM: Turn kvm_ksym_ref into a NOP on VHE

 arch/arm/kvm/arm.c               | 2 ++
 arch/arm64/include/asm/kvm_asm.h | 8 +++++++-
 arch/arm64/kvm/hyp/Makefile      | 4 ++++
 3 files changed, 13 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PULL 1/3] KVM: arm/arm64: disable preemption when calling smp_call_function_many
  2016-03-22  8:19 [PULL 0/3] KVM/ARM Fixes for v4.6-rc1 Christoffer Dall
@ 2016-03-22  8:19 ` Christoffer Dall
  2016-03-22  8:19 ` [PULL 2/3] arm64: KVM: Turn kvm_ksym_ref into a NOP on VHE Christoffer Dall
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Christoffer Dall @ 2016-03-22  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

From: Eric Auger <eric.auger@linaro.org>

Preemption must be disabled when calling smp_call_function_many

Reported-by: bartosz.wawrzyniak at tieto.com
Signed-off-by: Eric Auger <eric.auger@linaro.org>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 arch/arm/kvm/arm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 3e0fb66..6accd66 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -373,7 +373,9 @@ static void exit_vm_noop(void *info)
 
 void force_vm_exit(const cpumask_t *mask)
 {
+	preempt_disable();
 	smp_call_function_many(mask, exit_vm_noop, NULL, true);
+	preempt_enable();
 }
 
 /**
-- 
2.1.2.330.g565301e.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 2/3] arm64: KVM: Turn kvm_ksym_ref into a NOP on VHE
  2016-03-22  8:19 [PULL 0/3] KVM/ARM Fixes for v4.6-rc1 Christoffer Dall
  2016-03-22  8:19 ` [PULL 1/3] KVM: arm/arm64: disable preemption when calling smp_call_function_many Christoffer Dall
@ 2016-03-22  8:19 ` Christoffer Dall
  2016-03-22  8:19 ` [PULL 3/3] kvm: arm64: Disable compiler instrumentation for hypervisor code Christoffer Dall
  2016-03-22 10:48 ` [PULL 0/3] KVM/ARM Fixes for v4.6-rc1 Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Christoffer Dall @ 2016-03-22  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

From: Marc Zyngier <marc.zyngier@arm.com>

When running with VHE, there is no need to translate kernel pointers
to the EL2 memory space, since we're already there (and we have a much
saner memory map to start with).

Unfortunately, kvm_ksym_ref is getting in the way, and the first
call into the "hypervisor" section is going to end up in fireworks,
since we're now branching into nowhereland. Meh.

A potential solution is to test if VHE is engaged or not, and only
perform the translation in the negative case. With this in place,
VHE is able to run again.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 arch/arm64/include/asm/kvm_asm.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
index 226f49d..eb7490d 100644
--- a/arch/arm64/include/asm/kvm_asm.h
+++ b/arch/arm64/include/asm/kvm_asm.h
@@ -26,7 +26,13 @@
 #define KVM_ARM64_DEBUG_DIRTY_SHIFT	0
 #define KVM_ARM64_DEBUG_DIRTY		(1 << KVM_ARM64_DEBUG_DIRTY_SHIFT)
 
-#define kvm_ksym_ref(sym)		phys_to_virt((u64)&sym - kimage_voffset)
+#define kvm_ksym_ref(sym)						\
+	({								\
+		void *val = &sym;					\
+		if (!is_kernel_in_hyp_mode())				\
+			val = phys_to_virt((u64)&sym - kimage_voffset);	\
+		val;							\
+	 })
 
 #ifndef __ASSEMBLY__
 struct kvm;
-- 
2.1.2.330.g565301e.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 3/3] kvm: arm64: Disable compiler instrumentation for hypervisor code
  2016-03-22  8:19 [PULL 0/3] KVM/ARM Fixes for v4.6-rc1 Christoffer Dall
  2016-03-22  8:19 ` [PULL 1/3] KVM: arm/arm64: disable preemption when calling smp_call_function_many Christoffer Dall
  2016-03-22  8:19 ` [PULL 2/3] arm64: KVM: Turn kvm_ksym_ref into a NOP on VHE Christoffer Dall
@ 2016-03-22  8:19 ` Christoffer Dall
  2016-03-22 10:48 ` [PULL 0/3] KVM/ARM Fixes for v4.6-rc1 Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Christoffer Dall @ 2016-03-22  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

From: Catalin Marinas <catalin.marinas@arm.com>

With the recent rewrite of the arm64 KVM hypervisor code in C, enabling
certain options like KASAN would allow the compiler to generate memory
accesses or function calls to addresses not mapped at EL2. This patch
disables the compiler instrumentation on the arm64 hypervisor code for
gcov-based profiling (GCOV_KERNEL), undefined behaviour sanity checker
(UBSAN) and kernel address sanitizer (KASAN).

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: <stable@vger.kernel.org> # 4.5+
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 arch/arm64/kvm/hyp/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/kvm/hyp/Makefile b/arch/arm64/kvm/hyp/Makefile
index b6a8fc5..778d0ef 100644
--- a/arch/arm64/kvm/hyp/Makefile
+++ b/arch/arm64/kvm/hyp/Makefile
@@ -16,3 +16,7 @@ obj-$(CONFIG_KVM_ARM_HOST) += fpsimd.o
 obj-$(CONFIG_KVM_ARM_HOST) += tlb.o
 obj-$(CONFIG_KVM_ARM_HOST) += hyp-entry.o
 obj-$(CONFIG_KVM_ARM_HOST) += s2-setup.o
+
+GCOV_PROFILE	:= n
+KASAN_SANITIZE	:= n
+UBSAN_SANITIZE	:= n
-- 
2.1.2.330.g565301e.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 0/3] KVM/ARM Fixes for v4.6-rc1
  2016-03-22  8:19 [PULL 0/3] KVM/ARM Fixes for v4.6-rc1 Christoffer Dall
                   ` (2 preceding siblings ...)
  2016-03-22  8:19 ` [PULL 3/3] kvm: arm64: Disable compiler instrumentation for hypervisor code Christoffer Dall
@ 2016-03-22 10:48 ` Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2016-03-22 10:48 UTC (permalink / raw)
  To: linux-arm-kernel



On 22/03/2016 09:19, Christoffer Dall wrote:
> The following changes since commit 643ad15d47410d37d43daf3ef1c8ac52c281efa5:
> 
>   Merge branch 'mm-pkeys-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (2016-03-20 19:08:56 -0700)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git tags/kvm-arm-for-4.6-rc1
> 
> for you to fetch changes up to a6cdf1c08cbfe0818a3d8042844d75bf74fd82bd:
> 
>   kvm: arm64: Disable compiler instrumentation for hypervisor code (2016-03-21 14:02:17 +0100)
> 
> ----------------------------------------------------------------
> KVM/ARM Changes for v4.6-rc1
> 
> Second round of patches for v4.6-rc1, fixing a small handful of issue:
>  - disable preemption when calling smp_call_function_many
>  - Make kvm_ksym_ref work on VHE systems again after KASRL breakage
>  - Disable compiler instrumentation for hypervisor code that could make
>    KVM/arm64 blow up.
> 
> ----------------------------------------------------------------
> Catalin Marinas (1):
>       kvm: arm64: Disable compiler instrumentation for hypervisor code
> 
> Eric Auger (1):
>       KVM: arm/arm64: disable preemption when calling smp_call_function_many
> 
> Marc Zyngier (1):
>       arm64: KVM: Turn kvm_ksym_ref into a NOP on VHE
> 
>  arch/arm/kvm/arm.c               | 2 ++
>  arch/arm64/include/asm/kvm_asm.h | 8 +++++++-
>  arch/arm64/kvm/hyp/Makefile      | 4 ++++
>  3 files changed, 13 insertions(+), 1 deletion(-)
> 

Pulled, thanks.

Paolo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-22 10:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22  8:19 [PULL 0/3] KVM/ARM Fixes for v4.6-rc1 Christoffer Dall
2016-03-22  8:19 ` [PULL 1/3] KVM: arm/arm64: disable preemption when calling smp_call_function_many Christoffer Dall
2016-03-22  8:19 ` [PULL 2/3] arm64: KVM: Turn kvm_ksym_ref into a NOP on VHE Christoffer Dall
2016-03-22  8:19 ` [PULL 3/3] kvm: arm64: Disable compiler instrumentation for hypervisor code Christoffer Dall
2016-03-22 10:48 ` [PULL 0/3] KVM/ARM Fixes for v4.6-rc1 Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).