Re: [PATCH] pstore: Convert buf_lock to semaphore

2018-12-21 Thread Ard Biesheuvel
On Tue, 4 Dec 2018 at 19:06, Sebastian Andrzej Siewior wrote: > > On 2018-12-04 09:23:13 [-0800], Kees Cook wrote: > > Okay, so, if kmsg_dump() uses rcu_read_lock(), that means efi-pstore > > can _never_ sleep, and it's nothing to do with pstore internals. :( I > > guess we just hard-code it,

Re: [PATCH] pstore: Convert buf_lock to semaphore

2018-12-04 Thread Sebastian Andrzej Siewior
On 2018-12-04 09:23:13 [-0800], Kees Cook wrote: > Okay, so, if kmsg_dump() uses rcu_read_lock(), that means efi-pstore > can _never_ sleep, and it's nothing to do with pstore internals. :( I > guess we just hard-code it, then? And efi-pstore should probably only > attach to pstore if it has a

Re: [PATCH] pstore: Convert buf_lock to semaphore

2018-12-04 Thread Kees Cook
On Tue, Dec 4, 2018 at 7:41 AM Sebastian Andrzej Siewior wrote: > > On 2018-11-30 14:47:36 [-0800], Kees Cook wrote: > > diff --git a/drivers/firmware/efi/efi-pstore.c > > b/drivers/firmware/efi/efi-pstore.c > > index cfe87b465819..0f7d97917197 100644 > > --- a/drivers/firmware/efi/efi-pstore.c

Re: [PATCH] pstore: Convert buf_lock to semaphore

2018-12-04 Thread Kees Cook
On Tue, Dec 4, 2018 at 7:41 AM Sebastian Andrzej Siewior wrote: > > On 2018-11-30 14:47:36 [-0800], Kees Cook wrote: > > diff --git a/drivers/firmware/efi/efi-pstore.c > > b/drivers/firmware/efi/efi-pstore.c > > index cfe87b465819..0f7d97917197 100644 > > --- a/drivers/firmware/efi/efi-pstore.c

Re: [PATCH] pstore: Convert buf_lock to semaphore

2018-12-04 Thread Sebastian Andrzej Siewior
On 2018-11-30 14:47:36 [-0800], Kees Cook wrote: > diff --git a/drivers/firmware/efi/efi-pstore.c > b/drivers/firmware/efi/efi-pstore.c > index cfe87b465819..0f7d97917197 100644 > --- a/drivers/firmware/efi/efi-pstore.c > +++ b/drivers/firmware/efi/efi-pstore.c > @@ -259,8 +259,7 @@ static int

Re: [PATCH] pstore: Convert buf_lock to semaphore

2018-12-03 Thread Kees Cook
On Mon, Dec 3, 2018 at 8:26 AM Arnd Bergmann wrote: > > On Mon, Dec 3, 2018 at 12:18 PM Sebastian Andrzej Siewior > wrote: > > > > On 2018-12-01 09:42:38 [+0100], Arnd Bergmann wrote: > > > You are right that you can't take (or release) a mutex from interrupt > > > context. However, I don't

Re: [PATCH] pstore: Convert buf_lock to semaphore

2018-12-03 Thread Arnd Bergmann
On Mon, Dec 3, 2018 at 12:18 PM Sebastian Andrzej Siewior wrote: > > On 2018-12-01 09:42:38 [+0100], Arnd Bergmann wrote: > > You are right that you can't take (or release) a mutex from interrupt > > context. However, I don't think converting a spinlock to a semaphore > > is going to help here

Re: [PATCH] pstore: Convert buf_lock to semaphore

2018-12-03 Thread Sebastian Andrzej Siewior
On 2018-12-01 09:42:38 [+0100], Arnd Bergmann wrote: > You are right that you can't take (or release) a mutex from interrupt > context. However, I don't think converting a spinlock to a semaphore > is going to help here either. you can acquire a semaphore with a try_lock from interrupts context

Re: [PATCH] pstore: Convert buf_lock to semaphore

2018-12-01 Thread Arnd Bergmann
On Sat, Dec 1, 2018 at 3:42 AM Kees Cook wrote: > On Fri, Nov 30, 2018 at 2:52 PM Arnd Bergmann wrote: > > On Fri, Nov 30, 2018 at 11:48 PM Kees Cook wrote: > > > > > > |BUG: sleeping function called from invalid context at > > > kernel/sched/completion.c:99 > > > |in_atomic(): 1,

Re: [PATCH] pstore: Convert buf_lock to semaphore

2018-11-30 Thread Kees Cook
On Fri, Nov 30, 2018 at 2:52 PM Arnd Bergmann wrote: > > On Fri, Nov 30, 2018 at 11:48 PM Kees Cook wrote: > > > > Instead of running with interrupts disabled, use a semaphore. This should > > make it easier for backends that may need to sleep (e.g. EFI) when > > performing a write: > > > >

Re: [PATCH] pstore: Convert buf_lock to semaphore

2018-11-30 Thread Arnd Bergmann
On Fri, Nov 30, 2018 at 11:48 PM Kees Cook wrote: > > Instead of running with interrupts disabled, use a semaphore. This should > make it easier for backends that may need to sleep (e.g. EFI) when > performing a write: > > |BUG: sleeping function called from invalid context at >