[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <c26f6c2c-980f-c1b2-ff7c-7a5e2a5771cd@linux.ibm.com>
Date: Wed, 5 Feb 2020 07:10:59 +0530
From: maddy <maddy@...ux.ibm.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Cc: Mark Rutland <mark.rutland@....com>,
Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
Namhyung Kim <namhyung@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Jiri Olsa <jolsa@...hat.com>
Subject: Re: [RFC] per-CPU usage in perf core-book3s
On 1/27/20 8:36 PM, Sebastian Andrzej Siewior wrote:
> I've been looking at usage of per-CPU variable cpu_hw_events in
> arch/powerpc/perf/core-book3s.c.
>
> power_pmu_enable() and power_pmu_disable() (pmu::pmu_enable() and
> pmu::pmu_disable()) are accessing the variable and the callbacks are
> invoked always with disabled interrupts.
>
> power_pmu_event_init() (pmu::event_init()) is invoked from preemptible
> context and uses get_cpu_var() to obtain a stable pointer (by disabling
> preemption).
>
> pmu::pmu_enable() and pmu::pmu_disable() can be invoked via a hrtimer
> (perf_mux_hrtimer_handler()) and it invokes pmu::pmu_enable() and
> pmu::pmu_disable() as part of the callback.
>
> Is there anything that prevents the timer callback to interrupt
> pmu::event_init() while it is accessing per-CPU data?
Sorry for the delayed response.
Yes, currently we dont have anything that prevents the timer
callback to interrupt pmu::event_init. Nice catch. Thanks for
pointing this out.
Looking at the code, per-cpu variable access are made to
check for constraints and for Branch Stack (BHRB). So could
wrap this block of pmu::event_init with local_irq_save/restore.
Will send a patch to fix it.
Maddy
>
> Sebastian
Powered by blists - more mailing lists