From patchwork Tue Aug 5 09:24:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 4676731 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D34C89F373 for ; Tue, 5 Aug 2014 09:27:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1984420166 for ; Tue, 5 Aug 2014 09:27:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3EEA220160 for ; Tue, 5 Aug 2014 09:27:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEazs-0002D5-Gz; Tue, 05 Aug 2014 09:25:32 +0000 Received: from mail-pd0-f180.google.com ([209.85.192.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEazY-0000rM-CM for linux-arm-kernel@lists.infradead.org; Tue, 05 Aug 2014 09:25:16 +0000 Received: by mail-pd0-f180.google.com with SMTP id y13so1017397pdi.25 for ; Tue, 05 Aug 2014 02:24:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9YTotRUPG5jFwcnx+OVkQ2oVI7w9D3A2S+JPGyNrsD4=; b=dsozcSXyOWmmNIijsniVlu+UScWYaQVkrv+2mUp8CLRgRR0Y2+F+lI6pQW2aUTh5HZ 9ALe/egPaT8f1t5jyb7AwayGyk/Ja9UoIk/kQX9MzcBM1BOw0KPIUXNAizVRVvhakSLm 5XZM+kzL4b3vmdNNB8F2HWUlIG9y7Rsienf9KqGu89jHS1kSA0zGGhqOK3LX75KSjl8F iCg2T1RGnBOe3JRDrz2PRiOhgTrlc7EoyFXj8IBX7lcssug6Gtkr9xk0+ANgdU3NBkTe dZpusHTqz8JDDu9ZcQsX2nkzQW0kx9iNxbctfz8XcxIJfGkSE6TL7puE8uVCXfcJI+jk 0eoA== X-Gm-Message-State: ALoCoQnfbzJttQ7DRXRwrAdJJTkg2pZoaRBDwxZCcpCDO1FVCmcR33QY+ZyDE8RmtkQf5gYnspS6 X-Received: by 10.70.89.43 with SMTP id bl11mr2332285pdb.163.1407230691625; Tue, 05 Aug 2014 02:24:51 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id ho7sm4434486pad.9.2014.08.05.02.24.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Aug 2014 02:24:50 -0700 (PDT) From: Anup Patel To: kvmarm@lists.cs.columbia.edu 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> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1407230655-28864-1-git-send-email-anup.patel@linaro.org> References: <1407230655-28864-1-git-send-email-anup.patel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140805_022512_461289_546166E8 X-CRM114-Status: GOOD ( 10.88 ) X-Spam-Score: -1.4 (-) Cc: ian.campbell@citrix.com, kvm@vger.kernel.org, Anup Patel , marc.zyngier@arm.com, patches@apm.com, will.deacon@arm.com, linux-arm-kernel@lists.infradead.org, christoffer.dall@linaro.org, pranavkumar@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);