From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755703AbdEEUju (ORCPT ); Fri, 5 May 2017 16:39:50 -0400 Received: from g2t2353.austin.hpe.com ([15.233.44.26]:3139 "EHLO g2t2353.austin.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751360AbdEEUjq (ORCPT ); Fri, 5 May 2017 16:39:46 -0400 From: "Kani, Toshimitsu" To: "dan.j.williams@intel.com" , "viro@zeniv.linux.org.uk" CC: "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "jmoyer@redhat.com" , "tglx@linutronix.de" , "hch@lst.de" , "x86@kernel.org" , "mawilcox@microsoft.com" , "hpa@zytor.com" , "linux-nvdimm@lists.01.org" , "mingo@redhat.com" , "linux-fsdevel@vger.kernel.org" , "ross.zwisler@linux.intel.com" , "jack@suse.cz" Subject: Re: [PATCH v2] x86, uaccess: introduce copy_from_iter_wt for pmem / writethrough operations Thread-Topic: [PATCH v2] x86, uaccess: introduce copy_from_iter_wt for pmem / writethrough operations Thread-Index: AQHSwFf2pYpBQohMYEm6dbBc4FPj86HmPreA Date: Fri, 5 May 2017 20:39:40 +0000 Message-ID: <1494016773.30303.69.camel@hpe.com> References: <20170427063054.soejyqocqqrihfdw@gmail.com> <149340820800.28724.16189291963486607562.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <149340820800.28724.16189291963486607562.stgit@dwillia2-desk3.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=hpe.com; x-originating-ip: [15.219.163.8] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AT5PR84MB0257;7:6OcvcWrhtVJbK0tSOpV992iJXVodnxs3TAcBVkVYmWFUjh3VyBmjABhfJwvYUFn+0Bylww9aoouBKdDMgMHdd3AbKCEKstISQ5dFWPoRvBancTxMJfdu4Ic2MQFyQxPqHNZxzT7kTXpbHxqJ8ZaTskxTYUmEoENLBtgYHvm+qfYPUqMpflOrDHZXdlh49xCYRW2ZGLOA7ioJYzBKVHfxYhuSGXgwkTWg93QWknWLm4MFc0O79uswuZZ6EzolrmsFujJOWBRD4omKfZtWsNmahGY3ZlgtVJcu9XhiazvecERZDvbJwbTIWJmlbqBZ6xEdXLdtoLXYKRVOPQMxz5vwnQ== x-ms-office365-filtering-correlation-id: 1a3ad6f5-c29c-47f2-cdc1-08d493f6dabb x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075);SRVR:AT5PR84MB0257; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(788757137089)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123560025)(20161123558100)(20161123562025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148);SRVR:AT5PR84MB0257;BCL:0;PCL:0;RULEID:;SRVR:AT5PR84MB0257; x-forefront-prvs: 02981BE340 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(39400400002)(39850400002)(39450400003)(39410400002)(39840400002)(24454002)(377424004)(7736002)(76176999)(2900100001)(305945005)(229853002)(5660300001)(2906002)(50986999)(8936002)(7416002)(8676002)(66066001)(103116003)(3280700002)(54356999)(3660700001)(33646002)(81166006)(2950100002)(189998001)(478600001)(102836003)(6116002)(5250100002)(8666007)(6512007)(6506006)(6246003)(53936002)(38730400002)(6306002)(54906002)(3846002)(6436002)(6486002)(36756003)(25786009)(4326008)(2501003)(86362001);DIR:OUT;SFP:1102;SCL:1;SRVR:AT5PR84MB0257;H:AT5PR84MB0260.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <969868269BC7374CABDDB2EE1A515FB9@NAMPRD84.PROD.OUTLOOK.COM> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 May 2017 20:39:40.4689 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: AT5PR84MB0257 X-OriginatorOrg: hpe.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v45Kdv5N023596 On Fri, 2017-04-28 at 12:39 -0700, Dan Williams wrote: > The pmem driver has a need to transfer data with a persistent memory > destination and be able to rely on the fact that the destination > writes are not cached. It is sufficient for the writes to be flushed > to a cpu-store-buffer (non-temporal / "movnt" in x86 terms), as we > expect userspace to call fsync() to ensure data-writes have reached a > power-fail-safe zone in the platform. The fsync() triggers a REQ_FUA > or REQ_FLUSH to the pmem driver which will turn around and fence > previous writes with an "sfence". > > Implement a __copy_from_user_inatomic_wt, memcpy_page_wt, and > memcpy_wt, that guarantee that the destination buffer is not dirty in > the cpu cache on completion. The new copy_from_iter_wt and sub- > routines will be used to replace the "pmem api" (include/linux/pmem.h > + arch/x86/include/asm/pmem.h). The availability of > copy_from_iter_wt() and memcpy_wt() are gated by the > CONFIG_ARCH_HAS_UACCESS_WT config symbol, and fallback to > copy_from_iter_nocache() and plain memcpy() otherwise. > > This is meant to satisfy the concern from Linus that if a driver > wants to do something beyond the normal nocache semantics it should > be something private to that driver [1], and Al's concern that > anything uaccess related belongs with the rest of the uaccess code > [2]. > > [1]: https://lists.01.org/pipermail/linux-nvdimm/2017-January/008364. > html > [2]: https://lists.01.org/pipermail/linux-nvdimm/2017-April/009942.ht > ml > > Cc: > Cc: Jan Kara > Cc: Jeff Moyer > Cc: Ingo Molnar > Cc: Christoph Hellwig > Cc: "H. Peter Anvin" > Cc: Al Viro > Cc: Thomas Gleixner > Cc: Matthew Wilcox > Cc: Ross Zwisler > Signed-off-by: Dan Williams > --- > Changes since the initial RFC: > * s/writethru/wt/ since we already have ioremap_wt(), > set_memory_wt(), etc. (Ingo) Sorry I should have said earlier, but I think the term "wt" is misleading. Non-temporal stores used in memcpy_wt() provide WC semantics, not WT semantics. How about using "nocache" as it's been used in __copy_user_nocache()? Thanks, -Toshi