linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Hawkins <hawkinsw@borlaugic.com>
To: linux-kernel@vger.kernel.org, Will Hawkins <hawkinsw@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: Will Hawkins <hawkinsw@borlaugic.com>
Subject: Re: [PATCH v2] trace-cmd record: Fix syntax in make_pid_filter
Date: Mon, 23 Oct 2017 16:41:22 -0400	[thread overview]
Message-ID: <CADx9qWicRSObEqH+KaE17yUYGBQQkLN1VR2zShNn+JXoFEK-_g@mail.gmail.com> (raw)
In-Reply-To: <1507920006-10204-1-git-send-email-hawkinsw@borlaugic.com>

Mr. Rostedt,

Just wanted to make sure there was nothing else you thought I should
modify for this patch. If there is, please let me know. I am eager to
fix anything that you think could make it better!

I hope that you had a great weekend!
Will


On Fri, Oct 13, 2017 at 2:40 PM, Will Hawkins <hawkinsw@borlaugic.com> wrote:
> In older versions of the kernel, event filtering by
> pid does not use the set_event_pid file. Instead,
> ftrace uses a common filter (created in make_pid_filter)
> to filter events based on PID.
>
> The syntax of the filter generated by this function is
> overly permissive. When filtering by pid, || is used
> where && should be (in certain cases) which means that
> unrelated events are captured.
>
> Signed-off-by: Will Hawkins <hawkinsw@borlaugic.com>
> ---
>  trace-record.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/trace-record.c b/trace-record.c
> index a0b6541..741fe53 100644
> --- a/trace-record.c
> +++ b/trace-record.c
> @@ -935,14 +935,16 @@ static char *make_pid_filter(char *curr_filter, const char *field)
>         str = filter + curr_len;
>
>         for (p = filter_pids; p; p = p->next) {
> -               if (p == filter_pids)
> -                       orit = "";
> -               else
> -                       orit = "||";
> -               if (p->exclude)
> +               if (p->exclude) {
>                         match = "!=";
> -               else
> +                       orit = "&&";
> +               } else {
>                         match = "==";
> +                       orit = "||";
> +               }
> +               if (p == filter_pids)
> +                       orit = "";
> +
>                 len = sprintf(str, "%s(%s%s%d)", orit, field, match, p->pid);
>                 str += len;
>         }
> --
> 2.7.4
>

  reply	other threads:[~2017-10-23 20:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CADx9qWjVny-+Sct2-pmHmZ73ohCu_6ay67-GBYP5w_gjvG0TDQ () mail ! gmail ! com>
2017-10-13 18:40 ` [PATCH v2] trace-cmd record: Fix syntax in make_pid_filter Will Hawkins
2017-10-23 20:41   ` Will Hawkins [this message]
2017-10-31 16:17     ` Steven Rostedt

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=CADx9qWicRSObEqH+KaE17yUYGBQQkLN1VR2zShNn+JXoFEK-_g@mail.gmail.com \
    --to=hawkinsw@borlaugic.com \
    --cc=hawkinsw@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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;
as well as URLs for NNTP newsgroup(s).