* [RFC][PATCH v4 0/3] make efivars/efi_pstore interrupt-safe
@ 2012-08-21 20:35 Seiji Aguchi
0 siblings, 0 replies; 2+ messages in thread
From: Seiji Aguchi @ 2012-08-21 20:35 UTC (permalink / raw)
To: Mike Waychison, linux-kernel, Luck, Tony (tony.luck@intel.com),
Matthew Garrett (mjg@redhat.com),
dzickus
Cc: dle-develop, Satoru Moriya
Changelog
v3 -> v4
- Patch 2/3
Move cancel_work_sync() above an efi_enabled test in efivars_exit().
v2 -> v3
- Patch 1/3
Replace spin_lock_irqsave/spin_unlock_irqrestore with spin_lock_irq/spin_unlock_irq in efivars_unregister(),
efivar_create(), efivar_store_raw() and efivar_delete() which are called in a process context.
- Patch 2/3
Change a name of delete_sysfs_entry() to delete_all_stale_sysfs_entries().
Also, don't release an efivar->lock while searching efivar->list in delete_all_stale_sysfs_entries().
- Patch 3/3
Remove a logic in efi_pstore_erase() which freshly created in patch v2.
v1 -> v2
- Patch 1/3
Add spin_lock_irq/spin_unlock_irq to open/close callbacks of efi_pstore
instead of moving spin_locks to a read callback.
- Patch 2/3
Replace a periodical timer with schedule_work().
- Patch 3/3
freshly create to kick a workqueue in oops case only.
[Problem]
There are following problems related to an interrupt context in efivar/efi_pstore.
Currently, efivars enables interrupt while taking efivars->lock.
So, there is a risk to be deadlocking in a write callback of efi_pstore if kernel panics
in interrupt context while taking efi_lock.
Also, efi_pstore creates sysfs entries ,which enable users to access to NVRAM, in a write callback.
If a kernel panic happens in interrupt contexts, pstore may fail because it could sleep due to dynamic
memory allocations during creating sysfs entries.
To resolve the problems above, a goal of this patchset is making efivars/efi_pstore interrupt-safe.
[Patch Description]
Patch 1/3 efivars: Disable external interrupt while holding efivars->lock
This patch replaces spin_lock/spin_unlock with spin_lock_irqsave/spin_lock_irqrestore to make efivars interrupt safe
Patch 2/3 efi_pstore: Introducing workqueue updating sysfs entries
This patch removes sysfs operations from write callback by introducing a workqueue updating sysfs entries
Patch 3/3 efi_pstore: Skiping scheduling a workqueue in cases other than oops
This patch restricts a schedule of a workqueue in case where users erase entries or oops happen which is truly needed for users.
drivers/firmware/efivars.c | 167 +++++++++++++++++++++++++++++++++++--------
include/linux/efi.h | 3 +-
2 files changed, 138 insertions(+), 32 deletions(-)
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [RFC][PATCH v4 0/3] make efivars/efi_pstore interrupt-safe
@ 2012-08-23 18:56 Seiji Aguchi
0 siblings, 0 replies; 2+ messages in thread
From: Seiji Aguchi @ 2012-08-23 18:56 UTC (permalink / raw)
To: Luck, Tony (tony.luck@intel.com)
Cc: dle-develop, Satoru Moriya, Matthew Garrett (mjg@redhat.com),
dzickus, Mike Waychison, linux-kernel
Tony,
Cloud you please review this patchset?
Seiji
> -----Original Message-----
> From: Seiji Aguchi
> Sent: Tuesday, August 21, 2012 4:35 PM
> To: 'Mike Waychison'; 'linux-kernel@vger.kernel.org'; 'Luck, Tony (tony.luck@intel.com)'; 'Matthew Garrett (mjg@redhat.com)';
> 'dzickus@redhat.com'
> Cc: 'dle-develop@lists.sourceforge.net'; Satoru Moriya
> Subject: [RFC][PATCH v4 0/3] make efivars/efi_pstore interrupt-safe
>
> Changelog
> v3 -> v4
> - Patch 2/3
> Move cancel_work_sync() above an efi_enabled test in efivars_exit().
>
> v2 -> v3
> - Patch 1/3
> Replace spin_lock_irqsave/spin_unlock_irqrestore with spin_lock_irq/spin_unlock_irq in efivars_unregister(),
> efivar_create(), efivar_store_raw() and efivar_delete() which are called in a process context.
>
> - Patch 2/3
> Change a name of delete_sysfs_entry() to delete_all_stale_sysfs_entries().
> Also, don't release an efivar->lock while searching efivar->list in delete_all_stale_sysfs_entries().
>
> - Patch 3/3
> Remove a logic in efi_pstore_erase() which freshly created in patch v2.
>
> v1 -> v2
> - Patch 1/3
> Add spin_lock_irq/spin_unlock_irq to open/close callbacks of efi_pstore
> instead of moving spin_locks to a read callback.
>
> - Patch 2/3
> Replace a periodical timer with schedule_work().
>
> - Patch 3/3
> freshly create to kick a workqueue in oops case only.
>
> [Problem]
> There are following problems related to an interrupt context in efivar/efi_pstore.
>
> Currently, efivars enables interrupt while taking efivars->lock.
> So, there is a risk to be deadlocking in a write callback of efi_pstore if kernel panics in interrupt context while taking efi_lock.
>
> Also, efi_pstore creates sysfs entries ,which enable users to access to NVRAM, in a write callback.
> If a kernel panic happens in interrupt contexts, pstore may fail because it could sleep due to dynamic memory allocations during
> creating sysfs entries.
>
> To resolve the problems above, a goal of this patchset is making efivars/efi_pstore interrupt-safe.
>
> [Patch Description]
> Patch 1/3 efivars: Disable external interrupt while holding efivars->lock
> This patch replaces spin_lock/spin_unlock with spin_lock_irqsave/spin_lock_irqrestore to make efivars interrupt safe
>
> Patch 2/3 efi_pstore: Introducing workqueue updating sysfs entries
> This patch removes sysfs operations from write callback by introducing a workqueue updating sysfs entries
>
> Patch 3/3 efi_pstore: Skiping scheduling a workqueue in cases other than oops
> This patch restricts a schedule of a workqueue in case where users erase entries or oops happen which is truly needed for users.
>
> drivers/firmware/efivars.c | 167 +++++++++++++++++++++++++++++++++++--------
> include/linux/efi.h | 3 +-
> 2 files changed, 138 insertions(+), 32 deletions(-)
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-23 18:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-21 20:35 [RFC][PATCH v4 0/3] make efivars/efi_pstore interrupt-safe Seiji Aguchi
2012-08-23 18:56 Seiji Aguchi
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).