]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
efi: Provide a non-blocking SetVariable() operation
authorMatt Fleming <matt.fleming@intel.com>
Tue, 30 Sep 2014 20:58:52 +0000 (21:58 +0100)
committerMatt Fleming <matt.fleming@intel.com>
Fri, 3 Oct 2014 17:41:03 +0000 (18:41 +0100)
commit6d80dba1c9fe4316ef626980102b92fa30c7845a
tree7d2d4551430d392af7dab18ff755fab1e422fb7b
parent77e21e87acec8c857df4bfbc647ea21d0a87364d
efi: Provide a non-blocking SetVariable() operation

There are some circumstances that call for trying to write an EFI
variable in a non-blocking way. One such scenario is when writing pstore
data in efi_pstore_write() via the pstore_dump() kdump callback.

Now that we have an EFI runtime spinlock we need a way of aborting if
there is contention instead of spinning, since when writing pstore data
from the kdump callback, the runtime lock may already be held by the CPU
that's running the callback if we crashed in the middle of an EFI
variable operation.

The situation is sufficiently special that a new EFI variable operation
is warranted.

Introduce ->set_variable_nonblocking() for this use case. It is an
optional EFI backend operation, and need only be implemented by those
backends that usually acquire locks to serialize access to EFI
variables, as is the case for virt_efi_set_variable() where we now grab
the EFI runtime spinlock.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
drivers/firmware/efi/runtime-wrappers.c
drivers/firmware/efi/vars.c
include/linux/efi.h