[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210920192349.2602141-4-fenghua.yu@intel.com>
Date: Mon, 20 Sep 2021 19:23:44 +0000
From: Fenghua Yu <fenghua.yu@...el.com>
To: "Thomas Gleixner" <tglx@...utronix.de>,
"Ingo Molnar" <mingo@...hat.com>, "Borislav Petkov" <bp@...en8.de>,
"Peter Zijlstra" <peterz@...radead.org>,
"Andy Lutomirski" <luto@...nel.org>,
"Dave Hansen" <dave.hansen@...el.com>,
"Tony Luck" <tony.luck@...el.com>,
"Lu Baolu" <baolu.lu@...ux.intel.com>,
"Joerg Roedel" <joro@...tes.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
"Dave Jiang" <dave.jiang@...el.com>,
"Jacob Jun Pan" <jacob.jun.pan@...el.com>,
"Ashok Raj" <ashok.raj@...el.com>,
"Ravi V Shankar" <ravi.v.shankar@...el.com>
Cc: iommu@...ts.linux-foundation.org, "x86" <x86@...nel.org>,
"linux-kernel" <linux-kernel@...r.kernel.org>,
Fenghua Yu <fenghua.yu@...el.com>
Subject: [PATCH 3/8] sched: Define and initialize a flag to identify valid PASID in the task
From: Peter Zijlstra <peterz@...radead.org>
Add a new field to the task structure to track whether this task
has initialized the IA32_PASID MSR (and thus holds a reference
count on the PASID for this process).
Initialize the field to zero when creating a new task with fork/clone.
Signed-off-by: Peter Zijlstra <peterz@...radead.org>
Co-developed-by: Fenghua Yu <fenghua.yu@...el.com>
Signed-off-by: Fenghua Yu <fenghua.yu@...el.com>
Reviewed-by: Tony Luck <tony.luck@...el.com>
---
include/linux/sched.h | 4 ++++
kernel/fork.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 39039ce8ac4c..21a8cff9155c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -936,6 +936,10 @@ struct task_struct {
unsigned in_eventfd_signal:1;
#endif
+#ifdef CONFIG_IOMMU_SUPPORT
+ unsigned has_valid_pasid:1;
+#endif
+
unsigned long atomic_flags; /* Flags requiring atomic access. */
struct restart_block restart_block;
diff --git a/kernel/fork.c b/kernel/fork.c
index 38681ad44c76..e379f88260eb 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -967,6 +967,10 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
tsk->use_memdelay = 0;
#endif
+#ifdef CONFIG_IOMMU_SUPPORT
+ tsk->has_valid_pasid = 0;
+#endif
+
#ifdef CONFIG_MEMCG
tsk->active_memcg = NULL;
#endif
--
2.33.0
Powered by blists - more mailing lists