From patchwork Wed Jan 21 17:03:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 5679631 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DA7239F4DC for ; Wed, 21 Jan 2015 17:07:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D693320497 for ; Wed, 21 Jan 2015 17:07:38 +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 E31F420412 for ; Wed, 21 Jan 2015 17:07:37 +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 1YDyiz-0000Lj-Qu; Wed, 21 Jan 2015 17:05:49 +0000 Received: from mail-wg0-f48.google.com ([74.125.82.48]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YDyhZ-00076s-QJ for linux-arm-kernel@lists.infradead.org; Wed, 21 Jan 2015 17:04:22 +0000 Received: by mail-wg0-f48.google.com with SMTP id x12so12515269wgg.7 for ; Wed, 21 Jan 2015 09:03:59 -0800 (PST) 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=3+wkQTLV9LY3cHU78hyQ7M+HFNn5LAQexHyKRn6WKPY=; b=UxJ6fYrvMBr1FZR2BPrAfnIlMo2ZAekYZFz6nYiBjMDlGiRIKViz7GdHVdzZXEJNWM fblHXM0dn2dMOHY9tSi0n4D5a+SIOrgx20+fIHz4fHqvHNh5GgRVbCDReMnCKt57loE2 xDqCam+bNmuOKPp+O7UjHY42ohhK6I9m6FdoZU+643zY6USPnieyZSdZ2eohjGNAeMRS L3jLO3J6qQWyIuhfTftwkzg9sNlNAJh+9R+uXp2HfhrX0l4xsnYoY8J3M/aL2YAhdR8C oj6gPN3DuaYKfN4AGKtfVc4MyB3GGItVaap/V3XCZ1h6ID3TE8FJove3GJRLtGBALWtm 5sWA== X-Gm-Message-State: ALoCoQnxipY2maRcfL53d9uDDcHrSmXsuAZATVxlUWiS2zIUxoeTtjv6axTFTkRUq4MDysPezxdx X-Received: by 10.194.22.6 with SMTP id z6mr81647564wje.55.1421859839649; Wed, 21 Jan 2015 09:03:59 -0800 (PST) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id w16sm8021260wia.15.2015.01.21.09.03.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jan 2015 09:03:58 -0800 (PST) From: Daniel Thompson To: Thomas Gleixner , Jason Cooper , Russell King Subject: [RFC PATCH v2 5/5] arm: perf: Use FIQ to handle PMU events. Date: Wed, 21 Jan 2015 17:03:42 +0000 Message-Id: <1421859822-3621-6-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1421859822-3621-1-git-send-email-daniel.thompson@linaro.org> References: <1421166931-14134-1-git-send-email-daniel.thompson@linaro.org> <1421859822-3621-1-git-send-email-daniel.thompson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150121_090422_038181_E8DF05DC X-CRM114-Status: GOOD ( 12.53 ) X-Spam-Score: -0.7 (/) Cc: Daniel Thompson , linaro-kernel@lists.linaro.org, patches@linaro.org, Will Deacon , Stephen Boyd , linux-kernel@vger.kernel.org, Daniel Drake , Dmitry Pervushin , Dirk Behme , John Stultz , Tim Sander , Sumit Semwal , linux-arm-kernel@lists.infradead.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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 Using FIQ (if it is available) gives perf a better insight into the system by allowing code run with interrupts disabled to be profiled. Signed-off-by: Daniel Thompson --- arch/arm/include/asm/pmu.h | 2 ++ arch/arm/kernel/perf_event.c | 2 +- arch/arm/kernel/perf_event_cpu.c | 14 +++++++++++--- arch/arm/kernel/traps.c | 4 ++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h index b1596bd59129..e6c87e393547 100644 --- a/arch/arm/include/asm/pmu.h +++ b/arch/arm/include/asm/pmu.h @@ -123,6 +123,8 @@ struct arm_pmu { extern const struct dev_pm_ops armpmu_dev_pm_ops; +irqreturn_t armpmu_dispatch_irq(int irq, void *dev); + int armpmu_register(struct arm_pmu *armpmu, int type); u64 armpmu_event_update(struct perf_event *event); diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index f7c65adaa428..5ae9adf7f18e 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c @@ -296,7 +296,7 @@ validate_group(struct perf_event *event) return 0; } -static irqreturn_t armpmu_dispatch_irq(int irq, void *dev) +irqreturn_t armpmu_dispatch_irq(int irq, void *dev) { struct arm_pmu *armpmu; struct platform_device *plat_device; diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c index b30a2645c2f1..e5c9c5d607ab 100644 --- a/arch/arm/kernel/perf_event_cpu.c +++ b/arch/arm/kernel/perf_event_cpu.c @@ -177,9 +177,17 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler) continue; } - err = request_irq(irq, handler, - IRQF_NOBALANCING | IRQF_NO_THREAD, "arm-pmu", - per_cpu_ptr(&hw_events->percpu_pmu, i)); + err = request_irq( + irq, handler, + IRQF_NOBALANCING | IRQF_NMI, + "arm-pmu", per_cpu_ptr(&hw_events->percpu_pmu, i)); + if (err) { + err = request_irq( + irq, handler, + IRQF_NOBALANCING | IRQF_NO_THREAD, + "arm-pmu", + per_cpu_ptr(&hw_events->percpu_pmu, i)); + } if (err) { pr_err("unable to request IRQ%d for ARM PMU counters\n", irq); diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 445fdf26b1af..a5ffddeb224e 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -39,6 +39,7 @@ #include #include #include +#include static const char *handler[]= { @@ -466,6 +467,9 @@ die_sig: int arch_filter_nmi_handler(irq_handler_t handler) { irq_handler_t whitelist[] = { +#ifdef CONFIG_HW_PERF_EVENTS + armpmu_dispatch_irq, +#endif }; int i;