Re: [PATCH 19/23] x86/efi: Make efi_enter/leave_mm use the temporary_mm machinery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 8 Jan 2022 at 17:44, Andy Lutomirski <luto@xxxxxxxxxx> wrote:
>
> This should be considerably more robust.  It's also necessary for optimized
> for_each_possible_lazymm_cpu() on x86 -- without this patch, EFI calls in
> lazy context would remove the lazy mm from mm_cpumask().
>
> Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>
> Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>

Acked-by: Ard Biesheuvel <ardb@xxxxxxxxxx>

> ---
>  arch/x86/platform/efi/efi_64.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
> index 7515e78ef898..b9a571904363 100644
> --- a/arch/x86/platform/efi/efi_64.c
> +++ b/arch/x86/platform/efi/efi_64.c
> @@ -54,7 +54,7 @@
>   * 0xffff_ffff_0000_0000 and limit EFI VA mapping space to 64G.
>   */
>  static u64 efi_va = EFI_VA_START;
> -static struct mm_struct *efi_prev_mm;
> +static temp_mm_state_t efi_temp_mm_state;
>
>  /*
>   * We need our own copy of the higher levels of the page tables
> @@ -461,15 +461,12 @@ void __init efi_dump_pagetable(void)
>   */
>  void efi_enter_mm(void)
>  {
> -       efi_prev_mm = current->active_mm;
> -       current->active_mm = &efi_mm;
> -       switch_mm(efi_prev_mm, &efi_mm, NULL);
> +       efi_temp_mm_state = use_temporary_mm(&efi_mm);
>  }
>
>  void efi_leave_mm(void)
>  {
> -       current->active_mm = efi_prev_mm;
> -       switch_mm(&efi_mm, efi_prev_mm, NULL);
> +       unuse_temporary_mm(efi_temp_mm_state);
>  }
>
>  static DEFINE_SPINLOCK(efi_runtime_lock);
> --
> 2.33.1
>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux