From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Colin Ian King <colin.i.king@gmail.com>,
Jeff Xie <jeff.xie@linux.dev>,
Jinjie Ruan <ruanjinjie@huawei.com>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Justin Stitt <justinstitt@google.com>,
Levi Yun <yeoreum.yun@arm.com>,
Li Chen <chenl311@chinatelecom.cn>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Tatsuya S <tatsuya.s2862@gmail.com>,
Uros Bizjak <ubizjak@gmail.com>,
Zheng Yejian <zhengyejian@huaweicloud.com>,
guoweikang <guoweikang.kernel@gmail.com>
Subject: Re: [GIT PULL] tracing: Updates for v6.13
Date: Fri, 22 Nov 2024 17:41:36 -0500 [thread overview]
Message-ID: <20241122174136.18f97fb6@gandalf.local.home> (raw)
In-Reply-To: <CAHk-=wh+bbO9nYxCz5CPf6oGB0upCFH4jx9Bx36f1f3+_DcDUQ@mail.gmail.com>
On Fri, 22 Nov 2024 14:30:10 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Fri, 22 Nov 2024 at 14:12, Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > Hmm, if we make a __DO_TRACE_SYSCALL(), I don't think it needs to even have
> > that condition parameter.
>
> That was my point. The whole conditional - and the parameter - seems
> to be completely pointless as far as I can tell.
>
> That said, I think you can actually simplify things even further: if
> you move the TO_CONDITION() checking into the caller, you could move
> the locking there too.
>
> IOW, instead of this pattern:
>
> if (static_branch_unlikely(&__tracepoint_##name.key)) \
> __DO_TRACE(name, \
> TP_ARGS(args), \
> TP_CONDITION(cond), 0); \
>
> you could make it be something like this instead:
>
> if (static_branch_unlikely(&__tracepoint_##name.key)) \
> if (TP_CONDITION(cond)) \
> scoped_guard(preempt_notrace) \
> __DO_TRACE(name, TP_ARGS(args)); \
Hmm, I wonder why I didn't do that in the first place :-/
But doing a little git forensics, I added that with:
287050d390264 ("tracing: Add TRACE_EVENT_CONDITIONAL()")
Which goes back to December of 2010!
I have no idea what I was thinking back then :-p
>
> where __DO_TRACE() would get neither the "cond" argument _nor_ that
> locking argument, because both are just done by the two users (the
> other one would use "scoped_guard(rcu_read_trace)" of course.
IOW, remove __DO_TRACE() and just call __DO_TRACE_CALL() directly.
>
> And look, this is another reason why unconditional locking is a good
> thing: now you can use the "guard()" model for the lock, and don't
> need an explicit unlock, simplifying the code more.
>
> Of course, you want "guard(rcu_read_trace)" (for system call events)
> and "guard(preempt_notrace)" (for the regular trace event case), and
> we don't have the "notrace" versions of those guard classes yet.
>
> But adding those would literally be trivial, ie something like
>
> DEFINE_LOCK_GUARD_0(rcu_notrace,
> rcu_read_lock_notrace(), rcu_read_unlock_notrace())
>
> wouldn't that make it all look really nice?
>
> NOTE NOTE NOTE! I didn't actually try any of the above in real life,
> so I might be missing some important detail. I'm just pointing out
> that making this all unconditional and not based on random flags has
> the potential for even more cleanups.
>
> And I might have gotten the different lock names confused too.
Thanks for the analysis.
-- Steve
next prev parent reply other threads:[~2024-11-22 22:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-21 2:45 Steven Rostedt
2024-11-22 21:54 ` Linus Torvalds
2024-11-22 22:00 ` Steven Rostedt
2024-11-22 22:13 ` Mathieu Desnoyers
2024-11-22 22:13 ` Steven Rostedt
2024-11-22 22:30 ` Linus Torvalds
2024-11-22 22:41 ` Steven Rostedt [this message]
2024-11-22 22:32 ` pr-tracker-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241122174136.18f97fb6@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=andrii@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=chenl311@chinatelecom.cn \
--cc=colin.i.king@gmail.com \
--cc=guoweikang.kernel@gmail.com \
--cc=jeff.xie@linux.dev \
--cc=jpoimboe@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=ruanjinjie@huawei.com \
--cc=ryan.roberts@arm.com \
--cc=tatsuya.s2862@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=ubizjak@gmail.com \
--cc=yeoreum.yun@arm.com \
--cc=zhengyejian@huaweicloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®