[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5C4C569E8A4B9B42A84A977CF070A35B2C5827AF89@USINDEVS01.corp.hds.com>
Date: Thu, 5 Jan 2012 12:41:21 -0500
From: Seiji Aguchi <seiji.aguchi@....com>
To: "Luck, Tony" <tony.luck@...el.com>, Don Zickus <dzickus@...hat.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Matthew Garrett <mjg@...hat.com>,
Vivek Goyal <vgoyal@...hat.com>,
"Chen, Gong" <gong.chen@...el.com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"Brown, Len" <len.brown@...el.com>,
"'ying.huang@...el.com'" <'ying.huang@...el.com'>,
"'ak@...ux.intel.com'" <'ak@...ux.intel.com'>,
"'hughd@...omium.org'" <'hughd@...omium.org'>,
"'mingo@...e.hu'" <'mingo@...e.hu'>,
"jmorris@...ei.org" <jmorris@...ei.org>,
"a.p.zijlstra@...llo.nl" <a.p.zijlstra@...llo.nl>,
"namhyung@...il.com" <namhyung@...il.com>,
"dle-develop@...ts.sourceforge.net"
<dle-develop@...ts.sourceforge.net>,
Satoru Moriya <satoru.moriya@....com>
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@....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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists