Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3984920imm; Mon, 14 May 2018 00:27:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoitNxK3IeejZqBZb05yS+zEP5/gFParQPiGIyAWwc2Gx1d5uu8RUepCQo16/cszWLUfVjA X-Received: by 2002:a63:494:: with SMTP id 142-v6mr3381440pge.179.1526282859950; Mon, 14 May 2018 00:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526282859; cv=none; d=google.com; s=arc-20160816; b=tNwqtH93PuMk0SDBLSoh4ADIEUGk9riw+Cy9CSonTvTrXqP97mCVuk/RXaQ/0T6qwD gEssnM0UzxLy2KwxfBBw3vfoYShWR0xBFID5IiKqAbx80ecRZTBKSi4pKsvZenCYU+Ad 7wz6lwipO1dQFgMs0D9AfIlF7U2OjjEDAxmZJM9avluLxhrB4wmVBi0eT0l9BrwXYjtx IDs4ppHhSVcgW6NedMpqZd8G/8rrvsxMm5d1nvdHZ/PzHjVaeGOBiK5gsNIgU+95Sth3 p+jLfyu/yorb5EOlGMJXYtZ6iylSLeN7WS7TrOwAznCgmtgO08UhKX0I6RAoYAMmr573 zKGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=yDz+Sj31fiHPTqmhb/dkasf/krPqtsvm6B5VW7uVfE8=; b=MveWge1unhH4HVYtqvxBTl3D+Hjw5vptOt1RqWI3Mk1cuy4dpYcsg9P4Ipre34bvLh PxfD7o1H1BjFj5fgo9NfO/rQ3KuVoxdgpJqsZCGhZuHlNKNxpmzCWcKXcLXZ19W4s3iY xqlrIWjG8OCVaoDi6kawHYjTKaB3GUSEYciAoajeezPbi11Zc0d/Df7bOUkVgBin6vaD bR6tp+jbBp/npVbk5T9ZVVejX/58Tr4NrLyvVhGhX+d+GrGMuIDgdWEMgeS29LlhW1wd QxzCxp3VNpzY5UnmmO+s3VUwV5x8P4I/lW9MWRSqVnKbLrbqMHXEd8Ad04Wc24tNhu09 J2fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=tKCXdL7f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s23-v6si8863995plr.458.2018.05.14.00.27.25; Mon, 14 May 2018 00:27:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=tKCXdL7f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753713AbeENH0M (ORCPT + 99 others); Mon, 14 May 2018 03:26:12 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:46049 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753323AbeENH0I (ORCPT ); Mon, 14 May 2018 03:26:08 -0400 Received: by mail-wr0-f193.google.com with SMTP id p5-v6so11084817wre.12; Mon, 14 May 2018 00:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yDz+Sj31fiHPTqmhb/dkasf/krPqtsvm6B5VW7uVfE8=; b=tKCXdL7fPZNO2J7LU5qQl9S8SQzFfXoCsI/IwlZ6NqbyHguybd3UK1uVJauZGIEdoB uPFNcpZTGJLNUX5YfZH9p5nQdZAjf7TteyPuvn5GHUBF/hOsx9vAKDKzgGYveDHLgr3a czZEwfQd34PZtuRz3NpNiUjH4ZPu45jMK4m8wt/DX/RrTIKwr73A+6Pw3BR8tl57gHHJ chu/za1ueHl5HVTp6x8GQTrlARS/1CxN46lMZaUXXojbnSeORWUxLrEuDqCmah+LrGJS JF8bi3LajqTtWOjnuyG2gYCidJvYeSDohwetThme2/7POiHn32BS4k+Dl7TdQFH5cJ5M KCAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=yDz+Sj31fiHPTqmhb/dkasf/krPqtsvm6B5VW7uVfE8=; b=cLZKH6mcv5ZnWoi22tZ1jfUlZr70QdfRkGfFBYy2mdl4Rj0zsPX7aSZHRzCiPaCQI4 SwvhGPEPx5aRFmJ/VyzWHvdvqakTvn2u1nCFJ7Lv87zgqWsegavP0uTwkYAoUK93sS/H Wn5ifA51h9dfS+R4aUvCSOIQodbDCtK6s+ypcY9EjZZSpSkmk4H91r/+Y5/L2abRu8zT 4t1vXdxfp65wmqEyIoHTHv75NkIuYUxbLo7uyoZggo9EM7gMX+TjouKmyagBVnq6IFG1 nukv0ztAguucL9IyS5aPeP/RlvhFkv249q+uPtbW8De168ueCK8qToTtAPsB27B1mo9I Vm/Q== X-Gm-Message-State: ALKqPwfU5wE/rB28JCgkiUhDglpK7jgDPtC7Ou0fwoSK9xQugiUxJSrW 0odwXqRBDCDRQhRqZWmXCXA= X-Received: by 2002:adf:b004:: with SMTP id f4-v6mr6294470wra.75.1526282766483; Mon, 14 May 2018 00:26:06 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id u8-v6sm7273498wmf.3.2018.05.14.00.26.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 May 2018 00:26:05 -0700 (PDT) Date: Mon, 14 May 2018 09:26:03 +0200 From: Ingo Molnar To: Dan Williams Cc: linux-nvdimm , "Luck, Tony" , Andrew Morton , Mike Snitzer , Peter Zijlstra , X86 ML , Linux Kernel Mailing List , Andy Lutomirski , Ingo Molnar , Borislav Petkov , Mika =?iso-8859-1?Q?Penttil=E4?= , linux-fsdevel , Thomas Gleixner , Linus Torvalds , Christoph Hellwig , Al Viro , Peter Zijlstra Subject: Re: use memcpy_mcsafe() for copy_to_iter() (was: Re: [PATCH v3 0/9] Series short description) Message-ID: <20180514072603.GA14099@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Dan Williams wrote: > Ingo, Thomas, Al, any concerns with this series? Yeah, so: "[PATCH v3 0/9] Series short description" ... isn't the catchiest of titles to capture my [all too easily distracted] attention! ;-) I have marked it now for -tip processing. Linus was happy with this and acked the approach, right? Thanks, Ingo > > On Thu, May 3, 2018 at 5:06 PM, Dan Williams wrote: > > Changes since v2 [1]: > > > > * Fix source address increment in mcsafe_handle_tail() (Mika) > > > > * Extend the unit test to inject simulated write faults and validate > > that data is properly transferred. > > > > * Rename MCSAFE_DEBUG to MCSAFE_TEST > > > > [1]: https://lists.01.org/pipermail/linux-nvdimm/2018-May/015583.html > > > > --- > > > > Currently memcpy_mcsafe() is only deployed in the pmem driver when > > reading through a /dev/pmemX block device. However, a filesystem in dax > > mode mounted on a /dev/pmemX block device will bypass the block layer > > and the driver for reads. The filesystem-dax (fsdax) read case uses > > dax_direct_access() and copy_to_iter() to bypass the block layer. > > > > The result of the bypass is that the kernel treats machine checks during > > read as system fatal (reboot) when they could simply be flagged as an > > I/O error, similar to performing reads through the pmem driver. Prevent > > this fatal condition by deploying memcpy_mcsafe() in the fsdax read > > path. > > > > The main differences between this copy_to_user_mcsafe() and > > copy_user_generic_unrolled() are: > > > > * Typical tail/residue handling after a fault retries the copy > > byte-by-byte until the fault happens again. Re-triggering machine > > checks is potentially fatal so the implementation uses source alignment > > and poison alignment assumptions to avoid re-triggering machine > > checks. > > > > * SMAP coordination is handled external to the assembly with > > __uaccess_begin() and __uaccess_end(). > > > > * ITER_KVEC and ITER_BVEC can now end prematurely with an error. > > > > The new MCSAFE_TEST facility is proposed as a way to unit test the > > exception handling without requiring an ACPI EINJ capable platform. > > > > --- > > > > Dan Williams (9): > > x86, memcpy_mcsafe: remove loop unrolling > > x86, memcpy_mcsafe: add labels for write fault handling > > x86, memcpy_mcsafe: return bytes remaining > > x86, memcpy_mcsafe: add write-protection-fault handling > > x86, memcpy_mcsafe: define copy_to_iter_mcsafe() > > dax: introduce a ->copy_to_iter dax operation > > dax: report bytes remaining in dax_iomap_actor() > > pmem: switch to copy_to_iter_mcsafe() > > x86, nfit_test: unit test for memcpy_mcsafe() > > > > > > arch/x86/Kconfig | 1 > > arch/x86/Kconfig.debug | 3 + > > arch/x86/include/asm/mcsafe_test.h | 75 ++++++++++++++++++++++++ > > arch/x86/include/asm/string_64.h | 10 ++- > > arch/x86/include/asm/uaccess_64.h | 14 +++++ > > arch/x86/lib/memcpy_64.S | 112 +++++++++++++++++------------------- > > arch/x86/lib/usercopy_64.c | 21 +++++++ > > drivers/dax/super.c | 10 +++ > > drivers/md/dm-linear.c | 16 +++++ > > drivers/md/dm-log-writes.c | 15 +++++ > > drivers/md/dm-stripe.c | 21 +++++++ > > drivers/md/dm.c | 25 ++++++++ > > drivers/nvdimm/claim.c | 3 + > > drivers/nvdimm/pmem.c | 13 +++- > > drivers/s390/block/dcssblk.c | 7 ++ > > fs/dax.c | 21 ++++--- > > include/linux/dax.h | 5 ++ > > include/linux/device-mapper.h | 5 +- > > include/linux/string.h | 4 + > > include/linux/uio.h | 15 +++++ > > lib/iov_iter.c | 61 ++++++++++++++++++++ > > tools/testing/nvdimm/test/nfit.c | 104 +++++++++++++++++++++++++++++++++ > > 22 files changed, 482 insertions(+), 79 deletions(-) > > create mode 100644 arch/x86/include/asm/mcsafe_test.h > > _______________________________________________ > > Linux-nvdimm mailing list > > Linux-nvdimm@lists.01.org > > https://lists.01.org/mailman/listinfo/linux-nvdimm