All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 2/6] ARM64: perf: Re-enable overflow interrupt from interrupt handler
Date: Thu, 7 Aug 2014 10:06:14 +0100	[thread overview]
Message-ID: <20140807090614.GD13703@arm.com> (raw)
In-Reply-To: <CALrVBkvJ0qQnsJS_DVfRNBoeLGEc7szHzx4AzOAF9e9voWOy2Q@mail.gmail.com>

On Thu, Aug 07, 2014 at 10:03:58AM +0100, Anup Patel wrote:
> On 6 August 2014 19:54, Will Deacon <will.deacon@arm.com> wrote:
> > On Tue, Aug 05, 2014 at 10:24:11AM +0100, Anup Patel wrote:
> >> A hypervisor will typically mask the overflow interrupt before
> >> forwarding it to Guest Linux hence we need to re-enable the overflow
> >> interrupt after clearing it in Guest Linux. Also, this re-enabling
> >> of overflow interrupt does not harm in non-virtualized scenarios.
> >>
> >> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> >> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> >> ---
> >>  arch/arm64/kernel/perf_event.c |    8 ++++++++
> >>  1 file changed, 8 insertions(+)
> >>
> >> diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
> >> index 47dfb8b..19fb140 100644
> >> --- a/arch/arm64/kernel/perf_event.c
> >> +++ b/arch/arm64/kernel/perf_event.c
> >> @@ -1076,6 +1076,14 @@ static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)
> >>               if (!armv8pmu_counter_has_overflowed(pmovsr, idx))
> >>                       continue;
> >>
> >> +             /*
> >> +              * If we are running under a hypervisor such as KVM then
> >> +              * hypervisor will mask the interrupt before forwarding
> >> +              * it to Guest Linux hence re-enable interrupt for the
> >> +              * overflowed counter.
> >> +              */
> >> +             armv8pmu_enable_intens(idx);
> >> +
> >
> > Really? This is a giant bodge in the guest to work around short-comings in
> > the hypervisor. Why can't we fix this properly using something like Marc's
> > irq forwarding code?
> 
> This change is in accordance with our previous RFC thread about
> PMU virtualization where Marc Z had suggest to do interrupt
> mask/unmask dance similar to arch-timer.
> 
> I have not tried Marc'z irq forwarding series. In next revision of this
> patchset, I will try to use Marc's irq forwarding approach.

That would be good. Judging by the colour Marc went when he saw this patch,
I don't think he intended you to hack perf in this way :)

Will

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Anup Patel <anup.patel@linaro.org>
Cc: "kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"patches@apm.com" <patches@apm.com>,
	Marc Zyngier <Marc.Zyngier@arm.com>,
	"christoffer.dall@linaro.org" <christoffer.dall@linaro.org>,
	"ian.campbell@citrix.com" <ian.campbell@citrix.com>,
	"pranavkumar@linaro.org" <pranavkumar@linaro.org>
Subject: Re: [RFC PATCH 2/6] ARM64: perf: Re-enable overflow interrupt from interrupt handler
Date: Thu, 7 Aug 2014 10:06:14 +0100	[thread overview]
Message-ID: <20140807090614.GD13703@arm.com> (raw)
In-Reply-To: <CALrVBkvJ0qQnsJS_DVfRNBoeLGEc7szHzx4AzOAF9e9voWOy2Q@mail.gmail.com>

On Thu, Aug 07, 2014 at 10:03:58AM +0100, Anup Patel wrote:
> On 6 August 2014 19:54, Will Deacon <will.deacon@arm.com> wrote:
> > On Tue, Aug 05, 2014 at 10:24:11AM +0100, Anup Patel wrote:
> >> A hypervisor will typically mask the overflow interrupt before
> >> forwarding it to Guest Linux hence we need to re-enable the overflow
> >> interrupt after clearing it in Guest Linux. Also, this re-enabling
> >> of overflow interrupt does not harm in non-virtualized scenarios.
> >>
> >> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> >> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> >> ---
> >>  arch/arm64/kernel/perf_event.c |    8 ++++++++
> >>  1 file changed, 8 insertions(+)
> >>
> >> diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
> >> index 47dfb8b..19fb140 100644
> >> --- a/arch/arm64/kernel/perf_event.c
> >> +++ b/arch/arm64/kernel/perf_event.c
> >> @@ -1076,6 +1076,14 @@ static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)
> >>               if (!armv8pmu_counter_has_overflowed(pmovsr, idx))
> >>                       continue;
> >>
> >> +             /*
> >> +              * If we are running under a hypervisor such as KVM then
> >> +              * hypervisor will mask the interrupt before forwarding
> >> +              * it to Guest Linux hence re-enable interrupt for the
> >> +              * overflowed counter.
> >> +              */
> >> +             armv8pmu_enable_intens(idx);
> >> +
> >
> > Really? This is a giant bodge in the guest to work around short-comings in
> > the hypervisor. Why can't we fix this properly using something like Marc's
> > irq forwarding code?
> 
> This change is in accordance with our previous RFC thread about
> PMU virtualization where Marc Z had suggest to do interrupt
> mask/unmask dance similar to arch-timer.
> 
> I have not tried Marc'z irq forwarding series. In next revision of this
> patchset, I will try to use Marc's irq forwarding approach.

