linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: maddy <maddy@linux.ibm.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Cc: Mark Rutland <mark.rutland@arm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>, Paul Mackerras <paulus@samba.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jiri Olsa <jolsa@redhat.com>
Subject: Re: [RFC] per-CPU usage in perf core-book3s
Date: Wed, 5 Feb 2020 07:10:59 +0530	[thread overview]
Message-ID: <c26f6c2c-980f-c1b2-ff7c-7a5e2a5771cd@linux.ibm.com> (raw)
In-Reply-To: <20200127150620.taio2txyqreg4kn6@linutronix.de>



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


  reply	other threads:[~2020-02-05  1:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-27 15:06 [RFC] per-CPU usage in perf core-book3s Sebastian Andrzej Siewior
2020-02-05  1:40 ` maddy [this message]
2020-02-05 14:11   ` Sebastian Andrzej Siewior

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=c26f6c2c-980f-c1b2-ff7c-7a5e2a5771cd@linux.ibm.com \
    --to=maddy@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).