hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/arch/x86/platform/efi/efi_64.c
....@@ -619,18 +619,16 @@
619619
620620 /*
621621 * Makes the calling thread switch to/from efi_mm context. Can be used
622
- * for SetVirtualAddressMap() i.e. current->active_mm == init_mm as well
623
- * as during efi runtime calls i.e current->active_mm == current_mm.
624
- * We are not mm_dropping()/mm_grabbing() any mm, because we are not
625
- * losing/creating any references.
622
+ * in a kernel thread and user context. Preemption needs to remain disabled
623
+ * while the EFI-mm is borrowed. mmgrab()/mmdrop() is not used because the mm
624
+ * can not change under us.
625
+ * It should be ensured that there are no concurent calls to this function.
626626 */
627627 void efi_switch_mm(struct mm_struct *mm)
628628 {
629
- task_lock(current);
630629 efi_scratch.prev_mm = current->active_mm;
631630 current->active_mm = mm;
632631 switch_mm(efi_scratch.prev_mm, mm, NULL);
633
- task_unlock(current);
634632 }
635633
636634 #ifdef CONFIG_EFI_MIXED