Message ID | CAKv+Gu86W0hBEZhz_Aw07TmRHv8kgQN7JeRMC0Qs6FL0m6BrOQ@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Tue, 08 Jul, at 01:23:55PM, Ard Biesheuvel wrote: > On 8 July 2014 13:21, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > > According to section 7.1 of the UEFI spec, Runtime Services are not fully > > reentrant, and there are particular combinations of calls that need to be > > serialized. > > > > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > > --- > > > > So this is v2 of the UEFI Runtime Services serialization patch: this time, I use > > a single spinlock rather than a set of mutexes, resulting in all services to be > > serialized with respect to all others. Also added handling of NMI state, as this > > results in some of the restrictions being lifted (x86, ia64 only) > > > > One question remains: with the NMI deadlock handling in place, is it really > > necessary to disable interrupts in all cases? > > > > I omitted this hunk from the patch by accident: I'm seeing the following build warning with this patch, In file included from include/linux/seqlock.h:35:0, from include/linux/time.h:5, from include/linux/efi.h:16, from drivers/firmware/efi/runtime-wrappers.c:18: drivers/firmware/efi/runtime-wrappers.c: In function ‘virt_efi_query_capsule_caps’: include/linux/spinlock.h:358:2: warning: ‘flags’ may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/firmware/efi/runtime-wrappers.c:275:16: note: ‘flags’ was declared here You'll need to cache the value of efi_in_nmi() in a local variable. That should be safe, since if we're not executing in NMI context when we enter the function we won't be executing in NMI context at any point in during function. It's just that gcc can't infer that information.
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 55059a50a01f..d8ee5bb527e5 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -2,6 +2,7 @@ #define _ASM_X86_EFI_H #include <asm/i387.h> +#include <asm/nmi.h> /* * We map the EFI regions needed for runtime services non-contiguously, * with preserved alignment on virtual addresses starting from -4G down @@ -52,6 +53,8 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...); kernel_fpu_end(); \ }) +#define efi_in_nmi() in_nmi() + #define efi_ioremap(addr, size, type, attr) ioremap_cache(addr, size) #else /* !CONFIG_X86_32 */