From patchwork Mon Dec 4 09:46:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Bellasi X-Patchwork-Id: 120497 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4210591qgn; Mon, 4 Dec 2017 01:47:06 -0800 (PST) X-Google-Smtp-Source: AGs4zMb64CLngqdHQ9C7Ey/UVZVnm3lBbPsPJ8nFwjGGyC0nUFnFs5m3xD/ZGBkGq9X1q1dVv+LO X-Received: by 10.84.179.165 with SMTP id b34mr13882777plc.372.1512380826393; Mon, 04 Dec 2017 01:47:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512380826; cv=none; d=google.com; s=arc-20160816; b=qHm5OsOuHiC0QBEUYDa3M/guXSZfoi6HI1vy50ZZSfmzk9zunEII9AuSrNpBdAqMiU HXOkEzHh/omrr5yh2ZNxjdfZ/nBoqv3poA+65YSmKZJN1tCJxaWrW5+J9jSeng6/Vedf MewFi13tkNgDpb2cnSEh0ktF9fiS5p9j6FvGlOPm8iFjrILB5I/arRqNsnWIK7QERn/r /l4/OHmqCOMTvxMbrauh5XkVeD3CfAKi+nTQ4L5Ciz708zhtYgxbHoyt8uo+hjGgWGcx +jYxR8LHMvjq1kgk8eOkkJbqA+NMjDM9OJrMlJGA3J6XVVpybR3eqLvir+OJiOe5F5d6 uPwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Va03TIaelDr7Rd9ZSDB8yJRZhmsjd/3Gyge3NxrTxzo=; b=if8HN3kGua3xfEdKsXZBM5F0DFFycWubd/GJRLiE9hBJLbzzuo0CFLwlJSd40Odyry F9JI2Wwq9GqxBS9f9lyrVfOWbo8UK6U6Vs8dqHnnp+3zDuutgbjx8WnNMtDFptHzW6VC 9U9DEu19nF7KQ9i9cK3XVY+zzixOpqbkBcVzNn9FqaQaJ/wqJewQeVjFDsIBLSLBVZDv YvJavFeh6AQKWM67i0cuafmLqDfVNklUlsW/SOGxqjQ1V6+4nsXYA5lwOaGJZJDot9GB 0+dAc5+BRcIAXiA57M/YRTaqvH4WGUBkJ4Ld0gXU0CtOZJ2L8rgOBeUBhmNFmQ2m6snf pTLw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si9062939pgv.92.2017.12.04.01.47.06; Mon, 04 Dec 2017 01:47:06 -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 S1752698AbdLDJrE (ORCPT + 28 others); Mon, 4 Dec 2017 04:47:04 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:60826 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbdLDJrD (ORCPT ); Mon, 4 Dec 2017 04:47:03 -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 CD08F1435; Mon, 4 Dec 2017 01:47:02 -0800 (PST) Received: from e110439-lin.cambridge.arm.com (e110439-lin.cambridge.arm.com [10.1.210.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 52CC03F487; Mon, 4 Dec 2017 01:47:01 -0800 (PST) From: Patrick Bellasi To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Dietmar Eggemann , Joel Fernandes , Steven Rostedt , Linux-kernel@vger.kernel.org Subject: [PATCH] tracing: Fix trace_preempt_{on, off} for !CONFIG_DEBUG_PREEMPT builds Date: Mon, 4 Dec 2017 09:46:42 +0000 Message-Id: <20171204094642.6901-1-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.14.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new preempt enable/disable events introduced by: d59158162 tracing: Add support for preempt and irq enable/disable events are defined only for CONFIG_DEBUG_PREEMPT kernels when the CONFIG_PREEMPTIRQ_EVENTS support, introduced by the above patch, is enabled. These events are generated within by trace_preempt_{on,off} calls, which are part of the the "Preemption-off Latency Tracer" (CONFIG_PREEMPT_TRACER). Currently these calls are (correctly) generated on CONFIG_PREEMPT_TRACER even when the kernel is !CONFIG_DEBUG_PREEMPT configured. Thus leading to an undefined reference to the new trace events. Let's ensure that we always have an (eventually) empty definition of the events for CONFIG_PREEMPTIRQ_EVENTS kernels. This patch will ensure that the additional preempt enabled/disable events are generated only when we have both: CONFIG_PREEMPT_TRACER && CONFIG_DEBUG_PREEMPT Signed-off-by: Patrick Bellasi Reviewed-by: Dietmar Eggemann Reviewed-by: Alessio Balsini Cc: Steven Rostedt Cc: Ingo Molnar Cc: Joel Fernandes Cc: Linux-kernel@vger.kernel.org --- Fix kernel compilation for this configuration: !CONFIG_DEBUG_PREEMPT && CONFIG_PREEMPT_TRACER To reproduce, e.g. 1. make defconfig 2. add: CONFIG_PREEMPTIRQ_EVENTS=y CONFIG_PREEMPT_TRACER=y 3. make kernel/trace/trace_irqsoff.o For sake of consistency, this patch adds a default empty definition of all the new trace events whenever CONFIG_PREEMPTIRQ_EVENTS is enabled but the specific event's requirements are not satisfied. This is complementary to the default empty definitions provided for the !CONFIG_PREEMPTIRQ_EVENTS case. --- include/trace/events/preemptirq.h | 10 ++++++++++ kernel/trace/trace_irqsoff.c | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) -- 2.14.1 diff --git a/include/trace/events/preemptirq.h b/include/trace/events/preemptirq.h index f5024c560d8f..500ad0a221d5 100644 --- a/include/trace/events/preemptirq.h +++ b/include/trace/events/preemptirq.h @@ -40,6 +40,11 @@ DEFINE_EVENT(preemptirq_template, irq_disable, DEFINE_EVENT(preemptirq_template, irq_enable, TP_PROTO(unsigned long ip, unsigned long parent_ip), TP_ARGS(ip, parent_ip)); +#else +#define trace_irq_disable(...) +#define trace_irq_enable(...) +#define trace_irq_disable_rcuidle(...) +#define trace_irq_enable_rcuidle(...) #endif #ifdef CONFIG_DEBUG_PREEMPT @@ -50,6 +55,11 @@ DEFINE_EVENT(preemptirq_template, preempt_disable, DEFINE_EVENT(preemptirq_template, preempt_enable, TP_PROTO(unsigned long ip, unsigned long parent_ip), TP_ARGS(ip, parent_ip)); +#else +#define trace_preempt_disable(...) +#define trace_preempt_enable(...) +#define trace_preempt_disable_rcuidle(...) +#define trace_preempt_enable_rcuidle(...) #endif #endif /* _TRACE_PREEMPTIRQ_H */ diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index 03ecb4465ee4..9d62e5f30d58 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c @@ -848,8 +848,7 @@ inline void print_irqtrace_events(struct task_struct *curr) } #endif -#if defined(CONFIG_PREEMPT_TRACER) || \ - (defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_PREEMPTIRQ_EVENTS)) +#ifdef CONFIG_PREEMPT_TRACER void trace_preempt_on(unsigned long a0, unsigned long a1) { trace_preempt_enable_rcuidle(a0, a1);