linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libnvdimm: allow legacy (e820) pmem region to clear bad blocks
@ 2016-09-08 23:33 Dave Jiang
  2016-09-09  0:28 ` Verma, Vishal L
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Jiang @ 2016-09-08 23:33 UTC (permalink / raw)
  To: vishal.l.verma, dan.j.williams; +Cc: linux-nvdimm

Bad blocks can be injected via /sys/block/pmemN/badblocks. In a situation
where legacy pmem is being used or a pmem region created by using memmap
kernel parameter, the injected bad blocks are not cleared due to
nvdimm_clear_poison() failing from lack of ndctl function pointer. In
this case we need to just return as handled and allow the bad blocks to
be cleared rather than fail.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/nvdimm/bus.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 458daf9..935866f 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -185,8 +185,12 @@ long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
 		return -ENXIO;
 
 	nd_desc = nvdimm_bus->nd_desc;
+	/*
+	 * if ndctl does not exist, it's PMEM_LEGACY and
+	 * we want to just pretend everything is handled.
+	 */
 	if (!nd_desc->ndctl)
-		return -ENXIO;
+		return len;
 
 	memset(&ars_cap, 0, sizeof(ars_cap));
 	ars_cap.address = phys;

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

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

* Re: [PATCH] libnvdimm: allow legacy (e820) pmem region to clear bad blocks
  2016-09-08 23:33 [PATCH] libnvdimm: allow legacy (e820) pmem region to clear bad blocks Dave Jiang
@ 2016-09-09  0:28 ` Verma, Vishal L
  2016-09-09  3:57   ` Dan Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Verma, Vishal L @ 2016-09-09  0:28 UTC (permalink / raw)
  To: Williams, Dan J, Jiang, Dave; +Cc: linux-nvdimm

On Thu, 2016-09-08 at 16:33 -0700, Dave Jiang wrote:
> Bad blocks can be injected via /sys/block/pmemN/badblocks. In a
> situation
> where legacy pmem is being used or a pmem region created by using
> memmap
> kernel parameter, the injected bad blocks are not cleared due to
> nvdimm_clear_poison() failing from lack of ndctl function pointer. In
> this case we need to just return as handled and allow the bad blocks
> to
> be cleared rather than fail.
> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/nvdimm/bus.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Looks good to me!
Reveiewed-by: Vishal Verma <Vishal.l.verma@intel.com>

> 
> diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
> index 458daf9..935866f 100644
> --- a/drivers/nvdimm/bus.c
> +++ b/drivers/nvdimm/bus.c
> @@ -185,8 +185,12 @@ long nvdimm_clear_poison(struct device *dev,
> phys_addr_t phys,
>  		return -ENXIO;
>  
>  	nd_desc = nvdimm_bus->nd_desc;
> +	/*
> +	 * if ndctl does not exist, it's PMEM_LEGACY and
> +	 * we want to just pretend everything is handled.
> +	 */
>  	if (!nd_desc->ndctl)
> -		return -ENXIO;
> +		return len;
>  
>  	memset(&ars_cap, 0, sizeof(ars_cap));
>  	ars_cap.address = phys;
> 
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH] libnvdimm: allow legacy (e820) pmem region to clear bad blocks
  2016-09-09  0:28 ` Verma, Vishal L
@ 2016-09-09  3:57   ` Dan Williams
  2016-09-09 17:45     ` Verma, Vishal L
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Williams @ 2016-09-09  3:57 UTC (permalink / raw)
  To: Verma, Vishal L; +Cc: linux-nvdimm

On Thu, Sep 8, 2016 at 5:28 PM, Verma, Vishal L
<vishal.l.verma@intel.com> wrote:
> On Thu, 2016-09-08 at 16:33 -0700, Dave Jiang wrote:
>> Bad blocks can be injected via /sys/block/pmemN/badblocks. In a
>> situation
>> where legacy pmem is being used or a pmem region created by using
>> memmap
>> kernel parameter, the injected bad blocks are not cleared due to
>> nvdimm_clear_poison() failing from lack of ndctl function pointer. In
>> this case we need to just return as handled and allow the bad blocks
>> to
>> be cleared rather than fail.
>>
>> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>> ---
>>  drivers/nvdimm/bus.c |    6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> Looks good to me!
> Reveiewed-by: Vishal Verma <Vishal.l.verma@intel.com>

Applied, although I just noticed that patchwork did not pick up that
reviewed-by due to the typo.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH] libnvdimm: allow legacy (e820) pmem region to clear bad blocks
  2016-09-09  3:57   ` Dan Williams
@ 2016-09-09 17:45     ` Verma, Vishal L
  0 siblings, 0 replies; 4+ messages in thread
From: Verma, Vishal L @ 2016-09-09 17:45 UTC (permalink / raw)
  To: Williams, Dan J; +Cc: linux-nvdimm

On Thu, 2016-09-08 at 20:57 -0700, Dan Williams wrote:
> On Thu, Sep 8, 2016 at 5:28 PM, Verma, Vishal L
> <vishal.l.verma@intel.com> wrote:
> > 
> > On Thu, 2016-09-08 at 16:33 -0700, Dave Jiang wrote:
> > > 
> > > Bad blocks can be injected via /sys/block/pmemN/badblocks. In a
> > > situation
> > > where legacy pmem is being used or a pmem region created by using
> > > memmap
> > > kernel parameter, the injected bad blocks are not cleared due to
> > > nvdimm_clear_poison() failing from lack of ndctl function pointer.
> > > In
> > > this case we need to just return as handled and allow the bad
> > > blocks
> > > to
> > > be cleared rather than fail.
> > > 
> > > Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> > > ---
> > >  drivers/nvdimm/bus.c |    6 +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > Looks good to me!
> > Reveiewed-by: Vishal Verma <Vishal.l.verma@intel.com>
> 
> Applied, although I just noticed that patchwork did not pick up that
> reviewed-by due to the typo.

Oops, that's what happens when I type stuff out instead of using vim
macros :)
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

end of thread, other threads:[~2016-09-09 17:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-08 23:33 [PATCH] libnvdimm: allow legacy (e820) pmem region to clear bad blocks Dave Jiang
2016-09-09  0:28 ` Verma, Vishal L
2016-09-09  3:57   ` Dan Williams
2016-09-09 17:45     ` Verma, Vishal L

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).