Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

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

 



* Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx> wrote:

> Signed-off-by: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
> ---
>  arch/x86/events/intel/pt.c        | 75 +++++++++++++++++++++++++++++++++------
>  arch/x86/events/intel/pt.h        |  2 ++
>  arch/x86/include/asm/perf_event.h |  4 +++
>  arch/x86/kvm/vmx.c                |  4 +++
>  4 files changed, 74 insertions(+), 11 deletions(-)

> +void intel_pt_vmx(int on)
> +{
> +	struct pt *pt = this_cpu_ptr(&pt_ctx);
> +	struct perf_event *event;
> +	unsigned long flags;
> +
> +	/* PT plays nice with VMX, do nothing */
> +	if (pt_pmu.vmx)
> +		return;
> +
> +	/*
> +	 * VMXON will clear RTIT_CTL.TraceEn; we need to make
> +	 * sure to not try to set it while VMX is on. Disable
> +	 * interrupts to avoid racing with pmu callbacks;
> +	 * concurrent PMI should be handled fine.
> +	 */
> +	local_irq_save(flags);
> +	WRITE_ONCE(pt->vmx_on, on);
> +
> +	if (on) {
> +		/* prevent pt_config_stop() from writing RTIT_CTL */
> +		event = pt->handle.event;
> +		if (event)
> +			event->hw.config = 0;
> +	}
> +	local_irq_restore(flags);
> +}
> +EXPORT_SYMBOL_GPL(intel_pt_vmx);

> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -3075,6 +3075,8 @@ static __init int vmx_disabled_by_bios(void)
>  
>  static void kvm_cpu_vmxon(u64 addr)
>  {
> +	intel_pt_vmx(1);
> +
>  	asm volatile (ASM_VMX_VMXON_RAX
>  			: : "a"(&addr), "m"(addr)
>  			: "memory", "cc");
> @@ -3144,6 +3146,8 @@ static void vmclear_local_loaded_vmcss(void)
>  static void kvm_cpu_vmxoff(void)
>  {
>  	asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc");
> +
> +	intel_pt_vmx(0);
>  }

Yeah so the name intel_pt_vmx() is pretty information-free because it has no verb, 
only nouns - please name new functions descriptively to after what they do!

Something like intel_pt_set_vmx_state() or so?

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux