All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: xen-devel@lists.xen.org, david.vrabel@citrix.com,
	JBeulich@suse.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 5/5] xen/PMU: Cache MSR accesses during interrupt handling
Date: Mon, 23 Sep 2013 09:29:03 -0400	[thread overview]
Message-ID: <20130923132903.GF3175@phenom.dumpdata.com> (raw)
In-Reply-To: <1378827110-4192-6-git-send-email-boris.ostrovsky@oracle.com>

On Tue, Sep 10, 2013 at 11:31:50AM -0400, Boris Ostrovsky wrote:
> Avoid trapping to hypervisor on each MSR access during interrupt handling.
> Instead, use cached MSR values provided in shared xenpmu_data by Xen. When
> handling is completed, flush the registers to hypervisor who will load them
> into HW.

Looks OK.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
>  arch/x86/xen/pmu.c             | 15 ++++++++++++++-
>  include/xen/interface/xenpmu.h |  1 +
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/xen/pmu.c b/arch/x86/xen/pmu.c
> index d8b059b..bdd7c4a 100644
> --- a/arch/x86/xen/pmu.c
> +++ b/arch/x86/xen/pmu.c
> @@ -345,14 +345,27 @@ static void xen_convert_regs(struct cpu_user_regs *xen_regs,
>  
>  irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id)
>  {
> -	int ret = IRQ_NONE;
> +	int err, ret = IRQ_NONE;
>  	struct pt_regs regs;
>  	struct xenpmu_data *xenpmu_data = per_cpu(xenpmu_shared,
>  						  smp_processor_id());
>  
> +	/*
> +	 * While handling the interrupt MSR accesses will be cached
> +	 * in PMU context
> +	 */
> +	xenpmu_data->pmu_flags |= PMU_CACHED;
>  	xen_convert_regs(&xenpmu_data->regs, &regs);
>  	if (x86_pmu.handle_irq(&regs))
>  		ret = IRQ_HANDLED;
> +	xenpmu_data->pmu_flags &= ~PMU_CACHED;
> +
> +	/* Write out cached context to HW */
> +	err = HYPERVISOR_xenpmu_op(XENPMU_flush, NULL);
> +	if (err) {
> +		WARN(1, "%s failed hypercall, err: %d\n", __func__, err);
> +		return IRQ_NONE;
> +	}
>  
>  	return ret;
>  }
> diff --git a/include/xen/interface/xenpmu.h b/include/xen/interface/xenpmu.h
> index 16fe1ab..ec0e802 100644
> --- a/include/xen/interface/xenpmu.h
> +++ b/include/xen/interface/xenpmu.h
> @@ -16,6 +16,7 @@
>  #define XENPMU_init            4
>  #define XENPMU_finish          5
>  #define XENPMU_lvtpc_set       6
> +#define XENPMU_flush           7 /* Write cached MSR values to HW */
>  
>  /* Parameter structure for HYPERVISOR_xenpmu_op call */
>  struct xenpmu_params {
> -- 
> 1.8.1.4
> 

  reply	other threads:[~2013-09-23 13:29 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-10 15:31 [PATCH v1 0/5] xen/PMU: PMU support for Xen PV guests Boris Ostrovsky
2013-09-10 15:31 ` Boris Ostrovsky
2013-09-10 15:31 ` [PATCH v1 1/5] xen: xensyms support Boris Ostrovsky
2013-09-10 15:31   ` Boris Ostrovsky
2013-09-11  8:17   ` Jan Beulich
2013-09-11  8:17   ` Jan Beulich
2013-09-10 15:31 ` [PATCH v1 2/5] xen/PMU: Sysfs interface for setting Xen PMU mode Boris Ostrovsky
2013-09-23 13:17   ` Konrad Rzeszutek Wilk
2013-09-23 14:05     ` Boris Ostrovsky
2013-09-23 14:05     ` Boris Ostrovsky
2013-09-23 13:17   ` Konrad Rzeszutek Wilk
2013-09-10 15:31 ` Boris Ostrovsky
2013-09-10 15:31 ` [PATCH v1 3/5] xen/PMU: Initialization code for Xen PMU Boris Ostrovsky
2013-09-10 15:31   ` Boris Ostrovsky
2013-09-23 13:26   ` Konrad Rzeszutek Wilk
2013-09-23 14:18     ` Boris Ostrovsky
2013-09-23 14:25       ` [Xen-devel] " Boris Ostrovsky
2013-09-23 14:25       ` Boris Ostrovsky
2013-09-23 14:18     ` Boris Ostrovsky
2013-09-23 13:26   ` Konrad Rzeszutek Wilk
2013-09-10 15:31 ` [PATCH v1 4/5] xen/PMU: Add support for PMU registes on PV guests Boris Ostrovsky
2013-09-10 15:31   ` Boris Ostrovsky
2013-09-23 13:28   ` Konrad Rzeszutek Wilk
2013-09-23 13:28   ` Konrad Rzeszutek Wilk
2013-09-10 15:31 ` [PATCH v1 5/5] xen/PMU: Cache MSR accesses during interrupt handling Boris Ostrovsky
2013-09-23 13:29   ` Konrad Rzeszutek Wilk [this message]
2013-09-23 13:29   ` Konrad Rzeszutek Wilk
2013-09-10 15:31 ` Boris Ostrovsky
2013-09-11  9:33 ` [PATCH v1 0/5] xen/PMU: PMU support for Xen PV guests David Vrabel
2013-09-11  9:33 ` [Xen-devel] " David Vrabel
2013-09-11 14:26   ` Boris Ostrovsky
2013-09-11 14:26   ` Boris Ostrovsky

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=20130923132903.GF3175@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xen.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.