Re: [PATCH 1/2] KVM: arm64: Move pmu hyp code under hyp's Makefile to avoid instrumentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi James,

On 21/05/2019 18:25, James Morse wrote:
> KVM's pmu.c contains the __hyp_text needed to switch the pmu registers
> between host and guest. Because this isn't covered by the 'hyp' Makefile,
> it can be built with kasan and friends when these are enabled in Kconfig.
> 
> When starting a guest, this results in:
> | Kernel panic - not syncing: HYP panic:
> | PS:a00003c9 PC:000083000028ada0 ESR:86000007
> | FAR:000083000028ada0 HPFAR:0000000029df5300 PAR:0000000000000000
> | VCPU:000000004e10b7d6
> | CPU: 0 PID: 3088 Comm: qemu-system-aar Not tainted 5.2.0-rc1 #11026
> | Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Plat
> | Call trace:
> |  dump_backtrace+0x0/0x200
> |  show_stack+0x20/0x30
> |  dump_stack+0xec/0x158
> |  panic+0x1ec/0x420
> |  panic+0x0/0x420
> | SMP: stopping secondary CPUs
> | Kernel Offset: disabled
> | CPU features: 0x002,25006082
> | Memory Limit: none
> | ---[ end Kernel panic - not syncing: HYP panic:
> 
> This is caused by functions in pmu.c calling the instrumented
> code, which isn't mapped to hyp. From objdump -r:
> | RELOCATION RECORDS FOR [.hyp.text]:
> | OFFSET           TYPE              VALUE
> | 0000000000000010 R_AARCH64_CALL26  __sanitizer_cov_trace_pc
> | 0000000000000018 R_AARCH64_CALL26  __asan_load4_noabort
> | 0000000000000024 R_AARCH64_CALL26  __asan_load4_noabort
> 
> Move the affected code to a new file under 'hyp's Makefile.
> 
> Fixes: 3d91befbb3a0 ("arm64: KVM: Enable !VHE support for :G/:H perf event modifiers")
> Cc: Andrew Murray <Andrew.Murray@xxxxxxx>
> Signed-off-by: James Morse <james.morse@xxxxxxx>
> ---
>  arch/arm64/kvm/hyp/switch.c | 39 +++++++++++++++++++++++++++++++++++++
>  arch/arm64/kvm/pmu.c        | 38 ------------------------------------
>  2 files changed, 39 insertions(+), 38 deletions(-)
> 
> diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
> index 22b4c335e0b2..030c3fa28e0e 100644
> --- a/arch/arm64/kvm/hyp/switch.c
> +++ b/arch/arm64/kvm/hyp/switch.c
> @@ -16,6 +16,7 @@
>   */
>  
>  #include <linux/arm-smccc.h>
> +#include <linux/kvm_host.h>
>  #include <linux/types.h>
>  #include <linux/jump_label.h>
>  #include <uapi/linux/psci.h>
> @@ -703,3 +704,41 @@ void __hyp_text __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt)
>  
>  	unreachable();
>  }
> +
> +/**
> + * Disable host events, enable guest events
> + */
> +bool __hyp_text __pmu_switch_to_guest(struct kvm_cpu_context *host_ctxt)

I think this could now be made static, and the declarations removed from
asm/kvm_host.h.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux