RE: [PATCH 2/5] efi: Introduce a Runtime Services lock

From: Seiji Aguchi
Date: Wed Oct 16 2013 - 19:37:16 EST


> +#define efi_call_reset_virt(f, args...) \
> +({ \
> + unsigned long __flags; \
> + bool __nmi = in_nmi(); \
> + \
> + if (__nmi) \
> + spin_lock_irqsave(&efi_runtime_lock, __flags); \

If the lock is not held in the nmi context, runtime service may run concurrently
in non-nmi context as follows.
- In nmi context, cpu0 calls a runtime service (no lock is held.)
- In non-nmi context, cpu1 call can take the lock and call the runtime service.

To avoid this, using try_lock in nmi context is better..

If(in_nmi())
try_spin_lock_irqsave();
else
spin_lock_irqsave();

Please see the commit abd4d5587be911f63592537284dad78766d97d62,
which is introduced to pstore by Don Zickus.

Seiji



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/