mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Jiri Olsa <jolsa@redhat.com>, Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>,
	kernel test robot <lkp@intel.com>, Marco Elver <elver@google.com>
Subject: Re: [PATCH v2] perf/core: Fix cgroup event list management
Date: Mon, 13 Dec 2021 22:08:59 +0100	[thread overview]
Message-ID: <20211213210859.GC16608@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20211213065936.1965081-1-namhyung@kernel.org>

On Sun, Dec 12, 2021 at 10:59:36PM -0800, Namhyung Kim wrote:
> The active cgroup events are managed in the per-cpu cgrp_cpuctx_list.
> This list is accessed from current cpu and not protected by any locks.
> But from the commit ef54c1a476ae ("perf: Rework
> perf_event_exit_event()"), this assumption does not hold true anymore.
> 
> In the perf_remove_from_context(), it can remove an event from the
> context without an IPI when the context is not active.  I think it
> assumes task event context, but it's possible for cpu event context

Yes, event_function_call() in general doesn't work, but for cpu events
it does.

> only with cgroup events can be inactive at the moment - and it might
> become active soon.

It can't, we're holding ctx->mutex and ctx->lock, and since it's a cpu
event, that's cpuctx.

But yes, cgrp_cpuctx_list relies on being strictly per-cpu and I can't
come up with a better solution either, doing those IPIs suck but...

But please, put in a comment like:

	/*
	 * Cgroup events are per-CPU events, and must IPI because of
	 * cgrp_cpuctx_list.
	 */
	if (!ctx->is_active || !is_cgroup_event(event)) {

      parent reply	other threads:[~2021-12-13 21:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13  6:59 Namhyung Kim
2021-12-13 20:30 ` Peter Zijlstra
2021-12-13 21:10   ` Namhyung Kim
2021-12-13 21:08 ` Peter Zijlstra [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=20211213210859.GC16608@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=elver@google.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@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

all inboxes | Powered by JetHome®