Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1377706

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

From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON
Date 2016-04-13 12:00 +0200
Message-ID <rnpKy-7Mh-9@gated-at.bofh.it> (permalink)
References <rja7p-70D-41@gated-at.bofh.it> <rkRtD-1en-7@gated-at.bofh.it> <rkTF7-2Y2-1@gated-at.bofh.it> <rkUhQ-3fx-3@gated-at.bofh.it> <rkWjD-52m-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* Alexander Shishkin <alexander.shishkin@linux.intel.com> wrote:

> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> ---
>  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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON Peter Zijlstra <peterz@infradead.org> - 2016-04-06 11:00 +0200
  Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-04-06 13:20 +0200
    Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON Peter Zijlstra <peterz@infradead.org> - 2016-04-06 14:00 +0200
      Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON Borislav Petkov <bp@alien8.de> - 2016-04-06 14:00 +0200
        Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-04-06 14:20 +0200
      Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-04-06 16:10 +0200
        Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON Ingo Molnar <mingo@kernel.org> - 2016-04-13 12:00 +0200
          Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-04-13 12:40 +0200
            Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON Ingo Molnar <mingo@kernel.org> - 2016-04-13 13:00 +0200
              Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-04-13 15:50 +0200

csiph-web