From patchwork Mon Jun 23 08:30:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 32338 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1F5EC20540 for ; Mon, 23 Jun 2014 09:04:19 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id rq2sf24775096pbb.10 for ; Mon, 23 Jun 2014 02:04:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=yK3y+BpsGpdSloAOXHmGfk8KLnfbgjwacmXwt+nMG0w=; b=l7YWHjWw4IXURMQfknt1AbJnIEe+ebGavD8k06FWwzA8uoME+txVESUpgZ4w7t8pQz uisDQ3wGrA4RtfLN3N2YP1ypovy4Yt/QKcjFa49+UxDH7Z2plno2nDf3czPg2M5nchV8 HdHnv4sGj+avWtqLrYt3ZHCJ5fSWFqH1NI0hXuexiFB8iFbb4KP549WQYdF2uzzu750C Ub6E7Zgu06FWWu7djPhFgqMNvWvVGI1SkesaOM9eGs58qPyRiIu4w48GPHGFq6YFHEhK vcLstIOndKuA4jpeDVQmpyCi/LWvqJ7MYzT0mZFbk2mZWNFYhMVCU/JYDZta8fiKJrzF DfLQ== X-Gm-Message-State: ALoCoQkOzoxW+RIYACJj9bk87Yd694X7vFUnCEb45Y1E09lHABusD5Kt909CsWi0/24fOhyLIXW5 X-Received: by 10.67.4.202 with SMTP id cg10mr9163948pad.42.1403514258462; Mon, 23 Jun 2014 02:04:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.16.173 with SMTP id 42ls1832244qgb.62.gmail; Mon, 23 Jun 2014 02:04:18 -0700 (PDT) X-Received: by 10.52.24.68 with SMTP id s4mr4838930vdf.37.1403514258361; Mon, 23 Jun 2014 02:04:18 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id yd5si8626281vec.100.2014.06.23.02.04.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 02:04:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.179 as permitted sender) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id sa20so5757363veb.24 for ; Mon, 23 Jun 2014 02:04:18 -0700 (PDT) X-Received: by 10.58.187.19 with SMTP id fo19mr57307vec.45.1403514258251; Mon, 23 Jun 2014 02:04:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp115845vcb; Mon, 23 Jun 2014 02:04:17 -0700 (PDT) X-Received: by 10.66.192.73 with SMTP id he9mr27436555pac.88.1403514257391; Mon, 23 Jun 2014 02:04:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ka6si20890462pbc.153.2014.06.23.02.04.16; Mon, 23 Jun 2014 02:04:16 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754861AbaFWJEP (ORCPT + 9 others); Mon, 23 Jun 2014 05:04:15 -0400 Received: from ip4-83-240-18-248.cust.nbox.cz ([83.240.18.248]:55466 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752445AbaFWIc2 (ORCPT ); Mon, 23 Jun 2014 04:32:28 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.80.1) (envelope-from ) id 1Wyzfu-0003Hr-LE; Mon, 23 Jun 2014 10:32:26 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Will Deacon , Jiri Slaby Subject: [PATCH 3.12 013/111] ARM: perf: hook up perf_sample_event_took around pmu irq handling Date: Mon, 23 Jun 2014 10:30:48 +0200 Message-Id: <22259d1fa4111413d7969bae6ad425fbc7fcf3e1.1403512281.git.jslaby@suse.cz> X-Mailer: git-send-email 2.0.0 In-Reply-To: <55d5f044a1fc96a74e4470e318c0a24f27a9ab7e.1403512280.git.jslaby@suse.cz> References: <55d5f044a1fc96a74e4470e318c0a24f27a9ab7e.1403512280.git.jslaby@suse.cz> In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linux-kernel-owner@vger.kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Will Deacon 3.12-stable review patch. If anyone has any objections, please let me know. =============== commit 5f5092e72cc25a6a5785308270e0085b2b2772cc upstream. Since we indirect all of our PMU IRQ handling through a dispatcher, it's trivial to hook up perf_sample_event_took to prevent applications such as oprofile from generating interrupt storms due to an unrealisticly low sample period. Reported-by: Robert Richter Signed-off-by: Will Deacon Signed-off-by: Jiri Slaby --- arch/arm/kernel/perf_event.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index e186ee1e63f6..de5cd767e4df 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c @@ -303,11 +303,18 @@ static irqreturn_t armpmu_dispatch_irq(int irq, void *dev) struct arm_pmu *armpmu = (struct arm_pmu *) dev; struct platform_device *plat_device = armpmu->plat_device; struct arm_pmu_platdata *plat = dev_get_platdata(&plat_device->dev); + int ret; + u64 start_clock, finish_clock; + start_clock = sched_clock(); if (plat && plat->handle_irq) - return plat->handle_irq(irq, dev, armpmu->handle_irq); + ret = plat->handle_irq(irq, dev, armpmu->handle_irq); else - return armpmu->handle_irq(irq, dev); + ret = armpmu->handle_irq(irq, dev); + finish_clock = sched_clock(); + + perf_sample_event_took(finish_clock - start_clock); + return ret; } static void