All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow
@ 2016-04-15  2:40 ` Dan Williams
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Williams @ 2016-04-15  2:40 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: linux-kernel

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)) {

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow
@ 2016-04-15  2:40 ` Dan Williams
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Williams @ 2016-04-15  2:40 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Vishal Verma, Jeff Moyer, linux-kernel

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)) {

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow
  2016-04-15  2:40 ` Dan Williams
@ 2016-04-15  7:11   ` Johannes Thumshirn
  -1 siblings, 0 replies; 7+ messages in thread
From: Johannes Thumshirn @ 2016-04-15  7:11 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: linux-kernel

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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow
@ 2016-04-15  7:11   ` Johannes Thumshirn
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Thumshirn @ 2016-04-15  7:11 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Dan Williams, linux-kernel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow
  2016-04-15  2:40 ` Dan Williams
  (?)
  (?)
@ 2016-04-15 12:32 ` Jeff Moyer
  -1 siblings, 0 replies; 7+ messages in thread
From: Jeff Moyer @ 2016-04-15 12:32 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm, Vishal Verma, linux-kernel

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>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow
  2016-04-15  2:40 ` Dan Williams
@ 2016-04-15 16:58   ` Verma, Vishal L
  -1 siblings, 0 replies; 7+ messages in thread
From: Verma, Vishal L @ 2016-04-15 16:58 UTC (permalink / raw)
  To: Williams, Dan J, linux-nvdimm; +Cc: linux-kernel

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)) {
> 
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow
@ 2016-04-15 16:58   ` Verma, Vishal L
  0 siblings, 0 replies; 7+ messages in thread
From: Verma, Vishal L @ 2016-04-15 16:58 UTC (permalink / raw)
  To: Williams, Dan J, linux-nvdimm@lists.01.org; +Cc: linux-kernel, jmoyer

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)) {
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-04-15 16:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-15  2:40 [PATCH] libnvdimm, pmem: clarify the write+clear_poison+write flow Dan Williams
2016-04-15  2:40 ` Dan Williams
2016-04-15  7:11 ` Johannes Thumshirn
2016-04-15  7:11   ` Johannes Thumshirn
2016-04-15 12:32 ` Jeff Moyer
2016-04-15 16:58 ` Verma, Vishal L
2016-04-15 16:58   ` Verma, Vishal L

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.