Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4205956img; Tue, 26 Mar 2019 05:14:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4Il4tEi8DpZxeNcOVB6fjVANL4BGohkMD3UFv9Gh3/F5E7pw1DJftkSTVEuGlgLJmmk5w X-Received: by 2002:a17:902:b788:: with SMTP id e8mr20537562pls.339.1553602477726; Tue, 26 Mar 2019 05:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553602477; cv=none; d=google.com; s=arc-20160816; b=LEIPAz4k4q4vfvZRJbdnxdrMdrg9JM4bSPPRES9yV/WXztnqRW2TQcnN84uZiC6PSa ZscnfIL4rmOW+OoA1KQ7bjoKNGxBUXs/UnqRv6AG7VaQSEKe16gMqHRBulR5n/O/skdF SQ1174mT9FQ/f9JbH3cmgAJsOGLIJ8Eth8eDj+qsRX8NMxiyX4Pi3t0K6xuGraFzFCpB lI6EHexpgP02yB7iBbYAfKQ19FruZItM/vVMpCZoTiVJotyzL4LWzunI/8oswTMqBoA4 uycIUTNtEt6VP9ntCb8C4aFmK2TuBR3ttElCZllTJInkvna6kEzzb4S7Pj8lLGp6P2FF ocYw== 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 :dkim-signature; bh=ZM4LeWXagDRpn4M/V2GVbYkaDTDMCPoOWYr2RZh5CsI=; b=aBkygpRP9ZKhE8KM7+SP2WnKhnPNOFFYTzdJyEe15XKsKXeTYnbJhgFv2q4zWyEehL GVsyazFl+HGrEdYDgJsuWdl2YDRjXQFGt+k6eIUjPagXmd5l90/SMWvjTPUA9lIbyUR0 ho7mMyhVwOnTJoDTECSIKwjIGbLbfs4+BlClTfP51k7Ugcw4IT06P/MJmq7tDwxKYAeQ eBTXrKvExkltpZ+XKF/87trCmfL2GpBdPOXRtwghVrnzqHdW9HKJp98eIdT/+vmSZV3X OFb4ulbKL7Ji5wFHHKC0bVIqFP38SwH40Y2FRuYCMzJPUZ6l3O3Q8OagXL1JAQDCj9f+ fckg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OT3b9mNP; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bg8si16131189plb.109.2019.03.26.05.14.22; Tue, 26 Mar 2019 05:14:37 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OT3b9mNP; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729440AbfCZMNn (ORCPT + 99 others); Tue, 26 Mar 2019 08:13:43 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41599 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726175AbfCZMNm (ORCPT ); Tue, 26 Mar 2019 08:13:42 -0400 Received: by mail-pf1-f196.google.com with SMTP id 188so2540233pfd.8 for ; Tue, 26 Mar 2019 05:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ZM4LeWXagDRpn4M/V2GVbYkaDTDMCPoOWYr2RZh5CsI=; b=OT3b9mNPXzlYofSBA6jIMFYWAfnmUJ0JmiUdyf1DS4lq40J2pb55BaNpWETU2F4Cqf jTSBXDDTzetchWoiFHjuHMGw0RatrYFRQpu0PQVjJKSpxuqA1ZMH+et3DADne9z3ohRk iYlOwIXHzw6Yz/sB/YxmNAyFWkAxPH3H+/zrooxiYdFPeqb9wdhlMjES/WL5cPLKXLeQ T/GOI70cOlrO/rQCv9GXQZC54mcrdZHTUZKtqzJgMhrTVeJhmf6T4H2RSwqNLnCItiNn UJl5C6R2nwoWLDR+0KiNzI705s+Ur8pZMGB+AFuOR71onM8hlVxxE5Av9h3RNu5yoNqW BkHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZM4LeWXagDRpn4M/V2GVbYkaDTDMCPoOWYr2RZh5CsI=; b=CVWuO5t8fTCdoTBytODxR7dVcVpIxfv8tVZl7hzyWg3FumkaYn6gJq9yrWHAtwyVEF s9csqkx1U1A1hgzf/IcX/d38S2YFTx07M8c4pVRgM5jw48Q6QGrLNV9Al8PI2FGKvlU/ bGG8dFzlMs6mCyuQzfDMIKqlPPm1YTCHHvJriiDmgaWYaVS8cuPUR5zFaZs7oFk/49bW BRKS3J4fkPXkVWL98Xc3qwp5h2FTmqf8YPZ/HE7pzZWBn8Bx7k21j1/AzYxGVmyEmxRF k6uF8K6x+W5mR89B2tL8YGPi4VFnevR3LO20RWvlXljFs1CjXKVhYO/1CCII3j24nEeR /Wwg== X-Gm-Message-State: APjAAAWB/MiL3qCmYMGRnNOptExH0+0eq7mGLqxqcjRdi1HiNLJnJKoq KzfkaD9HYM135OIhN8pMSjA= X-Received: by 2002:a65:5b47:: with SMTP id y7mr28569320pgr.449.1553602422358; Tue, 26 Mar 2019 05:13:42 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id e2sm31263881pfa.64.2019.03.26.05.13.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 05:13:41 -0700 (PDT) From: Yafang Shao To: rostedt@goodmis.org Cc: mingo@redhat.com, peterz@infradead.org, paulmck@linux.ibm.com, josh@joshtriplett.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, joel@joelfernandes.org, linux-kernel@vger.kernel.org, shaoyafang@didiglobal.com, Yafang Shao Subject: [PATCH v2 0/3] tracing: introduce TRACE_EVENT_NOP and use it Date: Tue, 26 Mar 2019 20:13:08 +0800 Message-Id: <1553602391-11926-1-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In this patchset, I introduce some new macros TRACE_EVENT_NOP, DEFINE_EVENT_NOP and DECLARE_EVENT_CLASS_NOP, which will define a tracepoint as do-nothing inline function. #define DECLARE_EVENT_NOP(name, proto) \ static inline void trace_##name(proto) \ { } \ static inline bool trace_##name##_enabled(void) \ { \ return false; \ } Let's take some examples for why these macros are needed. - sched The tracepoints trace_sched_stat_{iowait, blocked, wait, sleep} should be not exposed to user if CONFIG_SCHEDSTATS is not set. - rcu When CONFIG_RCU_TRACE is not set, some rcu tracepoints are defined as do-nothing macro without validating arguments, that is not proper. We should validate the arguments. Yafang Shao (3): tracing: introduce TRACE_EVENT_NOP() sched/fair: do not expose some tracepoints to user if CONFIG_SCHEDSTATS is not set rcu: validate arguments for rcu tracepoints include/linux/tracepoint.h | 15 ++++++++ include/trace/define_trace.h | 8 +++++ include/trace/events/rcu.h | 81 ++++++++++++++------------------------------ include/trace/events/sched.h | 21 ++++++++---- kernel/rcu/rcu.h | 9 ++--- kernel/rcu/tree.c | 8 ++--- 6 files changed, 68 insertions(+), 74 deletions(-) -- 1.8.3.1