All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	Andi Kleen <ak@linux.intel.com>,
	Dapeng Mi <dapeng1.mi@linux.intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Thomas Falcon <thomas.falcon@intel.com>,
	Stephane Eranian <eranian@google.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] perf/core: Add PERF_EVENT_STATE_ON to fix filtered event enabled time
Date: Wed, 2 Dec 2026 11:17:37 +0100	[thread overview]
Message-ID: <20261202101737.GF2883950@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <CAP-5=fWpyX6DKxRV_8o8XeCM00_3MhUNuLfyzHhfZBH9UMocXQ@mail.gmail.com>

On Tue, Dec 01, 2026 at 08:47:55AM -0800, Ian Rogers wrote:

> Fair criticism - I used an AI assistant to help iterate and test
> between v3 and v4, and I didn't keep the v3->v4 diff tight enough or
> list all of the resulting churn in my reply. Sorry for wasting your
> review time.
> 
> Specifically, the unlisted changes in v4 were:
> 
> 1. group_sched_out() / group_update_userpage() move:
>    Once siblings stayed in ON (inheriting INACTIVE via
>    __perf_effective_state()), group_sched_out() iterating siblings would
>    hit `event->state < INACTIVE` and skip updating sibling userpages.
>    That led to moving event_update_userpage()/group_update_userpage() up
>    in core.c, calling group_update_userpage() from event_sched_out(),
>    and adding the `if (!active) return;` shortcut in group_sched_out().
>    Looking at it again, calling group_update_userpage() inside
>    event_sched_out() and moving those helpers 1,600 lines up is ugly and
>    unnecessary — if group_sched_out() itself handles the !active case
>    (or updates userpages there instead of in event_sched_out()), none of
>    that weirdness is needed.
> 
> 2. READ_ONCE() in __perf_effective_state():
>    Was added so `leader->state` isn't loaded twice in the two checks
>    from lockless calc_timer_values() callers.
> 
> 3. `if (event->state <= PERF_EVENT_STATE_OFF)` in merge_sched_in():
>    Previously implicit in `if (event->state == PERF_EVENT_STATE_ON)` to
>    avoid overwriting OFF if group_sched_in()'s rollback consumed
>    pending_disable.
> 
> 4. `bool inactive` passed to perf_group_detach() /
>    perf_promote_sibling_to_leader():
>    Because siblings now stay ON, __event_disable() clears the leader's
>    INACTIVE state before perf_group_detach() runs, so without recording
>    that the detached leader was INACTIVE, promoted siblings would stay
>    ON and stop accruing enabled time.
> 
> Before I send a cleaner v5, I'd appreciate a quick sanity check on two
> things:
> - Is the `__perf_effective_state()` + `perf_event_set_state()` direction
>   for INACTIVE siblings what you had in mind (with the group_sched_out /
>   userpage weirdness cleaned up)?
> - For event_sched_in() / merge_sched_in(), do you prefer keeping
>   event_sched_in() reverting its speculative ACTIVE back to ON (with
>   merge_sched_in() doing ON -> {ERROR,INACTIVE}), or would you rather
>   see the state transition structured differently?

Hold off on the v5. I can't seem to make up my mind on what I want here.
I'll poke at the thing a little.

  reply	other threads:[~2026-12-02 10:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  6:52 [PATCH v3 1/2] perf/core: Add PERF_EVENT_STATE_ON to fix filtered event enabled time Ian Rogers
2026-11-25  6:52 ` [PATCH v3 2/2] perf test: Add filtered event enabled time tests to event-times Ian Rogers
2026-12-02 14:13   ` Peter Zijlstra
2026-11-25  7:09 ` [PATCH v3 1/2] perf/core: Add PERF_EVENT_STATE_ON to fix filtered event enabled time sashiko-bot
2026-11-25 12:37 ` Peter Zijlstra
2026-11-25 13:02   ` Peter Zijlstra
2026-11-30 18:42     ` Ian Rogers
2026-12-01  9:18       ` Peter Zijlstra
2026-12-01 16:47         ` Ian Rogers
2026-12-02 10:17           ` Peter Zijlstra [this message]
2026-12-02 14:26             ` Peter Zijlstra

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=20261202101737.GF2883950@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dapeng1.mi@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=thomas.falcon@intel.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.