From patchwork Fri Aug 8 14:32:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 35130 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8A5C621457 for ; Fri, 8 Aug 2014 14:37:43 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rp18sf22647333iec.0 for ; Fri, 08 Aug 2014 07:37:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:user-agent:date:from:to :cc:subject:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type :content-disposition; bh=fr5tnyCXwLZxV39F7qY3SUXXTTUOK+bhaG68Qi2rU30=; b=hhR8MyH7deehpZD2+uj/h9qGGFPt6vyfZhOApOi+RoFB1Xd95x0DJM9NE9wxULxubr iS3UQwE42GsbltC40/HKtO0r5p9kuZhV7tn5rI7UcJlUgLOfmm5FcvwpWAKd45+7jQuP xv66WLmxNM2uWxew0wTA983MSv3OXDfw10Wdx+zKGsAsu6h+xdifii9JFkXEmbwcsWCx Xn+vte5uB7puRKDOiX2jRupFUycpmUtGXxJBPbt3IR6HiiZhVdkNfutVhg7psyHRUZl1 hHdi+deOxD8UPzaMxREKBtDGz9G5qC3gTNNE3ufDvq4t0BizXqVohvo0XMbW6hFIxBwK kMgg== X-Gm-Message-State: ALoCoQnVrRQeotvuFipHjFh0M0GasrweTF8pEZKgBjfbs+DgYmClINtcLeAIj5kbZ7Ztq/iZ/QDR X-Received: by 10.182.68.17 with SMTP id r17mr12140581obt.26.1407508663121; Fri, 08 Aug 2014 07:37:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.80 with SMTP id s74ls574068qgs.64.gmail; Fri, 08 Aug 2014 07:37:43 -0700 (PDT) X-Received: by 10.221.38.4 with SMTP id tg4mr1838757vcb.44.1407508663004; Fri, 08 Aug 2014 07:37:43 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id q6si2945953veh.50.2014.08.08.07.37.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 08 Aug 2014 07:37:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id lf12so8395925vcb.15 for ; Fri, 08 Aug 2014 07:37:42 -0700 (PDT) X-Received: by 10.52.129.200 with SMTP id ny8mr6998267vdb.27.1407508662869; Fri, 08 Aug 2014 07:37:42 -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 tc5csp128224vcb; Fri, 8 Aug 2014 07:37:41 -0700 (PDT) X-Received: by 10.68.65.101 with SMTP id w5mr24353640pbs.5.1407508661238; Fri, 08 Aug 2014 07:37:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si2643916pdn.83.2014.08.08.07.37.40 for ; Fri, 08 Aug 2014 07:37:41 -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 S1757039AbaHHOhU (ORCPT + 26 others); Fri, 8 Aug 2014 10:37:20 -0400 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.228]:54149 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751321AbaHHOhM (ORCPT ); Fri, 8 Aug 2014 10:37:12 -0400 Received: from [67.246.153.56] ([67.246.153.56:52850] helo=gandalf.local.home) by cdptpa-oedge01 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 13/47-07811-690E4E35; Fri, 08 Aug 2014 14:37:11 +0000 Received: from rostedt by gandalf.local.home with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1XFlI6-000875-8w; Fri, 08 Aug 2014 10:37:10 -0400 Message-Id: <20140808143710.208630679@goodmis.org> User-Agent: quilt/0.61-1 Date: Fri, 08 Aug 2014 10:32:57 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Ingo Molnar , Andrew Morton , Nicolas Pitre , Will Deacon , Catalin Marinas , Russell King - ARM Linux , Daniel Lezcano Subject: [PATCH 3/4] ARM: add IPI tracepoints References: <20140808143254.145903999@goodmis.org> MIME-Version: 1.0 X-RR-Connecting-IP: 107.14.168.118:25 X-Cloudmark-Score: 0 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: rostedt@goodmis.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.220.170 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: , Content-Disposition: inline; filename=0003-ARM-add-IPI-tracepoints.patch From: Nicolas Pitre The strings used to list IPIs in /proc/interrupts are reused for tracing purposes. While at it, prevent a negative ipinr from escaping the range check in handle_IPI(). Link: http://lkml.kernel.org/p/1406318733-26754-4-git-send-email-nicolas.pitre@linaro.org Acked-by: Daniel Lezcano Signed-off-by: Nicolas Pitre Signed-off-by: Steven Rostedt --- arch/arm/kernel/smp.c | 70 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 7c4fada440f0..9388a3d479e1 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -47,6 +47,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include + /* * as from 2.5, kernels no longer have an init_tasks structure * so we need some other way of telling a new secondary core @@ -430,38 +433,15 @@ void __init smp_prepare_cpus(unsigned int max_cpus) } } -static void (*smp_cross_call)(const struct cpumask *, unsigned int); +static void (*__smp_cross_call)(const struct cpumask *, unsigned int); void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int)) { - if (!smp_cross_call) - smp_cross_call = fn; -} - -void arch_send_call_function_ipi_mask(const struct cpumask *mask) -{ - smp_cross_call(mask, IPI_CALL_FUNC); -} - -void arch_send_wakeup_ipi_mask(const struct cpumask *mask) -{ - smp_cross_call(mask, IPI_WAKEUP); -} - -void arch_send_call_function_single_ipi(int cpu) -{ - smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE); + if (!__smp_cross_call) + __smp_cross_call = fn; } -#ifdef CONFIG_IRQ_WORK -void arch_irq_work_raise(void) -{ - if (is_smp()) - smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK); -} -#endif - -static const char *ipi_types[NR_IPI] = { +static const char *ipi_types[NR_IPI] __tracepoint_string = { #define S(x,s) [x] = s S(IPI_WAKEUP, "CPU wakeup interrupts"), S(IPI_TIMER, "Timer broadcast interrupts"), @@ -473,6 +453,12 @@ static const char *ipi_types[NR_IPI] = { S(IPI_COMPLETION, "completion interrupts"), }; +static void smp_cross_call(const struct cpumask *target, unsigned int ipinr) +{ + trace_ipi_raise(target, ipi_types[ipinr]); + __smp_cross_call(target, ipinr); +} + void show_ipi_list(struct seq_file *p, int prec) { unsigned int cpu, i; @@ -499,6 +485,29 @@ u64 smp_irq_stat_cpu(unsigned int cpu) return sum; } +void arch_send_call_function_ipi_mask(const struct cpumask *mask) +{ + smp_cross_call(mask, IPI_CALL_FUNC); +} + +void arch_send_wakeup_ipi_mask(const struct cpumask *mask) +{ + smp_cross_call(mask, IPI_WAKEUP); +} + +void arch_send_call_function_single_ipi(int cpu) +{ + smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE); +} + +#ifdef CONFIG_IRQ_WORK +void arch_irq_work_raise(void) +{ + if (is_smp()) + smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK); +} +#endif + #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST void tick_broadcast(const struct cpumask *mask) { @@ -556,8 +565,10 @@ void handle_IPI(int ipinr, struct pt_regs *regs) unsigned int cpu = smp_processor_id(); struct pt_regs *old_regs = set_irq_regs(regs); - if (ipinr < NR_IPI) + if ((unsigned)ipinr < NR_IPI) { + trace_ipi_entry(ipi_types[ipinr]); __inc_irq_stat(cpu, ipi_irqs[ipinr]); + } switch (ipinr) { case IPI_WAKEUP: @@ -612,6 +623,9 @@ void handle_IPI(int ipinr, struct pt_regs *regs) cpu, ipinr); break; } + + if ((unsigned)ipinr < NR_IPI) + trace_ipi_exit(ipi_types[ipinr]); set_irq_regs(old_regs); }