Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3815826img; Mon, 25 Mar 2019 19:20:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBoW0Fw0zN315PZ9XHJx58YL0uqUM1WPhXNPDtxFPNMcqwlCFISERv9cHJdWPc1vQ0MBEZ X-Received: by 2002:aa7:8589:: with SMTP id w9mr27230628pfn.97.1553566812974; Mon, 25 Mar 2019 19:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553566812; cv=none; d=google.com; s=arc-20160816; b=BlkEfD1E+gkHznnTJzYO9kKnDC2D2kOthJfgdBApBDXLsMsNd92zQ8Zai6QnKdKezp ZHvmZHednWPR9030nFVF4zUVdBnNwVz8cwpobbNpMcDyUcfrExqv3Lz71sX+/VWmDMov 9avh8EZF0wqQcwCwR1JflvJQFLaebDMAXlR49WGFOTsQzlBGythfU4cwAyNKd9STMqj7 +JwHloJqTf5vJdBpMnVszvr1gbBkSYzXGbCkbEuMola8zFrUjDTY+JeGdQRgp2KoCXMU WqQorqA6wgKr0rp9s318w65EFT9PY6JAzYyARTjBhHqTwxFxl7pfzpkf8yaEDnO1GeUT 08Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=QDEGxFnB71lOe0LhAKMYcn2C7DukjGu2LGKrY1BRhGw=; b=ASGxXaMxihDBvjXfWzyezU0mvUWsTQ2EsO87R1qkFynxjBihxagnWD5IaayRWW/zMs h+f2+91zOFANozZGI1CCiSK7klmH79YMgxJQ3pvy9te3e0dHOc+HiWDJ91NWyAh9jx9u iz36irDILmm6V8MTEXBAjxuYJHwSVGfY7glJSS3jokB6D80ddsAlYN19xpR+FteSRJdE JV5XSlZwB42Yvay3da6ZPSXpZBo2F4FZA3QSaUQoqwvIGxmIgz3CoRzh5GRGe5NyyciD Wvoks3BUZ0rKDlKCmwRsogukpDwQM/rocdVKaGECaJEr1QQfXXHRhRtswChtrCZm+ZqE z1gQ== 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 n79si14954350pfb.133.2019.03.25.19.19.58; Mon, 25 Mar 2019 19:20:12 -0700 (PDT) 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 S1731004AbfCZCRv (ORCPT + 99 others); Mon, 25 Mar 2019 22:17:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:35770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730691AbfCZCRv (ORCPT ); Mon, 25 Mar 2019 22:17:51 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4811220823; Tue, 26 Mar 2019 02:17:49 +0000 (UTC) Date: Mon, 25 Mar 2019 22:17:45 -0400 From: Steven Rostedt To: Yafang Shao Cc: mingo@redhat.com, peterz@infradead.org, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, joel@joelfernandes.org, shaoyafang@didiglobal.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/3] tracing: introduce TRACE_EVENT_NONE and use it Message-ID: <20190325221745.1009cbdf@oasis.local.home> In-Reply-To: <1553564407-1162-1-git-send-email-laoar.shao@gmail.com> References: <1553564407-1162-1-git-send-email-laoar.shao@gmail.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 26 Mar 2019 09:40:04 +0800 Yafang Shao wrote: > In this patchset, I introduce a new macro TRACE_EVENT_NONE(), which will > define a tracepoint as a do-nothing inline function. > #define TRACE_EVENT_NONE(name, proto) \ > static inline void trace_##name(proto) \ > { } \ > static inline bool trace_##name##_enabled(void) \ > { \ > return false; \ > } > BTW, I prefer a name of TRACE_EVENT_DISABLED() Which shows that it is disabled, or TRACE_EVENT_UNDEF(), or TRACE_EVENT_NOP(). Something that states it is turned off. When I first saw NONE() I thought it was another attempt to introduce zero parameter trace events. > Let's take some example for why this macro is needed. > > - sched > The tracepoints trace_sched_stat_{iowait, blocked, wait, sleep} should > be not exposed to user if CONFIG_SCHEDSTATS is not set. > We can place #ifdef in the kernel/sched/fair.c to fix it, but we > don't want to sprinkle #ifdef. But you still sprinkle #ifdef in the header, but the part I don't like is the need to duplicate the prototypes and the like. > So with TRACE_EVENT_NONE(), we can fix it in > include/trace/events/sched.h. > > - rcu > When CONFIG_RCU_TRACE is not set, some rcu tracepoints are define as > do-nothing macro without validating arguments, that is not proper. > We should validate the arguments. > > Yafang Shao (3): > tracing: introduce TRACE_EVENT_NONE() > sched/fair: do not expose some tracepoints to user if > CONFIG_SCHEDSTATS is not set > rcu: validate arguments for rcu tracepoints > See my reply in the next patch. -- Steve