2020-04-21 20:13:52 +00:00
|
|
|
From 91fec13b5fdf4dce19d23cd229ecfdafcc6f6d22 Mon Sep 17 00:00:00 2001
|
2018-08-27 14:32:32 +00:00
|
|
|
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
|
|
Date: Tue, 24 Jul 2018 14:48:55 +0200
|
2020-04-21 20:13:52 +00:00
|
|
|
Subject: [PATCH 019/325] x86/efi: drop task_lock() from efi_switch_mm()
|
|
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.115-rt48.tar.xz
|
2018-08-27 14:32:32 +00:00
|
|
|
|
|
|
|
efi_switch_mm() is a wrapper around switch_mm() which saves current's
|
|
|
|
->active_mm, sets the requests mm as ->active_mm and invokes
|
|
|
|
switch_mm().
|
|
|
|
I don't think that task_lock() is required during that procedure. It
|
|
|
|
protects ->mm which isn't changed here.
|
|
|
|
|
|
|
|
It needs to be mentioned that during the whole procedure (switch to
|
|
|
|
EFI's mm and back) the preemption needs to be disabled. A context switch
|
|
|
|
at this point would reset the cr3 value based on current->mm. Also, this
|
|
|
|
function may not be invoked at the same time on a different CPU because
|
|
|
|
it would overwrite the efi_scratch.prev_mm information.
|
|
|
|
|
|
|
|
Remove task_lock() and also update the comment to reflect it.
|
|
|
|
|
|
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
|
|
---
|
2019-04-08 23:49:20 +00:00
|
|
|
arch/x86/platform/efi/efi_64.c | 10 ++++------
|
2018-08-27 14:32:32 +00:00
|
|
|
1 file changed, 4 insertions(+), 6 deletions(-)
|
|
|
|
|
2019-04-08 23:49:20 +00:00
|
|
|
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
|
2020-04-21 20:13:52 +00:00
|
|
|
index 2a9a703ef4a0..f104c9f2998d 100644
|
2018-08-27 14:32:32 +00:00
|
|
|
--- a/arch/x86/platform/efi/efi_64.c
|
|
|
|
+++ b/arch/x86/platform/efi/efi_64.c
|
2020-04-21 20:13:52 +00:00
|
|
|
@@ -617,18 +617,16 @@ void __init efi_dump_pagetable(void)
|
2018-08-27 14:32:32 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Makes the calling thread switch to/from efi_mm context. Can be used
|
|
|
|
- * for SetVirtualAddressMap() i.e. current->active_mm == init_mm as well
|
|
|
|
- * as during efi runtime calls i.e current->active_mm == current_mm.
|
|
|
|
- * We are not mm_dropping()/mm_grabbing() any mm, because we are not
|
|
|
|
- * losing/creating any references.
|
|
|
|
+ * in a kernel thread and user context. Preemption needs to remain disabled
|
|
|
|
+ * while the EFI-mm is borrowed. mmgrab()/mmdrop() is not used because the mm
|
|
|
|
+ * can not change under us.
|
|
|
|
+ * It should be ensured that there are no concurent calls to this function.
|
|
|
|
*/
|
|
|
|
void efi_switch_mm(struct mm_struct *mm)
|
|
|
|
{
|
|
|
|
- task_lock(current);
|
|
|
|
efi_scratch.prev_mm = current->active_mm;
|
|
|
|
current->active_mm = mm;
|
|
|
|
switch_mm(efi_scratch.prev_mm, mm, NULL);
|
|
|
|
- task_unlock(current);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_EFI_MIXED
|
2020-01-03 23:36:11 +00:00
|
|
|
--
|
2020-04-09 19:44:24 +00:00
|
|
|
2.25.1
|
2020-01-03 23:36:11 +00:00
|
|
|
|