linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/11] Re-enable ENQCMD and PASID MSR
@ 2022-02-07 23:02 Fenghua Yu
  2022-02-07 23:02 ` [PATCH v4 01/11] iommu/sva: Rename CONFIG_IOMMU_SVA_LIB to CONFIG_IOMMU_SVA Fenghua Yu
                   ` (11 more replies)
  0 siblings, 12 replies; 113+ messages in thread
From: Fenghua Yu @ 2022-02-07 23:02 UTC (permalink / raw)
  To: Thomas Gleixner, Dave Hansen, Ingo Molnar, Borislav Petkov,
	Peter Zijlstra, Andy Lutomirski, Tony Luck, Lu Baolu,
	Joerg Roedel, Josh Poimboeuf, Jacob Pan, Ashok Raj,
	Ravi V Shankar
  Cc: iommu, x86, linux-kernel, Fenghua Yu

Problems in the old code to manage SVM (Shared Virtual Memory) devices
and the PASID (Process Address Space ID) led to that code being
disabled.

Subsequent discussions resulted in a far simpler approach:

1) PASID life cycle is from first allocation by a process until that
   process exits.
2) All tasks begin with PASID disabled
3) The #GP fault handler tries to fix faulting ENQCMD instructions very
   early (thus avoiding complexities of the XSAVE infrastructure)

Change Log:
v4:
- Update commit message in patch #4 (Thomas).
- Update commit message in patch #5 (Thomas).
- Add "Reviewed-by: Thomas Gleixner <tglx@linutronix.de>" in patch #1-#3
  and patch #6-#9 (Thomas).
- Rebased to 5.17-rc3.

v3 can be found at https://lore.kernel.org/lkml/20220128202905.2274672-7-fenghua.yu@intel.com/T/#m039e1a201e9894d99b117fa6005bc05724a5a4bb

v3:
- Rename mm_pasid_get() to mm_pasid_set() in patch #5 (Thomas).
- Remove ioasid_get() because it's not used any more when the IOASID
  is freed on mm exit in patch #5 (Thomas).
- Remove PASID's refcount exercise in ioasid_put() and rename
  ioasid_put() to ioasid_free() in patch #5 and #11 (Thomas).
- Add Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> in patch #10.

v2 can be found at https://lore.kernel.org/lkml/20211217220136.2762116-1-fenghua.yu@intel.com/

v2:
- Free PASID on mm exit instead of in exit(2) or unbind() (Thomas, AndyL,
  PeterZ)
- Directly write IA32_PASID MSR in fixup while local IRQ is still disabled
  (Thomas)
- Simplify handling ENQCMD in objtool (PeterZ and Josh)
- Define mm_pasid_get(), mm_pasid_drop(), and mm_pasid_init() in mm and
  call the functions from IOMMU (Dave Hansen).
- A few changes in the #GP fixup function (Dave Hansen, Tony Luck).
- Initial PASID value is changed to INVALID_PASID (Ashok Raj and
  Jacob Pan).
- Add mm_pasid_init(), mm_pasid_get(), and mm_pasid_drop() functions in mm.
  So the mm's PASID operations are generic for both X86 and ARM
  (Dave Hansen).
- Rename CONFIG_IOMMU_SVA_LIB to more useful and accurate
  CONFIG_IOMMU_SVA