That would be good. Judging by the colour Marc went when he saw this patch,
I don't think he intended you to hack perf in this way :)

Will

  reply	other threads:[~2014-08-07  9:06 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05  9:24 [RFC PATCH 0/6] ARM64: KVM: PMU infrastructure support Anup Patel
2014-08-05  9:24 ` Anup Patel
2014-08-05  9:24 ` [RFC PATCH 1/6] ARM64: Move PMU register related defines to asm/pmu.h Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-05  9:24 ` [RFC PATCH 2/6] ARM64: perf: Re-enable overflow interrupt from interrupt handler Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-06 14:24   ` Will Deacon
2014-08-06 14:24     ` Will Deacon
2014-08-07  9:03     ` Anup Patel
2014-08-07  9:03       ` Anup Patel
2014-08-07  9:06       ` Will Deacon [this message]
2014-08-07  9:06         ` Will Deacon
2014-08-05  9:24 ` [RFC PATCH 3/6] ARM: " Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-05  9:24 ` [RFC PATCH 4/6] ARM/ARM64: KVM: Add common code PMU IRQ routing Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-05  9:24 ` [RFC PATCH 5/6] ARM64: KVM: Implement full context switch of PMU registers Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-05  9:24 ` [RFC PATCH 6/6] ARM64: KVM: Upgrade to lazy " Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-05  9:32 ` [RFC PATCH 0/6] ARM64: KVM: PMU infrastructure support Anup Patel
2014-08-05  9:32   ` Anup Patel
2014-08-05  9:35   ` Anup Patel
2014-08-05  9:35     ` Anup Patel
2014-11-07 20:23 ` Christoffer Dall
2014-11-07 20:23   ` Christoffer Dall
2014-11-07 20:25 ` Christoffer Dall
2014-11-07 20:25   ` Christoffer Dall
2014-11-08  9:36   ` Anup Patel
2014-11-08  9:36     ` Anup Patel
2014-11-08 12:39     ` Christoffer Dall
2014-11-08 12:39       ` Christoffer Dall
2014-11-11  9:18       ` Anup Patel
2014-11-11  9:18         ` Anup Patel
2014-11-18  3:24         ` Anup Patel
2014-11-18  3:24           ` Anup Patel
2014-11-19 15:29         ` Christoffer Dall
2014-11-19 15:29           ` Christoffer Dall
2014-11-20 14:47           ` Anup Patel
2014-11-20 14:47             ` Anup Patel
2014-11-21  9:59             ` Christoffer Dall
2014-11-21  9:59               ` Christoffer Dall
2014-11-21 10:36               ` Anup Patel
2014-11-21 10:36                 ` Anup Patel
2014-11-21 11:49                 ` Christoffer Dall
2014-11-21 11:49                   ` Christoffer Dall
2014-11-24  8:44                   ` Anup Patel
2014-11-24  8:44                     ` Anup Patel
2014-11-24 14:37                     ` Christoffer Dall
2014-11-24 14:37                       ` Christoffer Dall
2014-11-25 12:47                       ` Anup Patel
2014-11-25 12:47                         ` Anup Patel
2014-11-25 13:42                         ` Christoffer Dall
2014-11-25 13:42                           ` Christoffer Dall
2014-11-27 10:22                           ` Anup Patel
2014-11-27 10:22                             ` Anup Patel
2014-11-27 10:40                             ` Marc Zyngier
2014-11-27 10:40                               ` Marc Zyngier
2014-11-27 10:54                               ` Anup Patel
2014-11-27 10:54                                 ` Anup Patel
2014-11-27 11:06                                 ` Marc Zyngier
2014-11-27 11:06                                   ` Marc Zyngier
2014-12-30  5:49                                   ` Anup Patel
2014-12-30  5:49                                     ` Anup Patel
2015-01-08  4:02                                     ` Anup Patel
2015-01-08  4:02                                       ` Anup Patel
2015-01-11 19:11                                     ` Christoffer Dall
2015-01-11 19:11                                       ` Christoffer Dall
2015-01-12  4:19                                       ` Anup Patel
2015-01-12  4:19                                         ` Anup Patel
2015-02-15 15:33                                         ` Christoffer Dall
2015-02-15 15:33                                           ` Christoffer Dall
2015-02-16 12:16                                           ` Anup Patel
2015-02-16 12:16                                             ` Anup Patel
2015-02-16 12:23                                             ` Christoffer Dall
2015-02-16 12:23                                               ` Christoffer Dall
2015-01-14  4:28                                       ` Anup Patel
2015-01-14  4:28                                         ` Anup Patel

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=20140807090614.GD13703@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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.