From: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
To: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
sylvain.chouleur-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH v2 2/3] efi: don't use spinlocks for efi vars
Date: Fri, 15 Jul 2016 15:44:49 +0100 [thread overview]
Message-ID: <20160715144449.GB2406@codeblueprint.co.uk> (raw)
In-Reply-To: <1468249165-25523-3-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
On Mon, 11 Jul, at 04:59:24PM, Ard Biesheuvel wrote:
> From: Sylvain Chouleur <sylvain.chouleur-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
> All efivars operations are protected by a spinlock which prevents
> interruptions and preemption. This is too restricted, we just need a
> lock preventing concurrency.
> The idea is to use a semaphore of count 1 and to have two ways of
> locking, depending on the context:
> - In interrupt context, we call down_trylock(), if it fails we return
> an error
> - In normal context, we call down_interruptible()
>
> We don't use a mutex here because the mutex_trylock() function must not
> be called from interrupt context, whereas the down_trylock() can.
>
> Signed-off-by: Sylvain Chouleur <sylvain.chouleur-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> [ardb: rebased onto v4.7-rc3]
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> drivers/firmware/efi/efi-pstore.c | 36 +++--
> drivers/firmware/efi/efivars.c | 22 +++-
> drivers/firmware/efi/vars.c | 137 ++++++++++++--------
> fs/efivarfs/inode.c | 5 +-
> fs/efivarfs/super.c | 9 +-
> include/linux/efi.h | 6 +-
> 6 files changed, 143 insertions(+), 72 deletions(-)
[...]
> @@ -545,10 +562,10 @@ EXPORT_SYMBOL_GPL(efivar_entry_remove);
> */
> static void efivar_entry_list_del_unlock(struct efivar_entry *entry)
> {
> - lockdep_assert_held(&efivars_lock);
> + lockdep_assert_held(&efivars_lock.lock);
>
> list_del(&entry->list);
> - spin_unlock_irq(&efivars_lock);
> + up(&efivars_lock);
> }
>
> /**
These LOCKDEP annotations are now incorrect because the spin lock
inside the semaphore is only held while acquiring the semaphore.
I can't see an equivalent assert for semaphores, so it's probably best
to just rip these out.
Other than that, this looks OK.
next prev parent reply other threads:[~2016-07-15 14:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-11 14:59 [PATCH v2 0/3] efi interruptible runtime services Ard Biesheuvel
[not found] ` <1468249165-25523-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-07-11 14:59 ` [PATCH v2 1/3] efi: use a file local lock for efivars Ard Biesheuvel
[not found] ` <1468249165-25523-2-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-07-15 14:04 ` Matt Fleming
2016-07-11 14:59 ` [PATCH v2 2/3] efi: don't use spinlocks for efi vars Ard Biesheuvel
[not found] ` <1468249165-25523-3-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-07-15 14:44 ` Matt Fleming [this message]
2016-07-11 14:59 ` [PATCH v2 3/3] efi: replace runtime services spinlock with semaphore Ard Biesheuvel
[not found] ` <1468249165-25523-4-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-07-15 14:49 ` Matt Fleming
-- strict thread matches above, loose matches on Subject: below --
2015-12-18 10:29 [PATCH 1/2] efi: Don't use spinlocks for efi vars sylvain.chouleur-Re5JQEeQqe8AvxtiuMwx3w
2016-01-06 22:33 ` [PATCH v2 0/3] efi interruptible runtime services Sylvain Chouleur
[not found] ` <1452119637-10958-1-git-send-email-sylvain.chouleur-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-01-06 22:33 ` [PATCH v2 2/3] efi: don't use spinlocks for efi vars Sylvain Chouleur
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=20160715144449.GB2406@codeblueprint.co.uk \
--to=matt-mf/unelci9gs6ibeejttw/xrex20p6io@public.gmane.org \
--cc=ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=sylvain.chouleur-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).