From: Steven Rostedt <rostedt@goodmis.org>
To: Nick Lowell <nicholas.lowell@gmail.com>
Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org,
Nicholas Lowell <nlowell@lexmark.com>
Subject: Re: [PATCH v2] trace: tracing_event_filter: fast path when no subsystem filters
Date: Wed, 22 Nov 2023 16:20:51 -0500 [thread overview]
Message-ID: <20231122162051.661981fe@gandalf.local.home> (raw)
In-Reply-To: <CAFEqNJ3PE6_u-q41Jw=-p7PrNBLT0Lr_n87WiY_2UctOJrDmZA@mail.gmail.com>
On Thu, 12 Oct 2023 16:37:35 -0400
Nick Lowell <nicholas.lowell@gmail.com> wrote:
Sorry, I was traveling when this was sent, and I missed it.
> I really appreciate the continued feedback. I was able to reproduce.
> I think I'm understanding better but still need some help.
> I am actually wondering if remove_filter_string(system->filter) should
You mean to return true if filter->filter_string was not NULL?
> also return bool as an OR'd input for sync.
> Should it be something like this?
>
> if (!strcmp(strstrip(filter_string), "0")) {
> - filter_free_subsystem_preds(dir, tr);
> - remove_filter_string(system->filter);
> + bool sync;
I would just make this an int;
> +
> + sync = filter_free_subsystem_preds(dir, tr);
> + sync = sync || remove_filter_string(system->filter);
And then just have:
sync |= remove_filter_string(system->filter);
> filter = system->filter;
> system->filter = NULL;
> - /* Ensure all filters are no longer used */
> - tracepoint_synchronize_unregister();
> + /* If nothing was freed, we do not need to sync */
> + if(sync) {
> + /* Ensure all filters are no longer used */
> + tracepoint_synchronize_unregister();
> + }
> filter_free_subsystem_filters(dir, tr);
> __free_filter(filter);
> goto out_unlock;
>
> > Maybe even pass in "sync" to the filter_free_subsystem_filters() to make
> > sure there were nothing to be freed, and do the WARN_ON_ONCE() then.
> >
> > __free_filter(filter);
> > goto out_unlock;
> > }
> >
> > -- Steve
>
> I'm not sure if I see the reasoning for the WARN_ON_ONCE() in
> filter_free_subsystem_filters()
> because it ends up checking the same if(!filter) just like
> filter_free_subsystem_preds() did earlier. It doesn't
> seem to do anything with system->filter. I actually wonder if !sync,
> could filter_free_subsystem_filters()
> be skipped altogether. Help me if I'm missing something.
The point is, code always changes. It's a bug if one of the filters had
content in filter_free_subsystem_filters() and sync is 0, hence the
WARN_ON_ONCE() if it does.
WARN_ON*()s are added to make sure the code is acting the way it is expected
to act. Yes, it should never trigger, but if it does, we know there's a bug
somewhere.
-- Steve
prev parent reply other threads:[~2023-11-22 21:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-02 14:41 Nicholas Lowell
2023-10-04 2:30 ` Steven Rostedt
2023-10-04 14:39 ` Nick Lowell
2023-10-04 14:53 ` Steven Rostedt
2023-10-12 20:37 ` Nick Lowell
2023-11-22 21:20 ` Steven Rostedt [this message]
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=20231122162051.661981fe@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=nicholas.lowell@gmail.com \
--cc=nlowell@lexmark.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®