1. 07 4月, 2022 1 次提交
  2. 15 3月, 2022 1 次提交
  3. 21 2月, 2022 1 次提交
  4. 08 2月, 2022 1 次提交
  5. 04 2月, 2022 1 次提交
  6. 15 1月, 2022 1 次提交
  7. 30 12月, 2021 1 次提交
  8. 26 10月, 2021 2 次提交
  9. 15 6月, 2021 1 次提交
    • P
      x86/msr: Define new bits in TSX_FORCE_ABORT MSR · 1348924b
      Pawan Gupta 提交于
      Intel client processors that support the IA32_TSX_FORCE_ABORT MSR
      related to perf counter interaction [1] received a microcode update that
      deprecates the Transactional Synchronization Extension (TSX) feature.
      The bit FORCE_ABORT_RTM now defaults to 1, writes to this bit are
      ignored. A new bit TSX_CPUID_CLEAR clears the TSX related CPUID bits.
      
      The summary of changes to the IA32_TSX_FORCE_ABORT MSR are:
      
        Bit 0: FORCE_ABORT_RTM (legacy bit, new default=1) Status bit that
        indicates if RTM transactions are always aborted. This bit is
        essentially !SDV_ENABLE_RTM(Bit 2). Writes to this bit are ignored.
      
        Bit 1: TSX_CPUID_CLEAR (new bit, default=0) When set, CPUID.HLE = 0
        and CPUID.RTM = 0.
      
        Bit 2: SDV_ENABLE_RTM (new bit, default=0) When clear, XBEGIN will
        always abort with EAX code 0. When set, XBEGIN will not be forced to
        abort (but will always abort in SGX enclaves). This bit is intended to
        be used on developer systems. If this bit is set, transactional
        atomicity correctness is not certain. SDV = Software Development
        Vehicle (SDV), i.e. developer systems.
      
      Performance monitoring counter 3 is usable in all cases, regardless of
      the value of above bits.
      
      Add support for a new CPUID bit - CPUID.RTM_ALWAYS_ABORT (CPUID 7.EDX[11])
       - to indicate the status of always abort behavior.
      
      [1] [ bp: Look for document ID 604224, "Performance Monitoring Impact
            of Intel Transactional Synchronization Extension Memory". Since
            there's no way for us to have stable links to documents... ]
      
       [ bp: Massage and extend commit message. ]
      Signed-off-by: NPawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NAndi Kleen <ak@linux.intel.com>
      Reviewed-by: NTony Luck <tony.luck@intel.com>
      Tested-by: NNeelima Krishnan <neelima.krishnan@intel.com>
      Link: https://lkml.kernel.org/r/9add61915b4a4eedad74fbd869107863a28b428e.1623704845.git-series.pawan.kumar.gupta@linux.intel.com
      1348924b
  10. 02 6月, 2021 1 次提交
  11. 20 4月, 2021 1 次提交
  12. 29 3月, 2021 1 次提交
  13. 26 3月, 2021 1 次提交
  14. 15 3月, 2021 2 次提交
    • P
      x86: Remove dynamic NOP selection · a89dfde3
      Peter Zijlstra 提交于
      This ensures that a NOP is a NOP and not a random other instruction that
      is also a NOP. It allows simplification of dynamic code patching that
      wants to verify existing code before writing new instructions (ftrace,
      jump_label, static_call, etc..).
      
      Differentiating on NOPs is not a feature.
      
      This pessimises 32bit (DONTCARE) and 32bit on 64bit CPUs (CARELESS).
      32bit is not a performance target.
      
      Everything x86_64 since AMD K10 (2007) and Intel IvyBridge (2012) is
      fine with using NOPL (as opposed to prefix NOP). And per FEATURE_NOPL
      being required for x86_64, all x86_64 CPUs can use NOPL. So stop
      caring about NOPs, simplify things and get on with life.
      
      [ The problem seems to be that some uarchs can only decode NOPL on a
      single front-end port while others have severe decode penalties for
      excessive prefixes. All modern uarchs can handle both, except Atom,
      which has prefix penalties. ]
      
      [ Also, much doubt you can actually measure any of this on normal
      workloads. ]
      
      After this, FEATURE_NOPL is unused except for required-features for
      x86_64. FEATURE_K8 is only used for PTI.
      
       [ bp: Kernel build measurements showed ~0.3s slowdown on Sandybridge
         which is hardly a slowdown. Get rid of X86_FEATURE_K7, while at it. ]
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Acked-by: Alexei Starovoitov <alexei.starovoitov@gmail.com> # bpf
      Acked-by: NLinus Torvalds <torvalds@linuxfoundation.org>
      Link: https://lkml.kernel.org/r/20210312115749.065275711@infradead.org
      a89dfde3
    • B
      x86/cpufeatures: Add the Virtual SPEC_CTRL feature · f333374e
      Babu Moger 提交于
      Newer AMD processors have a feature to virtualize the use of the
      SPEC_CTRL MSR. Presence of this feature is indicated via CPUID
      function 0x8000000A_EDX[20]: GuestSpecCtrl. When present, the
      SPEC_CTRL MSR is automatically virtualized.
      Signed-off-by: NBabu Moger <babu.moger@amd.com>
      Acked-by: NBorislav Petkov <bp@suse.de>
      Message-Id: <161188100272.28787.4097272856384825024.stgit@bmoger-ubuntu>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f333374e
  15. 12 3月, 2021 1 次提交
  16. 04 2月, 2021 2 次提交
  17. 29 1月, 2021 1 次提交
  18. 15 12月, 2020 1 次提交
    • T
      x86/cpu: Add VM page flush MSR availablility as a CPUID feature · 69372cf0
      Tom Lendacky 提交于
      On systems that do not have hardware enforced cache coherency between
      encrypted and unencrypted mappings of the same physical page, the
      hypervisor can use the VM page flush MSR (0xc001011e) to flush the cache
      contents of an SEV guest page. When a small number of pages are being
      flushed, this can be used in place of issuing a WBINVD across all CPUs.
      
      CPUID 0x8000001f_eax[2] is used to determine if the VM page flush MSR is
      available. Add a CPUID feature to indicate it is supported and define the
      MSR.
      Signed-off-by: NTom Lendacky <thomas.lendacky@amd.com>
      Message-Id: <f1966379e31f9b208db5257509c4a089a87d33d0.1607620209.git.thomas.lendacky@amd.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      69372cf0
  19. 12 12月, 2020 1 次提交
    • K
      x86: Enumerate AVX512 FP16 CPUID feature flag · e1b35da5
      Kyung Min Park 提交于
      Enumerate AVX512 Half-precision floating point (FP16) CPUID feature
      flag. Compared with using FP32, using FP16 cut the number of bits
      required for storage in half, reducing the exponent from 8 bits to 5,
      and the mantissa from 23 bits to 10. Using FP16 also enables developers
      to train and run inference on deep learning models fast when all
      precision or magnitude (FP32) is not needed.
      
      A processor supports AVX512 FP16 if CPUID.(EAX=7,ECX=0):EDX[bit 23]
      is present. The AVX512 FP16 requires AVX512BW feature be implemented
      since the instructions for manipulating 32bit masks are associated with
      AVX512BW.
      
      The only in-kernel usage of this is kvm passthrough. The CPU feature
      flag is shown as "avx512_fp16" in /proc/cpuinfo.
      Signed-off-by: NKyung Min Park <kyung.min.park@intel.com>
      Acked-by: NDave Hansen <dave.hansen@intel.com>
      Reviewed-by: NTony Luck <tony.luck@intel.com>
      Message-Id: <20201208033441.28207-2-kyung.min.park@intel.com>
      Acked-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e1b35da5
  20. 17 11月, 2020 2 次提交
  21. 18 9月, 2020 2 次提交
  22. 08 9月, 2020 1 次提交
  23. 30 8月, 2020 1 次提交
  24. 26 8月, 2020 1 次提交
  25. 27 7月, 2020 1 次提交
  26. 08 7月, 2020 1 次提交
  27. 16 6月, 2020 1 次提交
  28. 20 4月, 2020 1 次提交
    • M
      x86/speculation: Add Special Register Buffer Data Sampling (SRBDS) mitigation · 7e5b3c26
      Mark Gross 提交于
      SRBDS is an MDS-like speculative side channel that can leak bits from the
      random number generator (RNG) across cores and threads. New microcode
      serializes the processor access during the execution of RDRAND and
      RDSEED. This ensures that the shared buffer is overwritten before it is
      released for reuse.
      
      While it is present on all affected CPU models, the microcode mitigation
      is not needed on models that enumerate ARCH_CAPABILITIES[MDS_NO] in the
      cases where TSX is not supported or has been disabled with TSX_CTRL.
      
      The mitigation is activated by default on affected processors and it
      increases latency for RDRAND and RDSEED instructions. Among other
      effects this will reduce throughput from /dev/urandom.
      
      * Enable administrator to configure the mitigation off when desired using
        either mitigations=off or srbds=off.
      
      * Export vulnerability status via sysfs
      
      * Rename file-scoped macros to apply for non-whitelist table initializations.
      
       [ bp: Massage,
         - s/VULNBL_INTEL_STEPPING/VULNBL_INTEL_STEPPINGS/g,
         - do not read arch cap MSR a second time in tsx_fused_off() - just pass it in,
         - flip check in cpu_set_bug_bits() to save an indentation level,
         - reflow comments.
         jpoimboe: s/Mitigated/Mitigation/ in user-visible strings
         tglx: Dropped the fused off magic for now
       ]
      Signed-off-by: NMark Gross <mgross@linux.intel.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NTony Luck <tony.luck@intel.com>
      Reviewed-by: NPawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Reviewed-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Tested-by: NNeelima Krishnan <neelima.krishnan@intel.com>
      7e5b3c26
  29. 22 3月, 2020 1 次提交
  30. 12 3月, 2020 1 次提交
  31. 21 2月, 2020 1 次提交
    • P
      x86/split_lock: Enable split lock detection by kernel · 6650cdd9
      Peter Zijlstra (Intel) 提交于
      A split-lock occurs when an atomic instruction operates on data that spans
      two cache lines. In order to maintain atomicity the core takes a global bus
      lock.
      
      This is typically >1000 cycles slower than an atomic operation within a
      cache line. It also disrupts performance on other cores (which must wait
      for the bus lock to be released before their memory operations can
      complete). For real-time systems this may mean missing deadlines. For other
      systems it may just be very annoying.
      
      Some CPUs have the capability to raise an #AC trap when a split lock is
      attempted.
      
      Provide a command line option to give the user choices on how to handle
      this:
      
      split_lock_detect=
      	off	- not enabled (no traps for split locks)
      	warn	- warn once when an application does a
      		  split lock, but allow it to continue
      		  running.
      	fatal	- Send SIGBUS to applications that cause split lock
      
      On systems that support split lock detection the default is "warn". Note
      that if the kernel hits a split lock in any mode other than "off" it will
      OOPs.
      
      One implementation wrinkle is that the MSR to control the split lock
      detection is per-core, not per thread. This might result in some short
      lived races on HT systems in "warn" mode if Linux tries to enable on one
      thread while disabling on the other. Race analysis by Sean Christopherson:
      
        - Toggling of split-lock is only done in "warn" mode.  Worst case
          scenario of a race is that a misbehaving task will generate multiple
          #AC exceptions on the same instruction.  And this race will only occur
          if both siblings are running tasks that generate split-lock #ACs, e.g.
          a race where sibling threads are writing different values will only
          occur if CPUx is disabling split-lock after an #AC and CPUy is
          re-enabling split-lock after *its* previous task generated an #AC.
        - Transitioning between off/warn/fatal modes at runtime isn't supported
          and disabling is tracked per task, so hardware will always reach a steady
          state that matches the configured mode.  I.e. split-lock is guaranteed to
          be enabled in hardware once all _TIF_SLD threads have been scheduled out.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Co-developed-by: NFenghua Yu <fenghua.yu@intel.com>
      Signed-off-by: NFenghua Yu <fenghua.yu@intel.com>
      Co-developed-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Link: https://lore.kernel.org/r/20200126200535.GB30377@agluck-desk2.amr.corp.intel.com
      6650cdd9
  32. 14 1月, 2020 1 次提交
    • S
      x86/cpufeatures: Add flag to track whether MSR IA32_FEAT_CTL is configured · 85c17291
      Sean Christopherson 提交于
      Add a new feature flag, X86_FEATURE_MSR_IA32_FEAT_CTL, to track whether
      IA32_FEAT_CTL has been initialized.  This will allow KVM, and any future
      subsystems that depend on IA32_FEAT_CTL, to rely purely on cpufeatures
      to query platform support, e.g. allows a future patch to remove KVM's
      manual IA32_FEAT_CTL MSR checks.
      
      Various features (on platforms that support IA32_FEAT_CTL) are dependent
      on IA32_FEAT_CTL being configured and locked, e.g. VMX and LMCE.  The
      MSR is always configured during boot, but only if the CPU vendor is
      recognized by the kernel.  Because CPUID doesn't incorporate the current
      IA32_FEAT_CTL value in its reporting of relevant features, it's possible
      for a feature to be reported as supported in cpufeatures but not truly
      enabled, e.g. if the CPU supports VMX but the kernel doesn't recognize
      the CPU.
      
      As a result, without the flag, KVM would see VMX as supported even if
      IA32_FEAT_CTL hasn't been initialized, and so would need to manually
      read the MSR and check the various enabling bits to avoid taking an
      unexpected #GP on VMXON.
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Link: https://lkml.kernel.org/r/20191221044513.21680-14-sean.j.christopherson@intel.com
      85c17291
  33. 08 1月, 2020 1 次提交
    • T
      x86/cpufeatures: Add support for fast short REP; MOVSB · f444a5ff
      Tony Luck 提交于
      >From the Intel Optimization Reference Manual:
      
      3.7.6.1 Fast Short REP MOVSB
      Beginning with processors based on Ice Lake Client microarchitecture,
      REP MOVSB performance of short operations is enhanced. The enhancement
      applies to string lengths between 1 and 128 bytes long.  Support for
      fast-short REP MOVSB is enumerated by the CPUID feature flag: CPUID
      [EAX=7H, ECX=0H).EDX.FAST_SHORT_REP_MOVSB[bit 4] = 1. There is no change
      in the REP STOS performance.
      
      Add an X86_FEATURE_FSRM flag for this.
      
      memmove() avoids REP MOVSB for short (< 32 byte) copies. Check FSRM and
      use REP MOVSB for short copies on systems that support it.
      
       [ bp: Massage and add comment. ]
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Link: https://lkml.kernel.org/r/20191216214254.26492-1-tony.luck@intel.com
      f444a5ff
  34. 04 11月, 2019 1 次提交
  35. 28 10月, 2019 1 次提交
    • P
      x86/speculation/taa: Add mitigation for TSX Async Abort · 1b42f017
      Pawan Gupta 提交于
      TSX Async Abort (TAA) is a side channel vulnerability to the internal
      buffers in some Intel processors similar to Microachitectural Data
      Sampling (MDS). In this case, certain loads may speculatively pass
      invalid data to dependent operations when an asynchronous abort
      condition is pending in a TSX transaction.
      
      This includes loads with no fault or assist condition. Such loads may
      speculatively expose stale data from the uarch data structures as in
      MDS. Scope of exposure is within the same-thread and cross-thread. This
      issue affects all current processors that support TSX, but do not have
      ARCH_CAP_TAA_NO (bit 8) set in MSR_IA32_ARCH_CAPABILITIES.
      
      On CPUs which have their IA32_ARCH_CAPABILITIES MSR bit MDS_NO=0,
      CPUID.MD_CLEAR=1 and the MDS mitigation is clearing the CPU buffers
      using VERW or L1D_FLUSH, there is no additional mitigation needed for
      TAA. On affected CPUs with MDS_NO=1 this issue can be mitigated by
      disabling the Transactional Synchronization Extensions (TSX) feature.
      
      A new MSR IA32_TSX_CTRL in future and current processors after a
      microcode update can be used to control the TSX feature. There are two
      bits in that MSR:
      
      * TSX_CTRL_RTM_DISABLE disables the TSX sub-feature Restricted
      Transactional Memory (RTM).
      
      * TSX_CTRL_CPUID_CLEAR clears the RTM enumeration in CPUID. The other
      TSX sub-feature, Hardware Lock Elision (HLE), is unconditionally
      disabled with updated microcode but still enumerated as present by
      CPUID(EAX=7).EBX{bit4}.
      
      The second mitigation approach is similar to MDS which is clearing the
      affected CPU buffers on return to user space and when entering a guest.
      Relevant microcode update is required for the mitigation to work.  More
      details on this approach can be found here:
      
        https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/mds.html
      
      The TSX feature can be controlled by the "tsx" command line parameter.
      If it is force-enabled then "Clear CPU buffers" (MDS mitigation) is
      deployed. The effective mitigation state can be read from sysfs.
      
       [ bp:
         - massage + comments cleanup
         - s/TAA_MITIGATION_TSX_DISABLE/TAA_MITIGATION_TSX_DISABLED/g - Josh.
         - remove partial TAA mitigation in update_mds_branch_idle() - Josh.
         - s/tsx_async_abort_cmdline/tsx_async_abort_parse_cmdline/g
       ]
      Signed-off-by: NPawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      1b42f017