mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Fleming <matt@console-pimps.org>
To: Seiji Aguchi <seiji.aguchi@hds.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"Luck, Tony (tony.luck@intel.com)" <tony.luck@intel.com>,
	"mikew@google.com" <mikew@google.com>,
	"cbouatmailru@gmail.com" <cbouatmailru@gmail.com>,
	"dzickus@redhat.com" <dzickus@redhat.com>,
	"dle-develop@lists.sourceforge.net" 
	<dle-develop@lists.sourceforge.net>,
	Satoru Moriya <satoru.moriya@hds.com>
Subject: Re: [PATCH v5 -next 1/2]efivars: Disable external interrupt while holding efivars->lock
Date: Sat, 09 Feb 2013 20:02:38 +0000	[thread overview]
Message-ID: <1360440158.7515.321.camel@mfleming-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <A5ED84D3BB3A384992CBB9C77DEDA4D414A541B5@USINDEM103.corp.hds.com>

On Thu, 2013-01-24 at 00:41 +0000, Seiji Aguchi wrote:
> [Problem]
> 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.
> 
> [Patch Description]
> This patch disables an external interruption while holding efivars->lock 
> as follows.
> 
> In efi_pstore_write() and get_var_data(), spin_lock/spin_unlock is 
> replaced by spin_lock_irqsave/spin_unlock_irqrestore because they may 
> be called in an interrupt context.
> 
> In other functions, they are replaced by spin_lock_irq/spin_unlock_irq.
> because they are all called from a process context.
> 
> By applying this patch, we can avoid the problem above with 
> a following senario.
> 
>  - CPUA holds an efi_var->lock with interrupt disabled.
>  - CPUB panics and sends IPI to CPUA in smp_send_stop().
>  - CPUA receives the IPI after releasing the lock because it is
>    disabling interrupt while holding the lock.
>  - CPUB waits for one sec until CPUA releases the lock.
>  - CPUB kicks efi_pstore_write() via kmsg_dump(KSMG_DUMP_PANIC)
>    And it can hold the lock successfully.
> 
> Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
> Acked-by: Mike Waychison <mikew@google.com>
> ---
>  drivers/firmware/efivars.c |   86 ++++++++++++++++++++++---------------------
>  1 files changed, 44 insertions(+), 42 deletions(-)

Acked-by: Matt Fleming <matt.fleming@intel.com>

Tony, are you picking this up?

-- 
Matt Fleming, Intel Open Source Technology Center


  reply	other threads:[~2013-02-09 20:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24  0:41 Seiji Aguchi
2013-02-09 20:02 ` Matt Fleming [this message]
2013-02-11 16:34   ` Seiji Aguchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360440158.7515.321.camel@mfleming-mobl1.ger.corp.intel.com \
    --to=matt@console-pimps.org \
    --cc=cbouatmailru@gmail.com \
    --cc=dle-develop@lists.sourceforge.net \
    --cc=dzickus@redhat.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikew@google.com \
    --cc=satoru.moriya@hds.com \
    --cc=seiji.aguchi@hds.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®