* [PATCH v5 -next 0/2] make efivars/efi_pstore interrupt-safe
@ 2013-01-24 0:40 Seiji Aguchi
2013-02-08 22:31 ` Seiji Aguchi
0 siblings, 1 reply; 3+ messages in thread
From: Seiji Aguchi @ 2013-01-24 0:40 UTC (permalink / raw)
To: linux-kernel, linux-efi, Luck, Tony (tony.luck@intel.com),
mikew, matt.fleming, cbouatmailru, dzickus
Cc: dle-develop, Satoru Moriya
Changelogv4 -> v5
- Rebase from a linus tree to a linux-next tree to avoid getting
a conflict when this patchset is merged to a linux-next tree.
- Merge previous patches 2/3 and 3/3 into 2/2 because they fix
a same problem.
- Modify to fit a latest upstream kernel as follows.
- Change spinlock operations of efivarfs which has been
introduced recently.(Patch 1/2)
- Remove delete_all_stale_sysfs_entries() from update_sysfs_entries()
because a currnet efi_pstore doesn't erase existing entries
in a write callback and sysfs entries don't become stale.
(Patch 2/2)
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 efivars
including efivarfs and efi_pstore.
(1)There is a scenario which efi_pstore fails to log messages
in a panic case.
- CPUA holds an efi_var->lock in either efivarfs parts
or efi_pstore with interrupt enabled.
- CPUB panics and sends IPI to CPUA in smp_send_stop().
- CPUA stops with holding the lock.
- CPUB kicks efi_pstore_write() via kmsg_dump(KSMG_DUMP_PANIC)
but it returns without logging messages.
(2)Also, efi_pstore creates sysfs entries, which enable users to access to
NVRAM, in a write callback.
If a kernel panic happens in an interrupt contexts, pstore may fail
because it could sleep due to dynamic memory allocations during creating
sysfs entries.
An actual failure due to the create_sysfs_entry() has been reported.
http://comments.gmane.org/gmane.linux.kernel.efi/406
To resolve problems above, this patchset makes efivars/efi_pstore
interrupt-safe.
[Patch Description]
Please see detailed explanations in each patch.
Seiji Aguchi (2):
efivars: Disable external interrupt while holding efivars->lock
- This patch fixes a problem (1).
efi_pstore: Introducing workqueue updating sysfs entries
- This patch fixes a problem (2).
drivers/firmware/efivars.c | 171 ++++++++++++++++++++++++++++++++------------
include/linux/efi.h | 3 +-
2 files changed, 126 insertions(+), 48 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH v5 -next 0/2] make efivars/efi_pstore interrupt-safe
2013-01-24 0:40 [PATCH v5 -next 0/2] make efivars/efi_pstore interrupt-safe Seiji Aguchi
@ 2013-02-08 22:31 ` Seiji Aguchi
2013-02-08 22:46 ` Matt Fleming
0 siblings, 1 reply; 3+ messages in thread
From: Seiji Aguchi @ 2013-02-08 22:31 UTC (permalink / raw)
To: Luck, Tony (tony.luck@intel.com), mikew, matt.fleming
Cc: dle-develop, Satoru Moriya, linux-kernel, linux-efi,
cbouatmailru, dzickus
Matt,
Can you please take a look at this patchset which removes create_sysfs_entries() from efi_pstore_write()?
It has been updated in accordance with Mike's comment and fixes an actual bug.
http://comments.gmane.org/gmane.linux.kernel.efi/406
Seiji
> -----Original Message-----
> From: Seiji Aguchi
> Sent: Wednesday, January 23, 2013 7:41 PM
> To: linux-kernel@vger.kernel.org; linux-efi@vger.kernel.org; Luck, Tony (tony.luck@intel.com); mikew@google.com;
> matt.fleming@intel.com; cbouatmailru@gmail.com; dzickus@redhat.com
> Cc: dle-develop@lists.sourceforge.net; Satoru Moriya
> Subject: [PATCH v5 -next 0/2] make efivars/efi_pstore interrupt-safe
>
> Changelogv4 -> v5
> - Rebase from a linus tree to a linux-next tree to avoid getting
> a conflict when this patchset is merged to a linux-next tree.
> - Merge previous patches 2/3 and 3/3 into 2/2 because they fix
> a same problem.
> - Modify to fit a latest upstream kernel as follows.
> - Change spinlock operations of efivarfs which has been
> introduced recently.(Patch 1/2)
> - Remove delete_all_stale_sysfs_entries() from update_sysfs_entries()
> because a currnet efi_pstore doesn't erase existing entries
> in a write callback and sysfs entries don't become stale.
> (Patch 2/2)
>
> 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 efivars including efivarfs and efi_pstore.
>
> (1)There is a scenario which efi_pstore fails to log messages
> in a panic case.
>
> - CPUA holds an efi_var->lock in either efivarfs parts
> or efi_pstore with interrupt enabled.
> - CPUB panics and sends IPI to CPUA in smp_send_stop().
> - CPUA stops with holding the lock.
> - CPUB kicks efi_pstore_write() via kmsg_dump(KSMG_DUMP_PANIC)
> but it returns without logging messages.
>
> (2)Also, efi_pstore creates sysfs entries, which enable users to access to
> NVRAM, in a write callback.
> If a kernel panic happens in an interrupt contexts, pstore may fail
> because it could sleep due to dynamic memory allocations during creating
> sysfs entries.
> An actual failure due to the create_sysfs_entry() has been reported.
> http://comments.gmane.org/gmane.linux.kernel.efi/406
>
> To resolve problems above, this patchset makes efivars/efi_pstore interrupt-safe.
>
> [Patch Description]
> Please see detailed explanations in each patch.
>
> Seiji Aguchi (2):
> efivars: Disable external interrupt while holding efivars->lock
> - This patch fixes a problem (1).
>
> efi_pstore: Introducing workqueue updating sysfs entries
> - This patch fixes a problem (2).
>
> drivers/firmware/efivars.c | 171 ++++++++++++++++++++++++++++++++------------
> include/linux/efi.h | 3 +-
> 2 files changed, 126 insertions(+), 48 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v5 -next 0/2] make efivars/efi_pstore interrupt-safe
2013-02-08 22:31 ` Seiji Aguchi
@ 2013-02-08 22:46 ` Matt Fleming
0 siblings, 0 replies; 3+ messages in thread
From: Matt Fleming @ 2013-02-08 22:46 UTC (permalink / raw)
To: Seiji Aguchi
Cc: Luck, Tony (tony.luck@intel.com),
mikew, dle-develop, Satoru Moriya, linux-kernel, linux-efi,
cbouatmailru, dzickus
On Fri, 2013-02-08 at 22:31 +0000, Seiji Aguchi wrote:
> Matt,
>
> Can you please take a look at this patchset which removes
> create_sysfs_entries() from efi_pstore_write()?
>
> It has been updated in accordance with Mike's comment and fixes an
> actual bug.
> http://comments.gmane.org/gmane.linux.kernel.efi/406
OK, I'll find some time to review these.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-08 22:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-24 0:40 [PATCH v5 -next 0/2] make efivars/efi_pstore interrupt-safe Seiji Aguchi
2013-02-08 22:31 ` Seiji Aguchi
2013-02-08 22:46 ` Matt Fleming
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).