Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-05-12 Thread Michael Ellerman
Paul Mackerras writes: > On Wed, Apr 08, 2020 at 10:21:29PM +1000, Michael Ellerman wrote: >> >> We should be able to just allocate the rtas_args on the stack, it's only >> ~80 odd bytes. And then we can use rtas_call_unlocked() which doesn't >> take the global lock. > > Do we instantiate a

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-05-11 Thread Leonardo Bras
Hello Paul, thanks for the reply! On Thu, 2020-04-09 at 10:27 +1000, Paul Mackerras wrote: > On Wed, Apr 08, 2020 at 10:21:29PM +1000, Michael Ellerman wrote: > > We should be able to just allocate the rtas_args on the stack, it's only > > ~80 odd bytes. And then we can use rtas_call_unlocked()

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-08 Thread Paul Mackerras
On Wed, Apr 08, 2020 at 10:21:29PM +1000, Michael Ellerman wrote: > > We should be able to just allocate the rtas_args on the stack, it's only > ~80 odd bytes. And then we can use rtas_call_unlocked() which doesn't > take the global lock. Do we instantiate a 64-bit RTAS these days, or is it

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-08 Thread Leonardo Bras
On Wed, 2020-04-08 at 22:21 +1000, Michael Ellerman wrote: [...] > > According with LoPAR, for both of these rtas-calls, we have: > > > > For the PowerPC External Interrupt option: The call must be reentrant > > to the number of processors on the platform. > > For the PowerPC External Interrupt

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-08 Thread Leonardo Bras
On Wed, 2020-04-08 at 22:21 +1000, Michael Ellerman wrote: > We should be able to just allocate the rtas_args on the stack, it's only > ~80 odd bytes. And then we can use rtas_call_unlocked() which doesn't > take the global lock. At this point, would it be a problem using kmalloc? Best regards,

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-08 Thread Leonardo Bras
On Wed, 2020-04-08 at 22:21 +1000, Michael Ellerman wrote: [...] > > On the other hand, busting the rtas.lock could be dangerous, because > > it's code we can't control. > > > > According with LoPAR, for both of these rtas-calls, we have: > > > > For the PowerPC External Interrupt option: The

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-08 Thread Michael Ellerman
Leonardo Bras writes: > Hello Nick, Michael, > > On Fri, 2020-04-03 at 16:41 +1000, Nicholas Piggin wrote: > [...] >> > > PAPR says we are not allowed to have multiple CPUs calling RTAS at once, >> > > except for a very small list of RTAS calls. So if we bust the RTAS lock >> > > there's a risk

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-07 Thread Leonardo Bras
Hello Nick, Michael, On Fri, 2020-04-03 at 16:41 +1000, Nicholas Piggin wrote: [...] > > > PAPR says we are not allowed to have multiple CPUs calling RTAS at once, > > > except for a very small list of RTAS calls. So if we bust the RTAS lock > > > there's a risk we violate that part of PAPR and

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-06 Thread Leonardo Bras
On Thu, 2020-04-02 at 22:28 +1100, Michael Ellerman wrote: > Leonardo Bras > TBH I think we could just drop that printk() entirely. > > Or we could tell printk() that we're in NMI context so that it uses the > percpu buffers. > > We should probably do the latter anyway, in case there's any

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-03 Thread Nicholas Piggin
Leonardo Bras's on April 3, 2020 10:37 am: > On Thu, 2020-04-02 at 22:28 +1100, Michael Ellerman wrote: >> Leonardo Bras writes: >> > During a crash, there is chance that the cpus that handle the NMI IPI >> > are holding a spin_lock. If this spin_lock is needed by crashing_cpu it >> > will cause

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-02 Thread Leonardo Bras
On Thu, 2020-04-02 at 22:28 +1100, Michael Ellerman wrote: > Leonardo Bras writes: > > During a crash, there is chance that the cpus that handle the NMI IPI > > are holding a spin_lock. If this spin_lock is needed by crashing_cpu it > > will cause a deadlock. (rtas.lock and printk logbuf_lock as

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-02 Thread Michael Ellerman
Leonardo Bras writes: > During a crash, there is chance that the cpus that handle the NMI IPI > are holding a spin_lock. If this spin_lock is needed by crashing_cpu it > will cause a deadlock. (rtas.lock and printk logbuf_lock as of today) > > This is a problem if the system has kdump set up,

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-01 Thread Leonardo Bras
Hello Peter, On Wed, 2020-04-01 at 11:26 +0200, Peter Zijlstra wrote: > You might want to add a note to your asm/spinlock.h that you rely on > spin_unlock() unconditionally clearing a lock. > > This isn't naturally true for all lock implementations. Consider ticket > locks, doing a surplus

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-01 Thread Peter Zijlstra
On Tue, Mar 31, 2020 at 09:00:21PM -0300, Leonardo Bras wrote: > During a crash, there is chance that the cpus that handle the NMI IPI > are holding a spin_lock. If this spin_lock is needed by crashing_cpu it > will cause a deadlock. (rtas.lock and printk logbuf_lock as of today) > > This is a

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-03-31 Thread kbuild test robot
Hi Leonardo, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on paulus-powerpc/kvm-ppc-next linus/master linux/master v5.6 next-20200331] [if your patch is applied to the wrong git tree, please drop us a note to help improve the

[PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-03-31 Thread Leonardo Bras
During a crash, there is chance that the cpus that handle the NMI IPI are holding a spin_lock. If this spin_lock is needed by crashing_cpu it will cause a deadlock. (rtas.lock and printk logbuf_lock as of today) This is a problem if the system has kdump set up, given if it crashes for any reason