Messages in this thread Patch in this message | | | From | Seiji Aguchi <> | Date | Thu, 5 Jan 2012 12:41:21 -0500 | Subject | [RFC][PATCH v4 -next 4/4] Skip spin_lock of efi_pstore_write() in panic case |
| |
This patch skips spin_lock of efi_pstore_write() in panic path for these reasons. - efi_pstore_write() is serialized via smp_send_stop(). - SetVariable runtime service is guaranteed to work correctly if you call it a second time when you have taken an exception in trying to execute them already.
We can avoid deadlock of spin_lock(&efivars->lock) in panic path and get panic log reliably.
Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
--- drivers/firmware/efivars.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index d25599f..657e6f1 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c @@ -510,7 +510,15 @@ static int efi_pstore_write(enum pstore_type_id type, sprintf(stub_name, "dump-type%u-%u-", type, part); sprintf(name, "%s%lu", stub_name, get_seconds()); - spin_lock(&efivars->lock); + /* + * We don't need to take any locks in panic path for these reasons. + * - efi_pstore_write() is serialized via smp_send_stop(). + * - SetVariable runtime service is guaranteed to work correctly + * if you call it a second time when you have taken an exception + * in trying to execute them already. + */ + if (reason != KMSG_DUMP_PANIC) + spin_lock(&efivars->lock); for (i = 0; i < DUMP_NAME_LEN; i++) efi_name[i] = stub_name[i]; @@ -548,7 +556,8 @@ static int efi_pstore_write(enum pstore_type_id type, efivars->ops->set_variable(efi_name, &vendor, PSTORE_EFI_ATTRIBUTES, size, psi->buf); - spin_unlock(&efivars->lock); + if (reason != KMSG_DUMP_PANIC) + spin_unlock(&efivars->lock); if (found) efivar_unregister(found); -- 1.7.1
| |