From patchwork Wed Mar 9 12:22:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 63715 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2613923lbc; Wed, 9 Mar 2016 04:22:51 -0800 (PST) X-Received: by 10.98.72.8 with SMTP id v8mr39915863pfa.33.1457526171062; Wed, 09 Mar 2016 04:22:51 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3si4123710pap.198.2016.03.09.04.22.50; Wed, 09 Mar 2016 04:22:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932487AbcCIMWo (ORCPT + 30 others); Wed, 9 Mar 2016 07:22:44 -0500 Received: from foss.arm.com ([217.140.101.70]:39884 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932411AbcCIMWa (ORCPT ); Wed, 9 Mar 2016 07:22:30 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 39BF549; Wed, 9 Mar 2016 04:21:31 -0800 (PST) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DBBD33F25E; Wed, 9 Mar 2016 04:22:28 -0800 (PST) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Steven Rostedt Cc: Sudeep Holla , Ingo Molnar Subject: [PATCH -next] tracepoint: ipi: don't trace IPI on offline CPUs Date: Wed, 9 Mar 2016 12:22:22 +0000 Message-Id: <1457526142-31923-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tracepoints use RCU for protection and they must not be called on offline CPUS. So make this tracepoint conditional. Otherwise it can produce the following warning: -- 1.9.1 Tested-by: Sudeep Holla =============================== [ INFO: suspicious RCU usage. ] 4.5.0-rc7-next-20160308 #44 Not tainted ------------------------------- include/trace/events/ipi.h:35 suspicious rcu_dereference_check() usage! other info that might help us debug this: RCU used illegally from offline CPU! rcu_scheduler_active = 1, debug_locks = 1 no locks held by swapper/3/0. stack backtrace: CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.5.0-rc7-next-20160308 #44 Hardware name: ARM Juno development board (r2) (DT) Call trace: dump_backtrace+0x0/0x218 show_stack+0x24/0x30 dump_stack+0xb4/0xf0 lockdep_rcu_suspicious+0xd0/0x118 smp_cross_call+0x1a8/0x1b0 arch_send_call_function_single_ipi+0x3c/0x48 generic_exec_single+0xc0/0x178 smp_call_function_single+0xec/0x1b8 cpuhp_report_idle_dead+0x70/0x88 cpu_startup_entry+0x358/0x3c0 secondary_start_kernel+0x190/0x1e8 Cc: Steven Rostedt Cc: Ingo Molnar Signed-off-by: Sudeep Holla --- include/trace/events/ipi.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Hi Steven, I observed that in "include/linux/tracepoint.h", we have #define __DO_TRACE(tp, proto, args, cond, prercu, postrcu) ... if (!cpu_online(raw_smp_processor_id())) return; if (!(cond)) return; ... where !cond check seems reduntant if it's cpu_online check. So, does this patch handle the warning correctly or is there any better way ? I did see few traces with same condition, just thought of checking with you. Regards, Sudeep diff --git a/include/trace/events/ipi.h b/include/trace/events/ipi.h index 834a7362a610..d8ca2f2e24ac 100644 --- a/include/trace/events/ipi.h +++ b/include/trace/events/ipi.h @@ -15,12 +15,14 @@ * It is necessary for @reason to be a static string declared with * __tracepoint_string. */ -TRACE_EVENT(ipi_raise, +TRACE_EVENT_CONDITION(ipi_raise, TP_PROTO(const struct cpumask *mask, const char *reason), TP_ARGS(mask, reason), + TP_CONDITION(cpu_online(raw_smp_processor_id())), + TP_STRUCT__entry( __bitmask(target_cpus, nr_cpumask_bits) __field(const char *, reason)