From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anup Patel Subject: [RFC PATCH 3/6] ARM: perf: Re-enable overflow interrupt from interrupt handler Date: Tue, 5 Aug 2014 14:54:12 +0530 Message-ID: <1407230655-28864-4-git-send-email-anup.patel@linaro.org> References: <1407230655-28864-1-git-send-email-anup.patel@linaro.org> Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, patches@apm.com, marc.zyngier@arm.com, christoffer.dall@linaro.org, will.deacon@arm.com, ian.campbell@citrix.com, pranavkumar@linaro.org, Anup Patel To: kvmarm@lists.cs.columbia.edu Return-path: Received: from mail-pd0-f173.google.com ([209.85.192.173]:57946 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932987AbaHEJYw (ORCPT ); Tue, 5 Aug 2014 05:24:52 -0400 Received: by mail-pd0-f173.google.com with SMTP id w10so1028241pde.4 for ; Tue, 05 Aug 2014 02:24:51 -0700 (PDT) In-Reply-To: <1407230655-28864-1-git-send-email-anup.patel@linaro.org> Sender: kvm-owner@vger.kernel.org List-ID: 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 Signed-off-by: Anup Patel --- arch/arm/kernel/perf_event_v7.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c index 1d37568..581cca5 100644 --- a/arch/arm/kernel/perf_event_v7.c +++ b/arch/arm/kernel/perf_event_v7.c @@ -1355,6 +1355,14 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev) if (!armv7_pmnc_counter_has_overflowed(pmnc, 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. + */ + armv7_pmnc_enable_intens(idx); + hwc = &event->hw; armpmu_event_update(event); perf_sample_data_init(&data, 0, hwc->last_period); -- 1.7.9.5