From nobody Mon Mar 23 21:23:18 2026 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 896643BD25E for ; Mon, 23 Mar 2026 16:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774281684; cv=none; b=jAHy02rlrgh4xUhU+rAcGYB9BnF72r7d7+c6aAJpgWOinHymc81+XMSl2S/nFkVyl6falYiH11NQMqLkpgh7fDfdsnuuMhKhDbaxiEqbsM8EEI7yaUE8ACA9onzuElh2hZOLVM7sp/21nu6he8NjCi7mxWklMfINqKJavjRBpyQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774281684; c=relaxed/simple; bh=0DPJh0DJ3iDimFvMQsoeZlDl8P4qbc82fRy/khoEFVk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WhuS3ZOC0R/dECY2riZ1R1OT7yKSQRsQ+0coxN8lPh0KsPZZYftBzo62B+xqJnbujeBtMl6ZhTnRs6vJIsdqVBgdMXYUFOpWKFgq4x9AGyzm0avbYtcj7UsV1h9n36d85t5Ce327LUBgdnX/XvslJFED1g1u9/6WYykPKxC6dhg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bitbyteword.org; spf=pass smtp.mailfrom=bitbyteword.org; dkim=pass (2048-bit key) header.d=bitbyteword.org header.i=@bitbyteword.org header.b=d/p7OssV; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bitbyteword.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bitbyteword.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bitbyteword.org header.i=@bitbyteword.org header.b="d/p7OssV" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-35b98def50bso3131419a91.0 for ; Mon, 23 Mar 2026 09:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bitbyteword.org; s=google; t=1774281682; x=1774886482; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eViZzzv8Sc/M5QSGBQX9CwMHZ/34uumJnzvDlBpaGpc=; b=d/p7OssVJT0YuiaYN+bIeT4edJ2+JHZEHNRPYBVl8deeAayWuSb6xeuolV32K/hlG4 UCl3cOhn0ndSX9VpNQmJXqxWRTKLHBsuPjCZk3RZXKzZ4EaGnViwQB6Wg9gpez0wyooY tKxq8IB6okGYTuZLLW1sWJrOsKZyzMxNx04k6yMYlrff4QWHFXN6YAFwBMQmpy3qUxxZ 9W8RiuF00NHje7Y5cQhKw2UfFzbWEoELGddC7SiSsOHMWXJb7vY3mXx85u11BERZzkGy SZsKV5DkWl3KwMIewhXTtCgNKSnorTvnYHv4l84l56A9FIDPRQ9G0cH52LlZO5fWTrZq idtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774281682; x=1774886482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eViZzzv8Sc/M5QSGBQX9CwMHZ/34uumJnzvDlBpaGpc=; b=acLgJeSR+6FxvXZtbC563LTv99KWFdgQ2xUjFVokl6+7YwbEASF3yyycqT/iDn7F3u 0NQjuloHkBoNxrGIY5pYoIs5k0xUTbnk+FB4ux06j80JLLxOrCguw0pCpt8qtP/dpaSf iY0TfCzgldbmlQ9VTkbmkLVYYf0f6Ns/hgae1OinzmcLHZgbY1SSMXCTm5daIfUZpaa5 S6YmeR99PmJmLLnkwQEVzteWlOl7PIWZcN/xfGyj2KPzZY412tagUoGWWzQuuWAabmFR MU1/kPwzRcyVt490x5PJ4onulE7/5qDh0g5hFWJ4xChEhqwzhasC3QrZUZqd0/DrbV5p bE0w== X-Forwarded-Encrypted: i=1; AJvYcCVZltAU8cwsWIF64pgnDlrXiRNUHjF57Ye6k90ZM+XajLQTz7xrXgxJXnzefdxksFXC4LVR40b6e4A1/MU=@vger.kernel.org X-Gm-Message-State: AOJu0YzUGZtGjtZbVs9akNzHIYUIckNh/UGQfkh3SIODvuPzvl0RyqtN 1TlGJVEu+TxzQoqfT5x/8OsIujKL/x6ELfq3xrIBoq7raypFNrFgKl0o6M59Q7eZJPM9UTyZ+xw zs0UqBOFSYg== X-Gm-Gg: ATEYQzyww4L7FNpiSZ6kLXvomplGOYN9VdnJWM6DzC15rRmqHA0SKsbryhBYzvov5w5 omT2tWxkfmnpK/EHdXpfYv9GxRg5LsL4yQ4mCiyymshmTjlxt8Szw1DGQjtS3t8dHLWHOmAXYgR +LH1ARFLpDogZk3W0vUIkwefPyKPptERcYAwCd74TpS4ccweAydUCuNLaqNPre+jbVzcCp4+Dn4 tI4Am3zB5DnkQK1uiplZvNCNzN5eGC33UDtUyNfMclyvljlFj3IMSBOBCW7M6apLJPhg/rolXUc crxK+7k2noBP96HpEnLDVNJxIaIfhk+mw6VBcW5BNs/tydjChglxWUlj6RR6p94lX6PxAxtp4QY VfnnyBrDGS7l2CvXG9xFR1A09ZGZP+KLnYKpCuHnzxpfyfN/YY+62Cy0zZYmmYA+l0jdjdW6xpA npFBszBDPak783JmpEohXlPFJ/Qc7Ik/yXiySb0IHpa52xMWJ39d9NrCdPGtXqMgp6fw== X-Received: by 2002:a05:620a:198a:b0:8cd:8d4c:aa0c with SMTP id af79cd13be357-8cfc7a796e7mr1828317285a.0.1774281661473; Mon, 23 Mar 2026 09:01:01 -0700 (PDT) Received: from vinmini.lan (c-73-143-21-186.hsd1.vt.comcast.net. [73.143.21.186]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8cfc9088df1sm843364185a.25.2026.03.23.09.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2026 09:01:00 -0700 (PDT) From: "Vineeth Pillai (Google)" To: Steven Rostedt , Peter Zijlstra , Dmitry Ilvokhin Cc: "Vineeth Pillai (Google)" , Masami Hiramatsu , Mathieu Desnoyers , Ingo Molnar , Jens Axboe , io-uring@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Marcelo Ricardo Leitner , Xin Long , Jon Maloy , Aaron Conole , Eelco Chaudron , Ilya Maximets , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-sctp@vger.kernel.org, tipc-discussion@lists.sourceforge.net, dev@openvswitch.org, Jiri Pirko , Oded Gabbay , Koby Elbaz , dri-devel@lists.freedesktop.org, "Rafael J. Wysocki" , Viresh Kumar , "Gautham R. Shenoy" , Huang Rui , Mario Limonciello , Len Brown , Srinivas Pandruvada , linux-pm@vger.kernel.org, MyungJoo Ham , Kyungmin Park , Chanwoo Choi , =?UTF-8?q?Christian=20K=C3=B6nig?= , Sumit Semwal , linaro-mm-sig@lists.linaro.org, Eddie James , Andrew Jeffery , Joel Stanley , linux-fsi@lists.ozlabs.org, David Airlie , Simona Vetter , Alex Deucher , Danilo Krummrich , Matthew Brost , Philipp Stanner , Harry Wentland , Leo Li , amd-gfx@lists.freedesktop.org, Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, Wolfram Sang , linux-i2c@vger.kernel.org, Mark Brown , Michael Hennerich , =?UTF-8?q?Nuno=20S=C3=A1?= , linux-spi@vger.kernel.org, "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, Chris Mason , David Sterba , linux-btrfs@vger.kernel.org, Thomas Gleixner , Andrew Morton , SeongJae Park , linux-mm@kvack.org, Borislav Petkov , Dave Hansen , x86@kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 01/19] tracepoint: Add trace_call__##name() API Date: Mon, 23 Mar 2026 12:00:20 -0400 Message-ID: <20260323160052.17528-2-vineeth@bitbyteword.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323160052.17528-1-vineeth@bitbyteword.org> References: <20260323160052.17528-1-vineeth@bitbyteword.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add trace_call__##name() as a companion to trace_##name(). When a caller already guards a tracepoint with an explicit enabled check: if (trace_foo_enabled() && cond) trace_foo(args); trace_foo() internally repeats the static_branch_unlikely() test, which the compiler cannot fold since static branches are patched binary instructions. This results in two static-branch evaluations for every guarded call site. trace_call__##name() calls __do_trace_##name() directly, skipping the redundant static-branch re-check. This avoids leaking the internal __do_trace_##name() symbol into call sites while still eliminating the double evaluation: if (trace_foo_enabled() && cond) trace_invoke_foo(args); /* calls __do_trace_foo() directly */ Three locations are updated: - __DECLARE_TRACE: invoke form omits static_branch_unlikely, retains the LOCKDEP RCU-watching assertion. - __DECLARE_TRACE_SYSCALL: same, plus retains might_fault(). - !TRACEPOINTS_ENABLED stub: empty no-op so callers compile cleanly when tracepoints are compiled out. Suggested-by: Steven Rostedt Suggested-by: Peter Zijlstra Signed-off-by: Vineeth Pillai (Google) Assisted-by: Claude:claude-sonnet-4-6 --- include/linux/tracepoint.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 22ca1c8b54f32..ed969705341f1 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -294,6 +294,10 @@ static inline struct tracepoint *tracepoint_ptr_deref(= tracepoint_ptr_t *p) WARN_ONCE(!rcu_is_watching(), \ "RCU not watching for tracepoint"); \ } \ + } \ + static inline void trace_call__##name(proto) \ + { \ + __do_trace_##name(args); \ } =20 #define __DECLARE_TRACE_SYSCALL(name, proto, args, data_proto) \ @@ -313,6 +317,11 @@ static inline struct tracepoint *tracepoint_ptr_deref(= tracepoint_ptr_t *p) WARN_ONCE(!rcu_is_watching(), \ "RCU not watching for tracepoint"); \ } \ + } \ + static inline void trace_call__##name(proto) \ + { \ + might_fault(); \ + __do_trace_##name(args); \ } =20 /* @@ -398,6 +407,8 @@ static inline struct tracepoint *tracepoint_ptr_deref(t= racepoint_ptr_t *p) #define __DECLARE_TRACE_COMMON(name, proto, args, data_proto) \ static inline void trace_##name(proto) \ { } \ + static inline void trace_call__##name(proto) \ + { } \ static inline int \ register_trace_##name(void (*probe)(data_proto), \ void *data) \ --=20 2.53.0