[PATCH] efi: Disable interrupts around EFI calls, not in the epilog/prolog calls
From: Ingo Molnar
Date: Tue Mar 03 2015 - 01:34:51 EST
* Tapasweni Pathak <tapaswenipathak@xxxxxxxxx> wrote:
> Disabling interrupts around kmalloc() is less than ideal. Move it
> after the kmalloc().
>
> Found using Coccinelle.
>
> Signed-off-by: Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>
> Suggested-by: Matt Fleming <matt.fleming@xxxxxxxxx>
> ---
> arch/x86/platform/efi/efi_64.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
> index 17e80d8..5d6af59 100644
> --- a/arch/x86/platform/efi/efi_64.c
> +++ b/arch/x86/platform/efi/efi_64.c
> @@ -88,10 +88,10 @@ void __init efi_call_phys_prolog(void)
> return;
>
> early_code_mapping_set_exec(1);
> - local_irq_save(efi_flags);
>
> n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
> save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_KERNEL);
> + local_irq_save(efi_flags);
>
> for (pgd = 0; pgd < n_pgds; pgd++) {
> save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
So why are interrupts disabled around page table operations to begin
with? It's not like any of this can execute on two CPUs at once, nor
can this be executed from interrupt context.
So, shouldn't we only protect the EFI calls themselves? If we did that
we could save the efi_flags global variable ugliness as well.
I.e. something like the attached patch. (not tested and all that)
Thanks,
Ingo
===================>