Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3794610img; Mon, 25 Mar 2019 18:41:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgyaWsC5lgaY4h5HBn7V+lVMyOzRDFcxTGPXa08tpxXvdzkUa0HW/bt5+ApQ/NWgxiPD3w X-Received: by 2002:aa7:93a5:: with SMTP id x5mr10327296pff.234.1553564480837; Mon, 25 Mar 2019 18:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553564480; cv=none; d=google.com; s=arc-20160816; b=kP/hdbAU5DrKSjb0hK70KpqjV/wSw9QOJJiJkRRYBWYLiNAM2kxgFNkL4kDsiblJJC tNRAXvDTUSN5iyxq2GTmmoJK+/8fHIGM2ZUzZEFfxthJYgk6Flt1o+5JPP55vC0kB5sP tEzc0Y14hLaHL3xsik/A5hKOjz7mY7NO/YWZaXsIZ8g7MbECV6L9BxK7RmLAn/1H0di7 IMOYEq3W+6FNWBUFTnGydy5dYXil4kmXzYsODZxbcX8Y98znXXVnET9Btxy6jDLst0L1 bdiX4aboKlXWZq+p9/1J7dUoIXV3NhRWS1f8l6hFJXmiiojtm9hTrtffOR6QRxadjP7Q GwCQ== 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=rN6an6BcrzqEETtbILhlhfnULtpHxjgScagIw1RjWdY=; b=enNVnySgQtH914X9P69vC1DBCZkvejxWX2Zg2XU4jebk22eI9klezVBmVCQvdvbVqr YJ35HmMEnuEHhi6OO7SBibPo52EOAxo6yetOmx1aQkdBz1cFFeMs1YSrW+RUlj4hZWl/ yDS+OuzhIHnhGx7PAwNUpSomPfrZJycY6/RFqp6CfUIeNC1WsLhCtHH6OASqCBV5X7e4 4dpEmnrHPPg9PA+wjhzqEv2cLGBuDmyCTz2ClzeLQOy9w0YUCrJoVkbSNuvIDA6KkpJ4 VQDitN3PbIpf8eWsRRZ5prUOvP70d4xSCuGy0MNvIyyn9ImS0qWWUc4Z1alPoc2q1Exn O6Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DJ3UrwKE; 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 n25si14524397pgv.283.2019.03.25.18.41.05; Mon, 25 Mar 2019 18:41:20 -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=DJ3UrwKE; 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 S1730757AbfCZBkY (ORCPT + 99 others); Mon, 25 Mar 2019 21:40:24 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:34379 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727506AbfCZBkY (ORCPT ); Mon, 25 Mar 2019 21:40:24 -0400 Received: by mail-pl1-f193.google.com with SMTP id y6so822581plt.1 for ; Mon, 25 Mar 2019 18:40:23 -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=rN6an6BcrzqEETtbILhlhfnULtpHxjgScagIw1RjWdY=; b=DJ3UrwKErDUDYEwQ+5qW/vyHnRUkzXOLHvDGPzVZOBpZygLIwqbd6ffjlh6aWoHABr SgCatwXW6FHiRSwNKE0sbwH7TU8ycdGhvHmRlUhsQeSQiFxZGnxsQqrYxKydxJL99CmA WWD4Ip2Mr3NZzTcZnu8tFMo7HGqqUDt2t9A46QrEx+FyiWUeQuocFOifxabXjIOBckEG FYic90pe4dKQQKhpLD4pVM+tiG64EYAC6AnLJpsliDrVzdc5q12trM02qXy64D9M5AAU ayX5GQMorTeeBqNmj/G+jWQ3Kp/gBFj/RH5WwxtidrQY8lY260UZI+JS7Ng0Q2D7o+4j 6S3Q== 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=rN6an6BcrzqEETtbILhlhfnULtpHxjgScagIw1RjWdY=; b=V64KiEhn+YZ6QTjcScytxd02xCbFrauJc8xqpz5pCg3tXP5eQHSdGYfok1t7i6BUBM EySisYECuoKuI8ueG3XX7gH5ddIbWkn3Vw12Co45JhogP2BfkiCvzYEyEx1lHCr5arHX 5a+eq4blrVo2I6scxK5WBP8BmE90Pc3w+0khK90RNdCbZS5tpAMdMYkKZYJ9rE/pJNpW GZGhooOgQWfd66B1nEjflwER2DmYPMK2jDxwveC3RJj2IYf9jhw615c39IfMYwBVPrZ9 qpKWkzTaeDuq/XlWjvZ5WOw35YGN6awK+4WpPY2g5Px1Jcvc6YAvmY9g9UddWAONPc81 Jvcg== X-Gm-Message-State: APjAAAXUB2cJ43icUPBBJXSm0rYSIUE8ue8iBQBIXT9CpGflBaf73tFT 5BX3Huy7kJVVXK5t/WWJjbU= X-Received: by 2002:a17:902:7610:: with SMTP id k16mr28726439pll.215.1553564423616; Mon, 25 Mar 2019 18:40:23 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id m7sm41464119pgg.62.2019.03.25.18.40.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 18:40:22 -0700 (PDT) From: Yafang Shao To: rostedt@goodmis.org, mingo@redhat.com, peterz@infradead.org, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, joel@joelfernandes.org Cc: shaoyafang@didiglobal.com, linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH 0/3] tracing: introduce TRACE_EVENT_NONE and use it Date: Tue, 26 Mar 2019 09:40:04 +0800 Message-Id: <1553564407-1162-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 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; \ } 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. 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 include/linux/tracepoint.h | 8 +++++ include/trace/define_trace.h | 4 +++ include/trace/events/rcu.h | 84 ++++++++++++++++++++++++++++---------------- include/trace/events/sched.h | 14 ++++++++ kernel/rcu/rcu.h | 9 ++--- kernel/rcu/tree.c | 8 ++--- 6 files changed, 86 insertions(+), 41 deletions(-) -- 1.8.3.1