Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S975384AbdDXRD0 (ORCPT ); Mon, 24 Apr 2017 13:03:26 -0400 Received: from g2t1383g.austin.hpe.com ([15.233.16.89]:9701 "EHLO g2t1383g.austin.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S975238AbdDXRDQ (ORCPT ); Mon, 24 Apr 2017 13:03:16 -0400 Authentication-Results: hpe.com; dkim=none (message not signed) header.d=none;hpe.com; dmarc=none action=none header.from=hpe.com; Subject: Re: [PATCH] libnvdimm, region: sysfs trigger for nvdimm_flush() To: Dan Williams , References: <149281853758.22910.2919981036906495309.stgit@dwillia2-desk3.amr.corp.intel.com> CC: , From: Linda Knippers Message-ID: <58FE2FCA.5050702@hpe.com> Date: Mon, 24 Apr 2017 13:03:06 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <149281853758.22910.2919981036906495309.stgit@dwillia2-desk3.amr.corp.intel.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [73.60.235.182] X-ClientProxiedBy: BN6PR14CA0038.namprd14.prod.outlook.com (10.171.172.152) To TU4PR84MB0239.NAMPRD84.PROD.OUTLOOK.COM (10.162.187.29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 833433e1-0c4a-48c2-3610-08d48b33ca8b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081)(201703131423075)(201703031133081);SRVR:TU4PR84MB0239; X-Microsoft-Exchange-Diagnostics: 1;TU4PR84MB0239;3:rbtMHaOLA3i3sxMgVmNb1eQJNzRL0HlBfEEGlixtbAzIPAlJFBFHovFS46oktcROHyK6dpN3/zecX0mLwvnjdpWxKOSa5orlN8ct7Xf3rylis2BzvuzRa7Upc7NKgWhHil5c2P9p4V87w1fb7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O29cR3m0IjWn5h2DIWwgcqyg23TE/P6YhT7UWtwoNbETTmqMlnUA2TUc70z5AzoraTVcf8zwx/7VUxZTsblxtBYsUG9+medJOooVvVuqsts2Thw2pq3lY7OvYFj8/u30G5TbuW9e2HMqXpFhCqRfV78Mw3tA9GGPJGdB/nfr9xDde6c8zBwQropFR8gMwTKMHXRhukANCc6DjNEMyhk1UIERK6lKT7th5Y09nTxH/jpm8VTiNLz0MD8Z0tIY6cfr0LFchyopiNvdYCGw4Z2W7B/7rMQregyOiWZR4TXcoEMNsBzg0LDgbJgWk/SLLmrrlrOiH5sQwzkquJEs/iuL7H+Itn5um/VhV3a2NbDux8D8pjTb8TXDnBpOJVV+niRSoD0XG33NkHWFmJfEPMcUpPCtMfXrFS3pV4dNv7Pu3U X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(162533806227266)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(6072148);SRVR:TU4PR84MB0239;BCL:0;PCL:0;RULEID:;SRVR:TU4PR84MB0239; X-Microsoft-Exchange-Diagnostics: 1;TU4PR84MB0239;4:7kcPpt54FphLJqYzYpRS/ky60u8SvwFu0GIxqdl7C3ftIZeaj6d+Exu7pMQ17BVcfGXYNOSF9HOx4/zpkIvRkkJYwh31KyBDBKQ0fNdPFhRDMSUDL6A6W8L2Bu7cROSyJ1uvVTgTY2HWX85/UbpF2j90mGEnOxKu/yD8NuLDuJu/C2UxtO8ZvoTAzdKys0/KVvgeXD15Xlr7+kF50bihWl3JG5teVjgmw55rHeh5gnbYNEKviMW3ZlhS5jjAcYeTD9ExQvHHdZ18Pm2B5VeA67ruqvCxiLGt8mF2j9HvmyzUsxARDqIB878MWkiVl/BzduHH6giTgb/mGiKyCrBOLd/FKBnScijbGwmCRb4mSQdyPehbci4lOFouyqHa+WgVdHpTx6WXJklHOq+3Seniu5/vPvYv00abgQaBSWm3gOThwgjD+2Mv5QnllT1M79JP6XDnRm0esH7ghE53pi3wHaz3PMQCxnYwJFwdrHz5ZXHJmDbV9c1fEQZZR5EUqK+sCCF2Bq40rMwSV2uOsh4bXYzYO5Uspj/JhLK/6ay439AS0Ok9x48WM8Lu9o4S+hYRCO9xe/Zo2Hok4oLKfmyd9IyQQlFJaYxQ/wypYXcVOaINIpkHmYOJK5hS8K5kTOXdU+U52VavWm+taDvsGK2C62QNsHbSF2AIGkhS+1YpQdOt9Ld/dCRzcl1K4yM0A2Tn2xuzFm0krU48Wcau3d63U+JE36wxdW4ZOuv3O/nbPsMbcS1PKKSsn6HcA5KecNHL8B+5MQVBiRysA3d+jNockxJTH1LUZNTu3UZDnkB9sqYY8C9jzmpglOgSYuCa+MBs X-Forefront-PRVS: 0287BBA78D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(39410400002)(39400400002)(39850400002)(39840400002)(39860400002)(39450400003)(24454002)(377454003)(117156002)(86362001)(4326008)(77096006)(5660300001)(3846002)(6116002)(7736002)(53546009)(25786009)(6666003)(50466002)(38730400002)(65956001)(66066001)(4001350100001)(47776003)(189998001)(6486002)(83506001)(305945005)(23746002)(54906002)(2906002)(6306002)(33656002)(42186005)(53936002)(36756003)(2950100002)(229853002)(81166006)(65816999)(8676002)(50986999)(76176999)(54356999)(87266999)(80316001)(6246003);DIR:OUT;SFP:1102;SCL:1;SRVR:TU4PR84MB0239;H:[192.168.1.11];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;TU4PR84MB0239;23:9jkWnnpKQ3pvga2S0uFZJMW2iee/Yak8dzWkM?= =?Windows-1252?Q?0ANau6ORW5Ig5oABzG6lj4WjN+UPd6W7HlUD0fLZ0aGBzVb15E/EHCjx?= =?Windows-1252?Q?z1TiF3n7j6vmrLqQhdapJzW1nm3HgJGrHYvc/h9t+evQCa1Va1lUiqrQ?= =?Windows-1252?Q?r5rTRDaEJUXuGxhth9NpK5zxBQ3MAxpZ4rj7P0yk6RvBVy06Vr0LkEeC?= =?Windows-1252?Q?YcpS10G0ckAWgDQuJ/nohbFxGBa4sh7MtO5eltoc056Fo1XwIHFNVpAz?= =?Windows-1252?Q?uKcPGjnU8ocoDYSU2P3YH/LEWaaNWC1QDsF8qsoLaxu/bPCgRDOQ3Zsl?= =?Windows-1252?Q?41MrLIP0QgIgsxmh4fcNfyvFzC59fCi1SU8e3sv4HP9PJzfF48CXdtzy?= =?Windows-1252?Q?7vq64ICbn8IBWfdyHtkW05RvPTGMy+s0hocrMQ6KGMqi16Ir2xK7CBtm?= =?Windows-1252?Q?BDsJ6jpuxkET7ApzrToZ1FIoit6eqmjiTtONbYA/eW92ic0aCu9NCyOu?= =?Windows-1252?Q?zWf+HX4ZFYCV27RlXzl2BW9nrbWOGcNaLdl1BZBoigQMv6dWB5xezFTh?= =?Windows-1252?Q?BHDxzcM04oPZ6LLtsrudQgxSxS/qEzjez/3r3hr9naxQ1XrGzVp7X4eL?= =?Windows-1252?Q?Fv1XrNbhhvpCyCfndNp/n4q2UfP6vHQ7O5jVHrsz7xxKkKOZL+FGRPlM?= =?Windows-1252?Q?CFPXlgNyt/RBSZNQh3UhDGv7HawckWCFNk7VW4UZD2A0T41uxs2mBofR?= =?Windows-1252?Q?jN6IoM7mMNwI/sc5Aeq9CXSk6m8ov5nRk+WkfseNINikggHHFV+llCM5?= =?Windows-1252?Q?5ObSzcZMjC/3ZPuNHyOsUKlNYniI3ywCqYjrKzTTRDagC9Sg7dM6J7c1?= =?Windows-1252?Q?hq8UeqYbe2qHcl6EPudVW09Y0pcRyWAdXQ+qXia63mHdnlACR0erh+Vv?= =?Windows-1252?Q?5NV3SvE/w3LjXYNT5AU4kkAIhO1x+ILWeksi4MXxVLUjEulJSMmAq1Zg?= =?Windows-1252?Q?09/fs9ngJ3HH+njtX2FSJUnnlZo4H3zos5E/usBZpVtY74o+7/elBNwN?= =?Windows-1252?Q?8H4if+mqKhOS+GSvf9ZG8E9JXGJwdmzjHqPQJT6l6qL9Ua0ucoVMwSaQ?= =?Windows-1252?Q?a0UuEISD61IH1GAx37vd88/23er0r2iKf/KwYmzOlvVeMnBJdoy5/N6z?= =?Windows-1252?Q?1Sx1G1vh0VDf4aQFxwm5wxTTWlhOmFgwr+ZoYtLbUuIXl0L3o0wc5vze?= =?Windows-1252?Q?K7pUezqvfFhG0gFgjfUzOpKoaSNvHF6p+fd05sS8s6S7uQ4Zg4XehMVz?= =?Windows-1252?Q?M5yQnJxsZGNpnnsDXbExTc/NJN3/Xz4g1b+nvVS/uSh25E0649bjnXi6?= =?Windows-1252?Q?E+cCCUX0MNC?= X-Microsoft-Exchange-Diagnostics: 1;TU4PR84MB0239;6:Syf9P1jelbLfyfLpeSYqQaUWinfB8Qq6k1b7s0/cEjc1eQR1mUGVePknZWO9AImIHmEjFxHHEvcx36syhTfiQefMN2GatEvUabqoTZb4373XnBVQKafoFo6gY39zIHEJ/AckqsQ0Sea8r4U6mexledCzX+DcJtdyYhVr2MXA9ALqGNqvE23X3p6uQ9eQ/PF4R79YezalTNPAHLX5E174NyTLnl/BEiUgFa2jpeD5EFhP+lT7CJI9Z5oc/WJlrpkiCCzrbZcCeIjOimeqo9g0Q8P5U99g/HyPaSqpFsPRdF5OfG4LVtrni1IYwQ+kNazBWA87kNp2YJWq2xcRT3eSh/nYsa7my13e9fkzXAVTeVgt+40QdZ8BQOTc7ZEc484hxQelr9d2QNsd06egY1OvtJA3xoovNdeqZB+ltvz5Z9Puw4sxOhw356TtFNviHaYUtSiezF/juhYrn/nYEw4oq7iKq9D17K25livdXHzvF/hHaEMu63Pqg9if5XgS0HXzx/JUqd+AsxgKkY3Qeh9v8lPCLIvMViZDFfVpBsJJH6Y=;5:eYvEiaIK/2DYdMpL1nwanPpaMG+x+d+JyY5nBhii4fx2VA+Ea0EQEM9R3CvbF4gP6vXQ+fVisS9Okgv5pMhFOQEcAGxQ9r5dlmse1LEmuJuyIrre8JLeeAA5+s+SU8fLPmZjZ/Lx3BCS7lktpOf0ag==;24:hKbXkEoWVYOqHSryWFq6h3pFhkh7p2yvEqWdBF90/WVW8Mm6btB8E7aT6fbB7HUcBIBm28s7Q2SRDrq1b9vM9WD+qkjwgMGMkpYRS05gvGE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;TU4PR84MB0239;7:Xg0I//+GPIL0Shx86NruwLwmHTRIz0RvMhux4aKpUusXzoHYFfiToIuI/NGaarsHwfQymrhd9s+0trpP3lOUPyHf5oVQKY1bD2D8yixzgEDwHzo4Mnzetw0YjOJUOM31rZi8/6LZDqGPZMrl6FMOu3GhBMiBQHpsdIIETt1kufQpY9o2GO60H1HPLXoT5ZAnwRttxf8AZXlAfLuvsU/jWAgagzN/eq3VnEOsbLq5fHAamcT8Jj6pkLnp4cetGD+xtyQVcPueyEVs6PKNhQGTk5oJGs/p2Xd406gAno20Tu0adi1z18YaaRralBZmiuTi/c8CrRqVdmqc67hlzLlARw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2017 17:03:11.9108 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: TU4PR84MB0239 X-OriginatorOrg: hpe.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2844 Lines: 78 On 04/21/2017 07:48 PM, Dan Williams wrote: > The nvdimm_flush() mechanism helps to reduce the impact of an ADR > (asynchronous-dimm-refresh) failure. The ADR mechanism handles flushing > platform WPQ (write-pending-queue) buffers when power is removed. The > nvdimm_flush() mechanism performs that same function on-demand. > > When a pmem namespace is associated with a block device, an > nvdimm_flush() is triggered with every block-layer REQ_FUA, or REQ_FLUSH > request. However, when a namespace is in device-dax mode, or namespaces > are disabled, userspace needs another path. Why would a user need to flush a disabled namespace? > The new 'flush' attribute is visible when it can be determined that the > interleave-set either does, or does not have DIMMs that expose WPQ-flush > addresses, "flush-hints" in ACPI NFIT terminology. It returns "1" and > flushes DIMMs, or returns "0" the flush operation is a platform nop. It seems a little odd to me that reading a read-only attribute both tells you that the device has flush hints and also triggers a flush. This means that anyone at any time can cause a flush. Do we want that? -- ljk > > Signed-off-by: Dan Williams > --- > drivers/nvdimm/region_devs.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c > index 8de5a04644a1..3495b4c23941 100644 > --- a/drivers/nvdimm/region_devs.c > +++ b/drivers/nvdimm/region_devs.c > @@ -255,6 +255,19 @@ static ssize_t size_show(struct device *dev, > } > static DEVICE_ATTR_RO(size); > > +static ssize_t flush_show(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + struct nd_region *nd_region = to_nd_region(dev); > + > + if (nvdimm_has_flush(nd_region)) { > + nvdimm_flush(nd_region); > + return sprintf(buf, "1\n"); > + } > + return sprintf(buf, "0\n"); > +} > +static DEVICE_ATTR_RO(flush); > + > static ssize_t mappings_show(struct device *dev, > struct device_attribute *attr, char *buf) > { > @@ -474,6 +487,7 @@ static DEVICE_ATTR_RO(resource); > > static struct attribute *nd_region_attributes[] = { > &dev_attr_size.attr, > + &dev_attr_flush.attr, > &dev_attr_nstype.attr, > &dev_attr_mappings.attr, > &dev_attr_btt_seed.attr, > @@ -508,6 +522,9 @@ static umode_t region_visible(struct kobject *kobj, struct attribute *a, int n) > if (!is_nd_pmem(dev) && a == &dev_attr_resource.attr) > return 0; > > + if (a == &dev_attr_flush.attr && nvdimm_has_flush(nd_region) < 0) > + return 0; > + > if (a != &dev_attr_set_cookie.attr > && a != &dev_attr_available_size.attr) > return a->mode; > > _______________________________________________ > Linux-nvdimm mailing list > Linux-nvdimm@lists.01.org > https://lists.01.org/mailman/listinfo/linux-nvdimm >