- Use CONFIG_IOMMU_SVA for PASID processing condition (Jacob)
- The patch that cleans up old update_pasid() function is in upstream
  now (commit: 00ecd5401349 "iommu/vt-d: Clean up unused PASID updating
  functions") and therefore it's removed from this version.

v1 can be found at https://lore.kernel.org/lkml/20210920192349.2602141-1-fenghua.yu@intel.com/T/#md6d542091da1d1159eda0a44a16e57d0c0dfb209

Fenghua Yu (10):
  iommu/sva: Rename CONFIG_IOMMU_SVA_LIB to CONFIG_IOMMU_SVA
  mm: Change CONFIG option for mm->pasid field
  iommu/ioasid: Introduce a helper to check for valid PASIDs
  kernel/fork: Initialize mm's PASID
  iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm
    exit
  x86/fpu: Clear PASID when copying fpstate
  x86/traps: Demand-populate PASID MSR via #GP
  x86/cpufeatures: Re-enable ENQCMD
  tools/objtool: Check for use of the ENQCMD instruction in the kernel
  docs: x86: Change documentation for SVA (Shared Virtual Addressing)

Peter Zijlstra (1):
  sched: Define and initialize a flag to identify valid PASID in the
    task

 Documentation/x86/sva.rst                     | 53 ++++++++++++++----
 arch/x86/include/asm/disabled-features.h      |  7 ++-
 arch/x86/kernel/fpu/core.c                    |  7 +++
 arch/x86/kernel/traps.c                       | 55 +++++++++++++++++++
 drivers/iommu/Kconfig                         |  6 +-
 drivers/iommu/Makefile                        |  2 +-
 .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c   |  5 +-
 drivers/iommu/intel/Kconfig                   |  2 +-
 drivers/iommu/intel/iommu.c                   |  4 +-
 drivers/iommu/intel/svm.c                     |  9 ---
 drivers/iommu/ioasid.c                        | 39 ++-----------
 drivers/iommu/iommu-sva-lib.c                 | 39 ++++---------
 drivers/iommu/iommu-sva-lib.h                 |  7 +--
 include/linux/ioasid.h                        | 21 +++----
 include/linux/mm_types.h                      |  2 +-
 include/linux/sched.h                         |  3 +
 include/linux/sched/mm.h                      | 26 +++++++++
 kernel/fork.c                                 | 15 +++--
 mm/init-mm.c                                  |  4 ++
 tools/objtool/arch/x86/decode.c               | 11 +++-
 20 files changed, 197 insertions(+), 120 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 113+ messages in thread

end of thread, other threads:[~2022-05-06  5:36 UTC | newest]

Thread overview: 113+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07 23:02 [PATCH v4 00/11] Re-enable ENQCMD and PASID MSR Fenghua Yu
2022-02-07 23:02 ` [PATCH v4 01/11] iommu/sva: Rename CONFIG_IOMMU_SVA_LIB to CONFIG_IOMMU_SVA Fenghua Yu
2022-02-08  2:39   ` Lu Baolu
2022-02-15 10:54   ` [tip: x86/pasid] " tip-bot2 for Fenghua Yu
2022-02-07 23:02 ` [PATCH v4 02/11] mm: Change CONFIG option for mm->pasid field Fenghua Yu
2022-02-08  2:40   ` Lu Baolu
2022-02-15 10:54   ` [tip: x86/pasid] " tip-bot2 for Fenghua Yu
2022-02-07 23:02 ` [PATCH v4 03/11] iommu/ioasid: Introduce a helper to check for valid PASIDs Fenghua Yu
2022-02-08  2:40   ` Lu Baolu
2022-02-15 10:54   ` [tip: x86/pasid] " tip-bot2 for Fenghua Yu
2022-02-07 23:02 ` [PATCH v4 04/11] kernel/fork: Initialize mm's PASID Fenghua Yu
2022-02-14 17:23   ` Thomas Gleixner
2022-02-15 10:54   ` [tip: x86/pasid] " tip-bot2 for Fenghua Yu
2022-02-07 23:02 ` [PATCH v4 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit Fenghua Yu
2022-02-08  2:41   ` Lu Baolu
2022-02-08 15:01     ` Fenghua Yu
2022-02-10  3:16   ` Jacob Pan
2022-02-10 16:27     ` Fenghua Yu
2022-02-10 17:24       ` Luck, Tony
2022-02-10 18:31         ` Fenghua Yu
2022-02-10 23:52           ` Fenghua Yu
2022-02-10 18:49     ` Jacob Pan
2022-02-10 23:15       ` Fenghua Yu
2022-02-11 22:00   ` Dave Hansen
2022-02-14 17:24   ` Thomas Gleixner
2022-02-15  9:55   ` Joerg Roedel
     [not found]     ` <tencent_F6830A1196DB4C6A904D7C691F0D961D1108@qq.com>
2022-04-11 14:10       ` Dave Hansen
2022-04-11 14:20         ` zhangfei.gao
2022-04-11 14:36           ` Dave Hansen
2022-04-11 14:44             ` zhangfei.gao
2022-04-11 14:52               ` Dave Hansen
2022-04-11 15:13                 ` zhangfei.gao
2022-04-12  7:04                 ` zhangfei.gao
2022-04-12 13:41                   ` Fenghua Yu
2022-04-12 14:39                     ` Dave Hansen
2022-04-15  9:59                       ` Fenghua Yu
2022-04-12 15:35                     ` zhangfei.gao
2022-04-14 10:08                       ` zhangfei.gao
2022-04-15  9:51                         ` Fenghua Yu
     [not found]                           ` <99bcb9f5-4776-9c40-a776-cdecfa9e1010@foxmail.com>
2022-04-15 10:14                             ` zhangfei.gao
2022-04-15 10:50                             ` Fenghua Yu
2022-04-15 11:52                               ` zhangfei.gao
2022-04-15 12:37                                 ` Fenghua Yu
2022-04-16  1:30                                   ` zhangfei.gao
2022-04-15 19:07                                 ` Fenghua Yu
2022-04-15 21:00                                 ` Jacob Pan
2022-04-16  1:43                                   ` zhangfei.gao
2022-04-18 18:14                                     ` Jacob Pan
2022-04-19  1:02                                       ` zhangfei.gao
2022-04-18  6:34                                   ` Tian, Kevin
2022-04-18 18:11                                     ` Jacob Pan
2022-04-20 16:45                           ` Jean-Philippe Brucker
2022-04-21  6:47                             ` zhangfei.gao
2022-04-22  9:03                               ` zhangfei.gao
2022-04-22 10:11                                 ` Jean-Philippe Brucker
2022-04-22 13:15                                   ` zhangfei.gao
2022-04-22 15:50                                     ` Jean-Philippe Brucker
2022-04-23 11:13                                       ` zhangfei.gao
2022-04-24  2:58                                         ` Zhangfei Gao
2022-04-24  9:52                                           ` Zhangfei Gao
2022-04-25 13:53                                         ` Jean-Philippe Brucker
2022-04-25 14:18                                           ` Dave Hansen
2022-04-25 14:26                                             ` Jean-Philippe Brucker
2022-04-25 15:34                                               ` Jacob Pan
2022-04-25 16:13                                                 ` Jean-Philippe Brucker
2022-04-25 22:32                                                   ` Jacob Pan
2022-04-26  4:20                                                   ` Fenghua Yu
2022-04-26  5:04                                                     ` Zhangfei Gao
2022-04-28  0:54                                                       ` Fenghua Yu
2022-04-28  8:43                                                         ` Jean-Philippe Brucker
2022-04-28 15:09                                                     ` Dave Hansen
2022-04-28 15:28                                                       ` Fenghua Yu
2022-04-28 15:42                                                         ` Dave Hansen
2022-04-28 16:01                                                       ` Jean-Philippe Brucker
2022-04-28 16:35                                                         ` Dave Hansen
2022-04-26  4:28                                                   ` Zhangfei Gao
2022-04-26  4:36                                                     ` Fenghua Yu
2022-04-26  5:19                                                       ` Zhangfei Gao
2022-04-25 15:55                                               ` Dave Hansen
2022-04-25 16:40                                                 ` Jean-Philippe Brucker
2022-04-26 15:27                                                   ` Dave Hansen
2022-04-26 16:48                                                     ` Jean-Philippe Brucker
2022-04-26 23:31                                                       ` Dave Hansen
2022-04-28  8:39                                                         ` Jean-Philippe Brucker
2022-04-29  7:53                                                           ` Baolu Lu
2022-04-29 13:51                                                             ` Fenghua Yu
2022-04-29 14:34                                                               ` Jean-Philippe Brucker
2022-04-29 22:19                                                                 ` Fenghua Yu
2022-04-30  7:33                                                                   ` Baolu Lu
2022-05-03  7:49                                                                     ` Jean-Philippe Brucker
2022-05-06  5:36                                                                       ` Baolu Lu
2022-04-12 14:36                   ` Dave Hansen
2022-04-12 15:10                     ` Jean-Philippe Brucker
2022-04-12 15:35                       ` Dave Hansen
2022-04-13 11:14                         ` Lu Baolu
2022-04-25  2:57                         ` zhangfei.gao
2022-02-15 10:54   ` [tip: x86/pasid] " tip-bot2 for Fenghua Yu
2022-02-07 23:02 ` [PATCH v4 06/11] x86/fpu: Clear PASID when copying fpstate Fenghua Yu
2022-02-15 10:54   ` [tip: x86/pasid] " tip-bot2 for Fenghua Yu
2022-02-07 23:02 ` [PATCH v4 07/11] sched: Define and initialize a flag to identify valid PASID in the task Fenghua Yu
2022-02-15 10:54   ` [tip: x86/pasid] " tip-bot2 for Peter Zijlstra
2022-02-07 23:02 ` [PATCH v4 08/11] x86/traps: Demand-populate PASID MSR via #GP Fenghua Yu
2022-02-15 10:54   ` [tip: x86/pasid] " tip-bot2 for Fenghua Yu
2022-02-07 23:02 ` [PATCH v4 09/11] x86/cpufeatures: Re-enable ENQCMD Fenghua Yu
2022-02-15 10:54   ` [tip: x86/pasid] " tip-bot2 for Fenghua Yu
2022-02-07 23:02 ` [PATCH v4 10/11] tools/objtool: Check for use of the ENQCMD instruction in the kernel Fenghua Yu
2022-02-15 10:54   ` [tip: x86/pasid] " tip-bot2 for Fenghua Yu
2022-03-09  7:55   ` [tip: x86/core] " tip-bot2 for Fenghua Yu
2022-03-15 10:44   ` tip-bot2 for Fenghua Yu
2022-02-07 23:02 ` [PATCH v4 11/11] docs: x86: Change documentation for SVA (Shared Virtual Addressing) Fenghua Yu
2022-02-14 17:25   ` Thomas Gleixner
2022-02-15 10:54   ` [tip: x86/pasid] Documentation/x86: Update " tip-bot2 for Fenghua Yu
2022-02-11 20:04 ` [PATCH v4 00/11] Re-enable ENQCMD and PASID MSR Fenghua Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).