All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Gleb Natapov <gleb@kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	x86@kernel.org, kvm@vger.kernel.org,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, tglx@linutronix.de, hpa@zytor.com,
	Arnaldo Carvalho de Melo <acme@infradead.org>
Subject: Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON
Date: Wed, 6 Apr 2016 10:52:27 +0200	[thread overview]
Message-ID: <20160406085227.GO3448@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1459527854-5899-1-git-send-email-alexander.shishkin@linux.intel.com>

On Fri, Apr 01, 2016 at 07:24:14PM +0300, Alexander Shishkin wrote:
> +static void pt_config_stop(struct perf_event *event)
>  {
> +	u64 ctl = READ_ONCE(event->hw.config);
>  
> +	/* may be already stopped by a PMI*/
> +	if (!(ctl & RTIT_CTL_TRACEEN))
> +		return;
> +
> +	ctl ^= RTIT_CTL_TRACEEN;

Would that not be much less confusing when written like |= ?

>  	wrmsrl(MSR_IA32_RTIT_CTL, ctl);
>  
> +	WRITE_ONCE(event->hw.config, ctl);
> +
>  	/*
>  	 * A wrmsr that disables trace generation serializes other PT
>  	 * registers and causes all data packets to be written to memory,


> +void intel_pt_vmxon(int entry)
> +{
> +	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;
> +
> +	/*
> +	 * VMX entry 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, entry);

So you mix: "VMX is on" and "VMX entry", please pick one.

Since the function is called vmxon, I find .entry a very confusing
argument name.

> +
> +	if (entry) {
> +		/* 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_vmxon);

  reply	other threads:[~2016-04-06  8:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 16:24 [PATCH] perf/x86/intel/pt: Don't die on VMXON Alexander Shishkin
2016-04-06  8:52 ` Peter Zijlstra [this message]
2016-04-06 11:10   ` Alexander Shishkin
2016-04-06 11:52     ` Peter Zijlstra
2016-04-06 11:55       ` Borislav Petkov
2016-04-06 12:07         ` Alexander Shishkin
2016-04-06 12:07           ` Alexander Shishkin
2016-04-06 14:06       ` Alexander Shishkin
2016-04-13  9:49         ` Ingo Molnar
2016-04-13 10:32           ` Alexander Shishkin
2016-04-13 10:53             ` Ingo Molnar
2016-04-13 13:48               ` Alexander Shishkin
2016-04-28 10:25                 ` [tip:perf/core] " tip-bot for Alexander Shishkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160406085227.GO3448@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@infradead.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=gleb@kernel.org \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.