Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-17 Thread Paul E. McKenney
On Wed, May 17, 2017 at 07:55:20AM -0700, Paul E. McKenney wrote: > On Wed, May 17, 2017 at 12:40:10PM +0200, Peter Zijlstra wrote: > > On Tue, May 16, 2017 at 07:27:42AM -0700, Paul E. McKenney wrote: > > > On Tue, May 16, 2017 at 05:46:06AM -0700, Paul E. McKenney wrote: [ . . . ] > > > >

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-17 Thread Paul E. McKenney
On Wed, May 17, 2017 at 07:55:20AM -0700, Paul E. McKenney wrote: > On Wed, May 17, 2017 at 12:40:10PM +0200, Peter Zijlstra wrote: > > On Tue, May 16, 2017 at 07:27:42AM -0700, Paul E. McKenney wrote: > > > On Tue, May 16, 2017 at 05:46:06AM -0700, Paul E. McKenney wrote: [ . . . ] > > > >

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-17 Thread Paul E. McKenney
On Wed, May 17, 2017 at 12:40:10PM +0200, Peter Zijlstra wrote: > On Tue, May 16, 2017 at 07:27:42AM -0700, Paul E. McKenney wrote: > > On Tue, May 16, 2017 at 05:46:06AM -0700, Paul E. McKenney wrote: > > > > Something like this, yes. Maybe even exactly like this. ;-) > > > > Ah, one thing I

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-17 Thread Paul E. McKenney
On Wed, May 17, 2017 at 12:40:10PM +0200, Peter Zijlstra wrote: > On Tue, May 16, 2017 at 07:27:42AM -0700, Paul E. McKenney wrote: > > On Tue, May 16, 2017 at 05:46:06AM -0700, Paul E. McKenney wrote: > > > > Something like this, yes. Maybe even exactly like this. ;-) > > > > Ah, one thing I

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-17 Thread Peter Zijlstra
On Tue, May 16, 2017 at 07:27:42AM -0700, Paul E. McKenney wrote: > On Tue, May 16, 2017 at 05:46:06AM -0700, Paul E. McKenney wrote: > > Something like this, yes. Maybe even exactly like this. ;-) > > Ah, one thing I forgot... If you are avoiding use of get_online_cpus(), > you usually also

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-17 Thread Peter Zijlstra
On Tue, May 16, 2017 at 07:27:42AM -0700, Paul E. McKenney wrote: > On Tue, May 16, 2017 at 05:46:06AM -0700, Paul E. McKenney wrote: > > Something like this, yes. Maybe even exactly like this. ;-) > > Ah, one thing I forgot... If you are avoiding use of get_online_cpus(), > you usually also

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-16 Thread Paul E. McKenney
On Tue, May 16, 2017 at 05:46:06AM -0700, Paul E. McKenney wrote: > On Tue, May 16, 2017 at 10:19:23AM +0200, Peter Zijlstra wrote: > > On Mon, May 15, 2017 at 11:40:43AM -0700, Paul E. McKenney wrote: > > > > > Given that you acquire the global pmus_lock when doing the > > > get_online_cpus(),

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-16 Thread Paul E. McKenney
On Tue, May 16, 2017 at 05:46:06AM -0700, Paul E. McKenney wrote: > On Tue, May 16, 2017 at 10:19:23AM +0200, Peter Zijlstra wrote: > > On Mon, May 15, 2017 at 11:40:43AM -0700, Paul E. McKenney wrote: > > > > > Given that you acquire the global pmus_lock when doing the > > > get_online_cpus(),

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-16 Thread Paul E. McKenney
On Tue, May 16, 2017 at 10:19:23AM +0200, Peter Zijlstra wrote: > On Mon, May 15, 2017 at 11:40:43AM -0700, Paul E. McKenney wrote: > > > Given that you acquire the global pmus_lock when doing the > > get_online_cpus(), and given that CPU hotplug is rare, is it possible > > to momentarily acquire

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-16 Thread Paul E. McKenney
On Tue, May 16, 2017 at 10:19:23AM +0200, Peter Zijlstra wrote: > On Mon, May 15, 2017 at 11:40:43AM -0700, Paul E. McKenney wrote: > > > Given that you acquire the global pmus_lock when doing the > > get_online_cpus(), and given that CPU hotplug is rare, is it possible > > to momentarily acquire

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-16 Thread Peter Zijlstra
On Mon, May 15, 2017 at 11:40:43AM -0700, Paul E. McKenney wrote: > Given that you acquire the global pmus_lock when doing the > get_online_cpus(), and given that CPU hotplug is rare, is it possible > to momentarily acquire the global pmus_lock in perf_event_init_cpu() > and perf_event_exit_cpu()

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-16 Thread Peter Zijlstra
On Mon, May 15, 2017 at 11:40:43AM -0700, Paul E. McKenney wrote: > Given that you acquire the global pmus_lock when doing the > get_online_cpus(), and given that CPU hotplug is rare, is it possible > to momentarily acquire the global pmus_lock in perf_event_init_cpu() > and perf_event_exit_cpu()

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-15 Thread Steven Rostedt
On Fri, 12 May 2017 21:49:56 +0200 Peter Zijlstra wrote: > In general we avoid nested locking in the kernel. Nested locking makes > an absolute mockery of locking rules and what all gets protected. I'm not against the goal of having get_online_cpus() not be nested, but I

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-15 Thread Steven Rostedt
On Fri, 12 May 2017 21:49:56 +0200 Peter Zijlstra wrote: > In general we avoid nested locking in the kernel. Nested locking makes > an absolute mockery of locking rules and what all gets protected. I'm not against the goal of having get_online_cpus() not be nested, but I don't agree with the

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-15 Thread Paul E. McKenney
On Mon, May 15, 2017 at 11:03:18AM +0200, Peter Zijlstra wrote: > On Sat, May 13, 2017 at 06:40:03AM -0700, Paul E. McKenney wrote: > > On Fri, May 12, 2017 at 05:34:48PM -0400, Steven Rostedt wrote: > > > On Fri, 12 May 2017 21:49:56 +0200 > > > > [ . . . ] > > > > > This means that text_mutex,

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-15 Thread Paul E. McKenney
On Mon, May 15, 2017 at 11:03:18AM +0200, Peter Zijlstra wrote: > On Sat, May 13, 2017 at 06:40:03AM -0700, Paul E. McKenney wrote: > > On Fri, May 12, 2017 at 05:34:48PM -0400, Steven Rostedt wrote: > > > On Fri, 12 May 2017 21:49:56 +0200 > > > > [ . . . ] > > > > > This means that text_mutex,

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-15 Thread Peter Zijlstra
On Sat, May 13, 2017 at 06:40:03AM -0700, Paul E. McKenney wrote: > On Fri, May 12, 2017 at 05:34:48PM -0400, Steven Rostedt wrote: > > On Fri, 12 May 2017 21:49:56 +0200 > > [ . . . ] > > > This means that text_mutex, which was taken by the alternative code, no > > longer is taken in cpu

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-15 Thread Peter Zijlstra
On Sat, May 13, 2017 at 06:40:03AM -0700, Paul E. McKenney wrote: > On Fri, May 12, 2017 at 05:34:48PM -0400, Steven Rostedt wrote: > > On Fri, 12 May 2017 21:49:56 +0200 > > [ . . . ] > > > This means that text_mutex, which was taken by the alternative code, no > > longer is taken in cpu

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-13 Thread Paul E. McKenney
On Fri, May 12, 2017 at 05:34:48PM -0400, Steven Rostedt wrote: > On Fri, 12 May 2017 21:49:56 +0200 [ . . . ] > This means that text_mutex, which was taken by the alternative code, no > longer is taken in cpu hotplug code. That means there's no longer a > deadlock scenario, as we don't have

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-13 Thread Paul E. McKenney
On Fri, May 12, 2017 at 05:34:48PM -0400, Steven Rostedt wrote: > On Fri, 12 May 2017 21:49:56 +0200 [ . . . ] > This means that text_mutex, which was taken by the alternative code, no > longer is taken in cpu hotplug code. That means there's no longer a > deadlock scenario, as we don't have

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-12 Thread Steven Rostedt
On Fri, 12 May 2017 21:49:56 +0200 Peter Zijlstra wrote: > On Fri, May 12, 2017 at 01:15:44PM -0400, Steven Rostedt wrote: > > 2) Allow for get_online_cpus() to nest > > So Thomas and me have been avoiding doing this. > > In general we avoid nested locking in the

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-12 Thread Steven Rostedt
On Fri, 12 May 2017 21:49:56 +0200 Peter Zijlstra wrote: > On Fri, May 12, 2017 at 01:15:44PM -0400, Steven Rostedt wrote: > > 2) Allow for get_online_cpus() to nest > > So Thomas and me have been avoiding doing this. > > In general we avoid nested locking in the kernel. Nested locking

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-12 Thread Steven Rostedt
On Fri, 12 May 2017 21:49:56 +0200 Peter Zijlstra wrote: > On Fri, May 12, 2017 at 01:15:44PM -0400, Steven Rostedt wrote: > > 2) Allow for get_online_cpus() to nest > > So Thomas and me have been avoiding doing this. > > In general we avoid nested locking in the

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-12 Thread Steven Rostedt
On Fri, 12 May 2017 21:49:56 +0200 Peter Zijlstra wrote: > On Fri, May 12, 2017 at 01:15:44PM -0400, Steven Rostedt wrote: > > 2) Allow for get_online_cpus() to nest > > So Thomas and me have been avoiding doing this. > > In general we avoid nested locking in the kernel. Nested locking

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-12 Thread Peter Zijlstra
On Fri, May 12, 2017 at 01:15:44PM -0400, Steven Rostedt wrote: > 2) Allow for get_online_cpus() to nest So Thomas and me have been avoiding doing this. In general we avoid nested locking in the kernel. Nested locking makes an absolute mockery of locking rules and what all gets protected. Yes,

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-12 Thread Peter Zijlstra
On Fri, May 12, 2017 at 01:15:44PM -0400, Steven Rostedt wrote: > 2) Allow for get_online_cpus() to nest So Thomas and me have been avoiding doing this. In general we avoid nested locking in the kernel. Nested locking makes an absolute mockery of locking rules and what all gets protected. Yes,

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-12 Thread Paul E. McKenney
On Fri, May 12, 2017 at 01:15:44PM -0400, Steven Rostedt wrote: > NOTE: This was quickly written. The change logs and patches probably need > some loving. This is for discussion. These may become legitimate patches, > but for now, I'm seeing if this is an acceptable solution. > > Also note, I

Re: [RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-12 Thread Paul E. McKenney
On Fri, May 12, 2017 at 01:15:44PM -0400, Steven Rostedt wrote: > NOTE: This was quickly written. The change logs and patches probably need > some loving. This is for discussion. These may become legitimate patches, > but for now, I'm seeing if this is an acceptable solution. > > Also note, I

[RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-12 Thread Steven Rostedt
NOTE: This was quickly written. The change logs and patches probably need some loving. This is for discussion. These may become legitimate patches, but for now, I'm seeing if this is an acceptable solution. Also note, I checked out the last branch that I had Linus pull, and then merged with tip's

[RFC][PATCH 0/5] perf/tracing/cpuhotplug: Fix locking order

2017-05-12 Thread Steven Rostedt
NOTE: This was quickly written. The change logs and patches probably need some loving. This is for discussion. These may become legitimate patches, but for now, I'm seeing if this is an acceptable solution. Also note, I checked out the last branch that I had Linus pull, and then merged with tip's