From ad0345abd4e9bd45b446bccc24893b5ea3ce898c Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Mon, 7 Feb 2022 15:02:50 -0800 Subject: [PATCH] sched: Define and initialize a flag to identify valid PASID in the task mainline inclusion from mainline-v5.18 commit a3d29e8291b622780eb6e4e3eeaf2b24ec78fd43 category: feature bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I596WO CVE: NA Intel-SIG: commit a3d29e8291b6 sched: Define and initialize a flag to identify valid PASID in the task. Incremental backporting patches for DSA/IAA on Intel Xeon platform. -------------------------------- Add a new single bit field to the task structure to track whether this task has initialized the IA32_PASID MSR to the mm's PASID. Initialize the field to zero when creating a new task with fork/clone. Signed-off-by: Peter Zijlstra Co-developed-by: Fenghua Yu Signed-off-by: Fenghua Yu Signed-off-by: Borislav Petkov Reviewed-by: Tony Luck Reviewed-by: Thomas Gleixner Link: https://lore.kernel.org/r/20220207230254.3342514-8-fenghua.yu@intel.com Signed-off-by: Xiaochen Shen --- include/linux/sched.h | 3 +++ kernel/fork.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index 888e5cc2fb6a..50b7414946d3 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -872,6 +872,9 @@ struct task_struct { /* Stalled due to lack of memory */ unsigned in_memstall:1; #endif +#ifdef CONFIG_IOMMU_SVA + unsigned pasid_activated:1; +#endif unsigned long atomic_flags; /* Flags requiring atomic access. */ diff --git a/kernel/fork.c b/kernel/fork.c index 1d702e8f4b72..72d2834cc4fd 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -963,6 +963,10 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node) tsk->use_memdelay = 0; #endif +#ifdef CONFIG_IOMMU_SVA + tsk->pasid_activated = 0; +#endif + #ifdef CONFIG_MEMCG tsk->active_memcg = NULL; #endif -- GitLab