1. 28 7月, 2022 1 次提交
  2. 18 7月, 2022 1 次提交
  3. 17 7月, 2022 1 次提交
    • T
      x86/sgx: Add infrastructure to identify SGX EPC pages · e87c3256
      Tony Luck 提交于
      mainline inclusion
      from mainline-5.17
      commit 40e0e784
      category: feature
      bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I5EZFM
      CVE: NA
      
      Intel-SIG: commit 40e0e784 x86/sgx: Add infrastructure to identify
      SGX EPC pages.
      Backport for SGX MCA recovery co-existence support
      
      --------------------------------
      
      X86 machine check architecture reports a physical address when there
      is a memory error. Handling that error requires a method to determine
      whether the physical address reported is in any of the areas reserved
      for EPC pages by BIOS.
      
      SGX EPC pages do not have Linux "struct page" associated with them.
      
      Keep track of the mapping from ranges of EPC pages to the sections
      that contain them using an xarray. N.B. adds CONFIG_XARRAY_MULTI to
      the SGX dependecies. So "select" that in arch/x86/Kconfig for X86/SGX.
      
      Create a function arch_is_platform_page() that simply reports whether an
      address is an EPC page for use elsewhere in the kernel. The ACPI error
      injection code needs this function and is typically built as a module,
      so export it.
      
      Note that arch_is_platform_page() will be slower than other similar
      "what type is this page" functions that can simply check bits in the
      "struct page".  If there is some future performance critical user of
      this function it may need to be implemented in a more efficient way.
      
      Note also that the current implementation of xarray allocates a few
      hundred kilobytes for this usage on a system with 4GB of SGX EPC memory
      configured. This isn't ideal, but worth it for the code simplicity.
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: NJarkko Sakkinen <jarkko@kernel.org>
      Tested-by: NReinette Chatre <reinette.chatre@intel.com>
      Link: https://lkml.kernel.org/r/20211026220050.697075-3-tony.luck@intel.comSigned-off-by: NZhiquan Li <zhiquan1.li@intel.com>
      e87c3256
  4. 08 7月, 2022 1 次提交
  5. 22 2月, 2022 2 次提交
  6. 22 1月, 2022 1 次提交
  7. 14 1月, 2022 2 次提交
  8. 30 12月, 2021 1 次提交
  9. 06 12月, 2021 1 次提交
  10. 15 11月, 2021 2 次提交
  11. 21 10月, 2021 1 次提交
  12. 28 7月, 2021 1 次提交
  13. 14 7月, 2021 2 次提交
    • A
      locking/qspinlock: Introduce CNA into the slow path of qspinlock · 53a2c235
      Alex Kogan 提交于
      maillist inclusion
      category: feature
      bugzilla: 169576
      CVE: NA
      
      Reference: https://lore.kernel.org/patchwork/patch/1406329/
      
      -------------------------------------------------
      
      In CNA, spinning threads are organized in two queues, a primary queue for
      threads running on the same node as the current lock holder, and a
      secondary queue for threads running on other nodes. After acquiring the
      MCS lock and before acquiring the spinlock, the MCS lock
      holder checks whether the next waiter in the primary queue (if exists) is
      running on the same NUMA node. If it is not, that waiter is detached from
      the main queue and moved into the tail of the secondary queue. This way,
      we gradually filter the primary queue, leaving only waiters running on
      the same preferred NUMA node. For more details, see
      https://arxiv.org/abs/1810.05600.
      
      Note that this variant of CNA may introduce starvation by continuously
      passing the lock between waiters in the main queue. This issue will be
      addressed later in the series.
      
      Enabling CNA is controlled via a new configuration option
      (NUMA_AWARE_SPINLOCKS). By default, the CNA variant is patched in at the
      boot time only if we run on a multi-node machine in native environment and
      the new config is enabled. (For the time being, the patching requires
      CONFIG_PARAVIRT_SPINLOCKS to be enabled as well. However, this should be
      resolved once static_call() is available.) This default behavior can be
      overridden with the new kernel boot command-line option
      "numa_spinlock=on/off" (default is "auto").
      Signed-off-by: NAlex Kogan <alex.kogan@oracle.com>
      Reviewed-by: NSteve Sistare <steven.sistare@oracle.com>
      Reviewed-by: NWaiman Long <longman@redhat.com>
      Signed-off-by: NWei Li <liwei391@huawei.com>
      Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      53a2c235
    • K
      x86: mremap speedup - Enable HAVE_MOVE_PUD · 66ec0780
      Kalesh Singh 提交于
      mainline inclusion
      from mainline-v5.11-rc1
      commit be37c98d
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I3ZFUI
      CVE: NA
      
      -------------------------------------------------
      
      HAVE_MOVE_PUD enables remapping pages at the PUD level if both the
      source and destination addresses are PUD-aligned.
      
      With HAVE_MOVE_PUD enabled it can be inferred that there is
      approximately a 13x improvement in performance on x86.  (See data
      below).
      
      ------- Test Results ---------
      
      The following results were obtained using a 5.4 kernel, by remapping
      a PUD-aligned, 1GB sized region to a PUD-aligned destination.
      The results from 10 iterations of the test are given below:
      
      Total mremap times for 1GB data on x86. All times are in nanoseconds.
      
        Control        HAVE_MOVE_PUD
      
        180394         15089
        235728         14056
        238931         25741
        187330         13838
        241742         14187
        177925         14778
        182758         14728
        160872         14418
        205813         15107
        245722         13998
      
        205721.5       15594    <-- Mean time in nanoseconds
      
      A 1GB mremap completion time drops from ~205 microseconds
      to ~15 microseconds on x86. (~13x speed up).
      
      Link: https://lkml.kernel.org/r/20201014005320.2233162-6-kaleshsingh@google.comSigned-off-by: NKalesh Singh <kaleshsingh@google.com>
      Acked-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: NIngo Molnar <mingo@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Brian Geffon <bgeffon@google.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Frederic Weisbecker <frederic@kernel.org>
      Cc: Gavin Shan <gshan@redhat.com>
      Cc: Hassan Naveed <hnaveed@wavecomp.com>
      Cc: Jia He <justin.he@arm.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: Lokesh Gidra <lokeshgidra@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Mina Almasry <almasrymina@google.com>
      Cc: Minchan Kim <minchan@google.com>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Ralph Campbell <rcampbell@nvidia.com>
      Cc: Ram Pai <linuxram@us.ibm.com>
      Cc: Sami Tolvanen <samitolvanen@google.com>
      Cc: Sandipan Das <sandipan@linux.ibm.com>
      Cc: SeongJae Park <sjpark@amazon.de>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Steven Price <steven.price@arm.com>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Zi Yan <ziy@nvidia.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
      Reviewed-by: NChen Wandun <chenwandun@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      66ec0780
  14. 04 6月, 2021 2 次提交
  15. 03 6月, 2021 2 次提交
    • I
      x86/platform/uv: Fix !KEXEC build failure · 308f0690
      Ingo Molnar 提交于
      stable inclusion
      from stable-5.10.37
      commit ee9bc379e43c949f65c8b55bd6cc4de7d62cf1c6
      bugzilla: 51868
      CVE: NA
      
      --------------------------------
      
      [ Upstream commit c2209ea5 ]
      
      When KEXEC is disabled, the UV build fails:
      
        arch/x86/platform/uv/uv_nmi.c:875:14: error: ‘uv_nmi_kexec_failed’ undeclared (first use in this function)
      
      Since uv_nmi_kexec_failed is only defined in the KEXEC_CORE #ifdef branch,
      this code cannot ever have been build tested:
      
      	if (main)
      		pr_err("UV: NMI kdump: KEXEC not supported in this kernel\n");
      	atomic_set(&uv_nmi_kexec_failed, 1);
      
      Nor is this use possible in uv_handle_nmi():
      
                      atomic_set(&uv_nmi_kexec_failed, 0);
      
      These bugs were introduced in this commit:
      
          d0a9964e: ("x86/platform/uv: Implement simple dump failover if kdump fails")
      
      Which added the uv_nmi_kexec_failed assignments to !KEXEC code, while making the
      definition KEXEC-only - apparently without testing the !KEXEC case.
      
      Instead of complicating the #ifdef maze, simplify the code by requiring X86_UV
      to depend on KEXEC_CORE. This pattern is present in other architectures as well.
      
      ( We'll remove the untested, 7 years old !KEXEC complications from the file in a
        separate commit. )
      
      Fixes: d0a9964e: ("x86/platform/uv: Implement simple dump failover if kdump fails")
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      Cc: Mike Travis <travis@sgi.com>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NWeilong Chen <chenweilong@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      308f0690
    • M
      x86/build: Disable HIGHMEM64G selection for M486SX · 5dc3516e
      Maciej W. Rozycki 提交于
      stable inclusion
      from stable-5.10.36
      commit 0c48349a6d41f1801ec457bdf9234616fe80c399
      bugzilla: 51867
      CVE: NA
      
      --------------------------------
      
      commit 0ef3439c upstream.
      
      Fix a regression caused by making the 486SX separately selectable in
      Kconfig, for which the HIGHMEM64G setting has not been updated and
      therefore has become exposed as a user-selectable option for the M486SX
      configuration setting unlike with original M486 and all the other
      settings that choose non-PAE-enabled processors:
      
        High Memory Support
        > 1. off (NOHIGHMEM)
          2. 4GB (HIGHMEM4G)
          3. 64GB (HIGHMEM64G)
        choice[1-3?]:
      
      With the fix in place the setting is now correctly removed:
      
        High Memory Support
        > 1. off (NOHIGHMEM)
          2. 4GB (HIGHMEM4G)
        choice[1-2?]:
      
       [ bp: Massage commit message. ]
      
      Fixes: 87d6021b ("x86/math-emu: Limit MATH_EMULATION to 486SX compatibles")
      Signed-off-by: NMaciej W. Rozycki <macro@orcam.me.uk>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: stable@vger.kernel.org # v5.5+
      Link: https://lkml.kernel.org/r/alpine.DEB.2.21.2104141221340.44318@angie.orcam.me.ukSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NWeilong Chen <chenweilong@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      5dc3516e
  16. 08 2月, 2021 1 次提交
  17. 27 1月, 2021 1 次提交
  18. 01 12月, 2020 1 次提交
  19. 09 10月, 2020 1 次提交
  20. 06 10月, 2020 1 次提交
    • D
      x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() · ec6347bb
      Dan Williams 提交于
      In reaction to a proposal to introduce a memcpy_mcsafe_fast()
      implementation Linus points out that memcpy_mcsafe() is poorly named
      relative to communicating the scope of the interface. Specifically what
      addresses are valid to pass as source, destination, and what faults /
      exceptions are handled.
      
      Of particular concern is that even though x86 might be able to handle
      the semantics of copy_mc_to_user() with its common copy_user_generic()
      implementation other archs likely need / want an explicit path for this
      case:
      
        On Fri, May 1, 2020 at 11:28 AM Linus Torvalds <torvalds@linux-foundation.org> wrote:
        >
        > On Thu, Apr 30, 2020 at 6:21 PM Dan Williams <dan.j.williams@intel.com> wrote:
        > >
        > > However now I see that copy_user_generic() works for the wrong reason.
        > > It works because the exception on the source address due to poison
        > > looks no different than a write fault on the user address to the
        > > caller, it's still just a short copy. So it makes copy_to_user() work
        > > for the wrong reason relative to the name.
        >
        > Right.
        >
        > And it won't work that way on other architectures. On x86, we have a
        > generic function that can take faults on either side, and we use it
        > for both cases (and for the "in_user" case too), but that's an
        > artifact of the architecture oddity.
        >
        > In fact, it's probably wrong even on x86 - because it can hide bugs -
        > but writing those things is painful enough that everybody prefers
        > having just one function.
      
      Replace a single top-level memcpy_mcsafe() with either
      copy_mc_to_user(), or copy_mc_to_kernel().
      
      Introduce an x86 copy_mc_fragile() name as the rename for the
      low-level x86 implementation formerly named memcpy_mcsafe(). It is used
      as the slow / careful backend that is supplanted by a fast
      copy_mc_generic() in a follow-on patch.
      
      One side-effect of this reorganization is that separating copy_mc_64.S
      to its own file means that perf no longer needs to track dependencies
      for its memcpy_64.S benchmarks.
      
       [ bp: Massage a bit. ]
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NTony Luck <tony.luck@intel.com>
      Acked-by: NMichael Ellerman <mpe@ellerman.id.au>
      Cc: <stable@vger.kernel.org>
      Link: http://lore.kernel.org/r/CAHk-=wjSqtXAqfUJxFtWNwmguFASTgB0dz1dT3V-78Quiezqbg@mail.gmail.com
      Link: https://lkml.kernel.org/r/160195561680.2163339.11574962055305783722.stgit@dwillia2-desk3.amr.corp.intel.com
      ec6347bb
  21. 16 9月, 2020 2 次提交
  22. 09 9月, 2020 2 次提交
  23. 08 9月, 2020 1 次提交
  24. 01 9月, 2020 2 次提交
  25. 06 8月, 2020 1 次提交
  26. 31 7月, 2020 1 次提交
  27. 24 7月, 2020 1 次提交
  28. 19 7月, 2020 1 次提交
  29. 05 7月, 2020 1 次提交
  30. 18 6月, 2020 1 次提交
  31. 15 6月, 2020 1 次提交