All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [tip:smp/hotplug] perf: Cure hotplug lock ordering issues
       [not found] <tip-14aff62ede39a7b069beb7b95c1d02edb8ee912d@git.kernel.org>
@ 2017-04-24  9:04 ` Peter Zijlstra
  0 siblings, 0 replies; only message in thread
From: Peter Zijlstra @ 2017-04-24  9:04 UTC (permalink / raw)
  To: linux-kernel, tglx, mingo, hpa; +Cc: linux-tip-commits

On Sun, Apr 23, 2017 at 10:16:34AM -0700, tip-bot for Thomas Gleixner wrote:
> Commit-ID:  14aff62ede39a7b069beb7b95c1d02edb8ee912d
> Gitweb:     http://git.kernel.org/tip/14aff62ede39a7b069beb7b95c1d02edb8ee912d
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Sun, 23 Apr 2017 12:13:09 +0200
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Sun, 23 Apr 2017 19:11:27 +0200
> 
> perf: Cure hotplug lock ordering issues
> 
> The get_online_cpus() rework unearthed lock ordering issues.
> 
> Reorder hotpluglock and perf_sched_mutex() to avoid circular locking
> dependencies and convert static_branch_disable() to the cpuslocked version
> to avoid hotplug lock recursion.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Peter Zijlstra <peterz@infradead.org>
> ---
>  kernel/events/core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 8aa3063..b5b4f52f 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -4016,10 +4016,12 @@ static void unaccount_event(struct perf_event *event)
>  
>  static void perf_sched_delayed(struct work_struct *work)
>  {
> +	get_online_cpus();
>  	mutex_lock(&perf_sched_mutex);
>  	if (atomic_dec_and_test(&perf_sched_count))
> -		static_branch_disable(&perf_sched_events);
> +		static_branch_disable_cpuslocked(&perf_sched_events);
>  	mutex_unlock(&perf_sched_mutex);
> +	put_online_cpus();
>  }

So I think we can simply remove the perf_sched_mutex here. Its only
purpose is to serialize the 0->1 state, such that nobody passes before
we've done the additional sync_sched() call.

Once we're >=1, it really doesn't matter anymore. Not sure why I put it
in here. Maybe extensive paranoia..

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-24  9:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <tip-14aff62ede39a7b069beb7b95c1d02edb8ee912d@git.kernel.org>
2017-04-24  9:04 ` [tip:smp/hotplug] perf: Cure hotplug lock ordering issues Peter Zijlstra

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.