linux/drivers/nvdimm
Dan Williams ec6347bb43 x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}()
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: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Acked-by: Michael 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
2020-10-06 11:18:04 +02:00
..
badrange.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295 2019-06-05 17:36:38 +02:00
blk.c block: move ->make_request_fn to struct block_device_operations 2020-07-01 07:27:24 -06:00
btt_devs.c libnvdimm: Move attribute groups to device type 2019-11-17 09:17:38 -08:00
btt.c mm: add thp_size 2020-08-14 19:56:56 -07:00
btt.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
bus.c libnvdimm: Validate command family indices 2020-07-25 19:34:47 -06:00
claim.c x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
core.c PM, libnvdimm: Add runtime firmware activation support 2020-07-28 19:28:32 -06:00
dax_devs.c libnvdimm: Move attribute groups to device type 2019-11-17 09:17:38 -08:00
dimm_devs.c libnvdimm/security: the 'security' attr never show 'overwrite' state 2020-08-03 18:54:13 -06:00
dimm.c libnvdimm/region: Introduce NDD_LABELING 2020-03-17 12:23:21 -07:00
e820.c libnvdimm/e820: Retrieve and populate correct 'target_node' info 2020-02-18 10:28:05 -08:00
Kconfig lib: Uplevel the pmem "region" ida to a global allocator 2019-11-07 15:44:29 +01:00
label.c libnvdimm/label: Remove the dpa align check 2019-09-05 16:11:14 -07:00
label.h libnvdimm/label: Replace zero-length array with flexible-array member 2020-03-30 12:37:09 -07:00
Makefile libnvdimm: Enable unit test infrastructure compile checks 2019-09-07 04:28:05 -03:00
namespace_devs.c libnvdimm: Convert to DEVICE_ATTR_ADMIN_RO() 2020-07-28 12:21:10 -06:00
nd_virtio.c virtio_pmem: fix sparse warning 2019-07-16 19:44:26 -07:00
nd-core.h PM, libnvdimm: Add runtime firmware activation support 2020-07-28 19:28:32 -06:00
nd.h nvdimm: use bio_{start,end}_io_acct 2020-05-27 05:21:23 -06:00
of_pmem.c powerpc/pmem: Initialize pmem device on newer hardware 2020-07-16 13:00:23 +10:00
pfn_devs.c libnvdimm: Convert to DEVICE_ATTR_ADMIN_RO() 2020-07-28 12:21:10 -06:00
pfn.h libnvdimm/namespace: Enforce memremap_compat_align() 2020-03-17 12:23:21 -07:00
pmem.c x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
pmem.h libnvdimm, pmem: Restore page attributes when clearing errors 2018-08-20 09:22:45 -07:00
region_devs.c libnvdimm for 5.9 2020-08-11 10:59:19 -07:00
region.c libnvdimm/region: Initialize bad block for volatile namespaces 2019-09-24 10:27:51 -07:00
security.c libnvdimm for 5.9 2020-08-11 10:59:19 -07:00
virtio_pmem.c virtio_pmem: convert to LE accessors 2020-08-05 11:08:41 -04:00
virtio_pmem.h virtio-pmem: Add virtio pmem driver 2019-07-05 15:19:10 -07:00