linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Replace and improve "mcsafe" with copy_safe()
@ 2020-04-30  8:24 Dan Williams
  2020-04-30  8:25 ` [PATCH v2 1/2] copy_safe: Rename memcpy_mcsafe() to copy_safe() Dan Williams
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Dan Williams @ 2020-04-30  8:24 UTC (permalink / raw)
  To: tglx, mingo
  Cc: Tony Luck, Peter Zijlstra, Linus Torvalds, Borislav Petkov,
	stable, x86, H. Peter Anvin, Paul Mackerras,
	Benjamin Herrenschmidt, Erwin Tsaur, Michael Ellerman,
	Arnaldo Carvalho de Melo, linux-nvdimm, linux-kernel

Changes since v1:
- Rename memcpy_mcsafe() to copy_safe() since the x86-machine-check
  specifics have already been de-emphasized in a previous commit and are
  further de-emphasized by these changes. (Linus)

- Move copy_safe() out-of-line since it no longer reverts to plain
  memcpy (Linus)

- Move copy_safe() to its own stand-alone compilation unit where it no
  longer entangles with arch/x86/lib/memcpy_64.S. This also allows perf
  to stop tracking ongoing updates to that file due to copy_safe()
  updates. (Linus)

- Move the PowerPC implementation over to the new name.

[1]: http://lore.kernel.org/r/158654083112.1572482.8944305411228188871.stgit@dwillia2-desk3.amr.corp.intel.com

---

The primary motivation to go touch memcpy_mcsafe() is that the existing
benefit of doing slow and careful copies is obviated on newer CPUs. That
fact solves the problem of needing to detect machine-check recovery
capability. Now the old "mcsafe_key" opt-in to careful copying can be made
an opt-out from the default fast copy implementation.

The discussion with Linus further made clear that this facility had
already lost its x86-machine-check specificity starting with commit
2c89130a56a ("x86/asm/memcpy_mcsafe: Add write-protection-fault
handling"). The new changes to not require a "careful copy" further
de-emphasizes the role that x86-MCA plays in the implementation to just
one more source of recoverable trap during the operation.

With the above realizations the name "mcsafe" is no longer accurate and
copy_safe() is proposed as its replacement. x86 grows a copy_safe_fast()
implementation as a default implementation that is independent of
detecting the presence of x86-MCA.

---

Dan Williams (2):
      copy_safe: Rename memcpy_mcsafe() to copy_safe()
      x86/copy_safe: Introduce copy_safe_fast()


 arch/powerpc/Kconfig                               |    2 
 arch/powerpc/include/asm/string.h                  |    2 
 arch/powerpc/include/asm/uaccess.h                 |    4 
 arch/powerpc/lib/Makefile                          |    2 
 arch/powerpc/lib/copy_safe.S                       |    4 
 arch/x86/Kconfig                                   |    2 
 arch/x86/Kconfig.debug                             |    2 
 arch/x86/include/asm/copy_safe.h                   |   18 ++
 arch/x86/include/asm/copy_safe_test.h              |   75 +++++++++
 arch/x86/include/asm/mcsafe_test.h                 |   75 ---------
 arch/x86/include/asm/string_64.h                   |   32 ----
 arch/x86/include/asm/uaccess_64.h                  |   21 ---
 arch/x86/kernel/cpu/mce/core.c                     |    9 -
 arch/x86/kernel/quirks.c                           |   10 -
 arch/x86/lib/Makefile                              |    1 
 arch/x86/lib/copy_safe.c                           |   66 ++++++++
 arch/x86/lib/copy_safe_64.S                        |  163 ++++++++++++++++++++
 arch/x86/lib/memcpy_64.S                           |  115 --------------
 arch/x86/lib/usercopy_64.c                         |   21 ---
 drivers/md/dm-writecache.c                         |   12 +
 drivers/nvdimm/claim.c                             |    2 
 drivers/nvdimm/pmem.c                              |    6 -
 include/linux/string.h                             |   17 +-
 include/linux/uio.h                                |   10 +
 lib/Kconfig                                        |    2 
 lib/iov_iter.c                                     |   36 ++--
 tools/arch/x86/include/asm/copy_safe_test.h        |   13 ++
 tools/arch/x86/include/asm/mcsafe_test.h           |   13 --
 tools/arch/x86/lib/memcpy_64.S                     |  115 --------------
 tools/objtool/check.c                              |    5 -
 tools/perf/bench/Build                             |    1 
 tools/perf/bench/mem-memcpy-x86-64-lib.c           |   24 ---
 tools/testing/nvdimm/test/nfit.c                   |   49 +++---
 .../testing/selftests/powerpc/copyloops/.gitignore |    2 
 tools/testing/selftests/powerpc/copyloops/Makefile |    6 -
 .../selftests/powerpc/copyloops/copy_safe.S        |    0 
 36 files changed, 429 insertions(+), 508 deletions(-)
 rename arch/powerpc/lib/{memcpy_mcsafe_64.S => copy_safe.S} (98%)
 create mode 100644 arch/x86/include/asm/copy_safe.h
 create mode 100644 arch/x86/include/asm/copy_safe_test.h
 delete mode 100644 arch/x86/include/asm/mcsafe_test.h
 create mode 100644 arch/x86/lib/copy_safe.c
 create mode 100644 arch/x86/lib/copy_safe_64.S
 create mode 100644 tools/arch/x86/include/asm/copy_safe_test.h
 delete mode 100644 tools/arch/x86/include/asm/mcsafe_test.h
 delete mode 100644 tools/perf/bench/mem-memcpy-x86-64-lib.c
 rename tools/testing/selftests/powerpc/copyloops/{memcpy_mcsafe_64.S => copy_safe.S} (100%)

base-commit: b8dcd632c06b8706d22934f9bf9bf16a42b1ecc7
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

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

end of thread, other threads:[~2020-05-11 15:24 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30  8:24 [PATCH v2 0/2] Replace and improve "mcsafe" with copy_safe() Dan Williams
2020-04-30  8:25 ` [PATCH v2 1/2] copy_safe: Rename memcpy_mcsafe() to copy_safe() Dan Williams
2020-04-30  8:25 ` [PATCH v2 2/2] x86/copy_safe: Introduce copy_safe_fast() Dan Williams
2020-04-30 14:02 ` [PATCH v2 0/2] Replace and improve "mcsafe" with copy_safe() Linus Torvalds
2020-04-30 16:51   ` Andy Lutomirski
2020-04-30 17:17     ` Linus Torvalds
2020-04-30 18:42       ` Andy Lutomirski
2020-04-30 19:22         ` Luck, Tony
2020-04-30 19:50           ` Linus Torvalds
2020-04-30 20:25             ` Luck, Tony
2020-04-30 23:52             ` Dan Williams
2020-05-01  0:10               ` Linus Torvalds
2020-05-01  0:23                 ` Andy Lutomirski
2020-05-01  0:39                   ` Linus Torvalds
2020-05-01  1:10                     ` Andy Lutomirski
2020-05-01 14:09                   ` Luck, Tony
2020-05-03  0:29                     ` Andy Lutomirski
2020-05-04 20:05                       ` Luck, Tony
2020-05-04 20:26                         ` Andy Lutomirski
2020-05-04 21:30                           ` Dan Williams
2020-05-01  0:24                 ` Linus Torvalds
2020-05-01  1:20                   ` Andy Lutomirski
2020-05-01  1:21                 ` Dan Williams
2020-05-01 18:28                   ` Linus Torvalds
2020-05-01 20:17                     ` Dave Hansen
2020-05-03 12:57                     ` David Laight
2020-05-04 18:33                       ` Dan Williams
2020-05-11 15:24                   ` Vivek Goyal
2020-04-30 19:51           ` Dan Williams
2020-04-30 20:07             ` Andy Lutomirski
2020-05-01  7:46         ` David Laight

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).