Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1379431 > unrolled thread

[PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow

Started byDan Williams <dan.j.williams@intel.com>
First post2016-04-15 04:50 +0200
Last post2016-04-15 19:00 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow Dan Williams <dan.j.williams@intel.com> - 2016-04-15 04:50 +0200
    Re: [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow Johannes Thumshirn <jthumshirn@suse.de> - 2016-04-15 09:20 +0200
    Re: [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow Jeff Moyer <jmoyer@redhat.com> - 2016-04-15 14:40 +0200
    Re: [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write  flow "Verma, Vishal L" <vishal.l.verma@intel.com> - 2016-04-15 19:00 +0200

#1379431 — [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow

FromDan Williams <dan.j.williams@intel.com>
Date2016-04-15 04:50 +0200
Subject[PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow
Message-ID<ro1Zv-41K-7@gated-at.bofh.it>
The ACPI specification does not specify the state of data after a clear
poison operation.  Potential future libnvdimm bus implementations for
other architectures also might not specify or disagree on the state of
data after clear poison.  Clarify why we write twice.

Reported-by: Jeff Moyer <jmoyer@redhat.com>
Reported-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/nvdimm/pmem.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index c6befaa9c708..d9a0dbc2d023 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -86,6 +86,20 @@ static int pmem_do_bvec(struct pmem_device *pmem, struct page *page,
 			flush_dcache_page(page);
 		}
 	} else {
+		/*
+		 * Note that we write the data both before and after
+		 * clearing poison.  The write before clear poison
+		 * handles situations where the latest written data is
+		 * preserved and the clear poison operation simply marks
+		 * the address range as valid without changing the data.
+		 * In this case application software can assume that an
+		 * interrupted write will either return the new good
+		 * data or an error.
+		 *
+		 * However, if pmem_clear_poison() leaves the data in an
+		 * indeterminate state we need to perform the write
+		 * after clear poison.
+		 */
 		flush_dcache_page(page);
 		memcpy_to_pmem(pmem_addr, mem + off, len);
 		if (unlikely(bad_pmem)) {

[toc] | [next] | [standalone]


#1379503

FromJohannes Thumshirn <jthumshirn@suse.de>
Date2016-04-15 09:20 +0200
Message-ID<ro6cO-7AZ-9@gated-at.bofh.it>
In reply to#1379431
On Donnerstag, 14. April 2016 19:40:47 CEST Dan Williams wrote:
> The ACPI specification does not specify the state of data after a clear
> poison operation.  Potential future libnvdimm bus implementations for
> other architectures also might not specify or disagree on the state of
> data after clear poison.  Clarify why we write twice.
> 
> Reported-by: Jeff Moyer <jmoyer@redhat.com>
> Reported-by: Vishal Verma <vishal.l.verma@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                                                                                Storage
jthumshirn@suse.de                                                             +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

[toc] | [prev] | [next] | [standalone]


#1379792

FromJeff Moyer <jmoyer@redhat.com>
Date2016-04-15 14:40 +0200
Message-ID<robcu-32n-19@gated-at.bofh.it>
In reply to#1379431
Dan Williams <dan.j.williams@intel.com> writes:

> The ACPI specification does not specify the state of data after a clear
> poison operation.  Potential future libnvdimm bus implementations for
> other architectures also might not specify or disagree on the state of
> data after clear poison.  Clarify why we write twice.

Thanks, Dan, looks good.

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

[toc] | [prev] | [next] | [standalone]


#1380010 — Re: [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow

From"Verma, Vishal L" <vishal.l.verma@intel.com>
Date2016-04-15 19:00 +0200
SubjectRe: [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow
Message-ID<rofg6-67R-9@gated-at.bofh.it>
In reply to#1379431
On Thu, 2016-04-14 at 19:40 -0700, Dan Williams wrote:
> The ACPI specification does not specify the state of data after a
> clear
> poison operation.  Potential future libnvdimm bus implementations for
> other architectures also might not specify or disagree on the state
> of
> data after clear poison.  Clarify why we write twice.
> 
> Reported-by: Jeff Moyer <jmoyer@redhat.com>
> Reported-by: Vishal Verma <vishal.l.verma@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/nvdimm/pmem.c |   14 ++++++++++++++
>  1 file changed, 14 insertions(+)

Looks good, thanks!

Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

> 
> diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
> index c6befaa9c708..d9a0dbc2d023 100644
> --- a/drivers/nvdimm/pmem.c
> +++ b/drivers/nvdimm/pmem.c
> @@ -86,6 +86,20 @@ static int pmem_do_bvec(struct pmem_device *pmem,
> struct page *page,
>  			flush_dcache_page(page);
>  		}
>  	} else {
> +		/*
> +		 * Note that we write the data both before and after
> +		 * clearing poison.  The write before clear poison
> +		 * handles situations where the latest written data
> is
> +		 * preserved and the clear poison operation simply
> marks
> +		 * the address range as valid without changing the
> data.
> +		 * In this case application software can assume that
> an
> +		 * interrupted write will either return the new good
> +		 * data or an error.
> +		 *
> +		 * However, if pmem_clear_poison() leaves the data
> in an
> +		 * indeterminate state we need to perform the write
> +		 * after clear poison.
> +		 */
>  		flush_dcache_page(page);
>  		memcpy_to_pmem(pmem_addr, mem + off, len);
>  		if (unlikely(bad_pmem)) {
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web