From: Jiri Olsa <jolsa@redhat.com>
To: Song Liu <songliubraving@fb.com>
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, davidca@fb.com,
Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Jiri Olsa <jolsa@kernel.org>,
Alexey Budankov <alexey.budankov@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>, Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH v7] perf: Sharing PMU counters across compatible events
Date: Thu, 28 Nov 2019 09:30:45 +0100 [thread overview]
Message-ID: <20191128083045.GB1209@krava> (raw)
In-Reply-To: <20191115235504.4034879-1-songliubraving@fb.com>
On Fri, Nov 15, 2019 at 03:55:04PM -0800, Song Liu wrote:
SNIP
> add_event_to_ctx(event, ctx);
> }
> @@ -2745,21 +2998,26 @@ static void __perf_event_enable(struct perf_event *event,
> {
> struct perf_event *leader = event->group_leader;
> struct perf_event_context *task_ctx;
> + int was_active;
> + int event_type;
>
> if (event->state >= PERF_EVENT_STATE_INACTIVE ||
> event->state <= PERF_EVENT_STATE_ERROR)
> return;
>
> + event_type = perf_event_can_share(event) ? EVENT_ALL : EVENT_TIME;
> + was_active = ctx->is_active;
> if (ctx->is_active)
> - ctx_sched_out(ctx, cpuctx, EVENT_TIME);
> + ctx_sched_out(ctx, cpuctx, event_type);
you're scheduling everything out in here, so cpuctx->task_ctx
will become NULL and trigger the check below
I dont think you need to do it here, ctx_resched will do that
for you later, this here is just to keep the time updated
jirka
>
> perf_event_set_state(event, PERF_EVENT_STATE_INACTIVE);
> + perf_event_setup_dup(event, ctx);
>
> - if (!ctx->is_active)
> + if (!was_active)
> return;
>
> if (!event_filter_match(event)) {
> - ctx_sched_in(ctx, cpuctx, EVENT_TIME, current);
> + ctx_sched_in(ctx, cpuctx, event_type, current);
> return;
> }
>
> @@ -2767,8 +3025,8 @@ static void __perf_event_enable(struct perf_event *event,
> * If the event is in a group and isn't the group leader,
> * then don't put it on unless the group is on.
> */
> - if (leader != event && leader->state != PERF_EVENT_STATE_ACTIVE) {
> - ctx_sched_in(ctx, cpuctx, EVENT_TIME, current);
> + if (leader != event && leader->state <= PERF_EVENT_STATE_INACTIVE) {
> + ctx_sched_in(ctx, cpuctx, event_type, current);
> return;
> }
>
> @@ -2776,7 +3034,8 @@ static void __perf_event_enable(struct perf_event *event,
> if (ctx->task)
> WARN_ON_ONCE(task_ctx != ctx);
>
> - ctx_resched(cpuctx, task_ctx, get_event_type(event));
> + /* if perf_event_can_share() resched EVENT_ALL */
> + ctx_resched(cpuctx, task_ctx, get_event_type(event) | event_type);
> }
SNIP
next prev parent reply other threads:[~2019-11-28 8:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-15 23:55 [PATCH v7] perf: Sharing PMU counters across compatible events Song Liu
2019-11-19 15:28 ` Song Liu
2019-11-22 19:33 ` Jiri Olsa
2019-11-22 19:50 ` Song Liu
2019-11-25 9:22 ` Jiri Olsa
2019-11-25 9:39 ` Song Liu
2019-12-06 0:47 ` [perf] 9dc510db74: perf-sanity-tests.Read_samples_using_the_mmap_interface.fail kernel test robot
2019-11-28 8:30 ` Jiri Olsa [this message]
2019-12-04 22:16 ` [PATCH v7] perf: Sharing PMU counters across compatible events Song Liu
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=20191128083045.GB1209@krava \
--to=jolsa@redhat.com \
--cc=acme@redhat.com \
--cc=alexey.budankov@linux.intel.com \
--cc=davidca@fb.com \
--cc=jolsa@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
--cc=tj@kernel.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