All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Cheng Jian <cj.chengjian@huawei.com>
Cc: mingo@redhat.com, acme@kernel.org,
	alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org,
	xiexiuqi@huawei.com, huawei.libin@huawei.com,
	Steven Rostedt <rostedt@goodmis.org>,
	Jiri Olsa <jolsa@kernel.org>
Subject: Re: [PATCH] perf/ftrace : Fix repetitious traces when specify a target  task
Date: Tue, 10 Oct 2017 13:33:21 +0200	[thread overview]
Message-ID: <20171010113321.rq7w2kb77vyf6qoj@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1507598379-148309-1-git-send-email-cj.chengjian@huawei.com>

On Tue, Oct 10, 2017 at 09:19:39AM +0800, Cheng Jian wrote:
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index baa134c..5682ead 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -7988,12 +7988,16 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
>  
>  	/* Use the given event instead of the hlist */
>  	if (event) {
> -		if (perf_tp_event_match(event, &data, regs))
> +		if (perf_tp_event_match(event, &data, regs)) {
>  			perf_swevent_event(event, count, &data, regs);
> +			goto out;
> +		}
>  	} else {
>  		hlist_for_each_entry_rcu(event, head, hlist_entry) {
> -			if (perf_tp_event_match(event, &data, regs))
> +			if (perf_tp_event_match(event, &data, regs)) {
>  				perf_swevent_event(event, count, &data, regs);
> +				goto out;
> +			}
>  		}
>  	}
>  
> @@ -8015,13 +8019,15 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
>  				continue;
>  			if (event->attr.config != entry->type)
>  				continue;
> -			if (perf_tp_event_match(event, &data, regs))
> +			if (perf_tp_event_match(event, &data, regs)) {
>  				perf_swevent_event(event, count, &data, regs);
> +				break;
> +			}
>  		}
>  unlock:
>  		rcu_read_unlock();
>  	}
> -
> +out:
>  	perf_swevent_put_recursion_context(rctx);
>  }
>  EXPORT_SYMBOL_GPL(perf_tp_event);

No, this _cannot_ be right. The whole point of the @task argument was to
deliver the event multiple times -- maybe not to the same event, but it
needs to be delivered multiple times in some cases. Therefore this is
broken.

But now you've got me looking at 75e8387685f6, which also looks
completely insane.

  reply	other threads:[~2017-10-10 11:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10  1:19 [PATCH] perf/ftrace : Fix repetitious traces when specify a target task Cheng Jian
2017-10-10 11:33 ` Peter Zijlstra [this message]
2017-10-10 12:18   ` chengjian (D)
2017-10-10 13:42     ` Peter Zijlstra
2017-10-10 13:04   ` Peter Zijlstra
2017-10-10 15:21     ` Peter Zijlstra
2017-10-10 16:35       ` 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=20171010113321.rq7w2kb77vyf6qoj@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=cj.chengjian@huawei.com \
    --cc=huawei.libin@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=xiexiuqi@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.