[PATCH 07/26] mm: asi: Switch to unrestricted address space before a context switch

From: Brendan Jackman
Date: Fri Jul 12 2024 - 13:03:18 EST


From: Junaid Shahid <junaids@xxxxxxxxxx>

To keep things simpler for the time being, we disallow context switches
within the restricted address space. In the future, we would be able to
relax this limitation for the case of context switches to different
threads within the same process (or to the idle thread and back).

Signed-off-by: Junaid Shahid <junaids@xxxxxxxxxx>
Signed-off-by: Brendan Jackman <jackmanb@xxxxxxxxxx>
---
kernel/sched/core.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7019a40457a6..e65ac22e5a28 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -77,6 +77,7 @@
#include <asm/irq_regs.h>
#include <asm/switch_to.h>
#include <asm/tlb.h>
+#include <asm/asi.h>

#define CREATE_TRACE_POINTS
#include <linux/sched/rseq_api.h>
@@ -5353,6 +5354,8 @@ static __always_inline struct rq *
context_switch(struct rq *rq, struct task_struct *prev,
struct task_struct *next, struct rq_flags *rf)
{
+ asi_exit();
+
prepare_task_switch(rq, prev, next);

/*

--
2.45.2.993.g49e7a77208-goog