Skip to contentSkip to conversation

libnvdimm: fix phys_addr for nvdimm_clear_poison

PATCH In review Toshi Kani 3 participants 5 messages Apr 25, 2017 libnvdimm: non-volatile memory device

lore
Share & tools
lore

Toshi Kani

author
#0 lore raw

PATCH 1/1 libnvdimm: fix phys_addr for nvdimm_clear_poison

nvdimm_clear_poison() expects a physical address, not an offset. Fix nsio_rw_bytes() to call nvdimm_clear_poison() with a physical address.

Cc Dan Williams <[email protected]>
Cc Dave Jiang <[email protected]>
Cc Vishal Verma <[email protected]>
---
 drivers/nvdimm/claim.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvdimm/claim.c +2 -1
index ca6d572..0b31073 100644
@@ -254,7 +254,8 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
 				&& (!ndns->claim || !is_nd_btt(ndns->claim))) {
 			long cleared;
 
-			cleared = nvdimm_clear_poison(&ndns->dev, offset, size);
+			cleared = nvdimm_clear_poison(&ndns->dev,
+					nsio->res.start + offset, size);
 			if (cleared < size)
 				rc = -EIO;
 			if (cleared > 0 && cleared / 512) {

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

maintainer
#1 lore raw
Quoted 3 lines · Toshi Kani

nvdimm_clear_poison() expects a physical address, not an offset. Fix nsio_rw_bytes() to call nvdimm_clear_poison() with a physical address.

Good catch!

Quoted 14 lines
Cc Dan Williams <[email protected]>
Cc Dave Jiang <[email protected]>
Cc Vishal Verma <[email protected]>
---
 drivers/nvdimm/claim.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvdimm/claim.c +0 -0
index ca6d572..0b31073 100644

drivers/nvdimm/claim.c static int nsio_rw_bytes(struct nd_namespace_common *ndns, · line 258

Quoted 6 lines
drivers/nvdimm/claim.c +2 -1
@@ -254,7 +254,8 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
 				&& (!ndns->claim || !is_nd_btt(ndns->claim))) {
 			long cleared;
 
-			cleared = nvdimm_clear_poison(&ndns->dev, offset, size);
+			cleared = nvdimm_clear_poison(&ndns->dev,
+					nsio->res.start + offset, size);

Should we be using nsio->res.start here or nsio->addr ?

drivers/nvdimm/claim.c static int nsio_rw_bytes(struct nd_namespace_common *ndns, · line 261

Quoted 3 lines
drivers/nvdimm/claim.c +0 -0
 			if (cleared < size)
 				rc = -EIO;
 			if (cleared > 0 && cleared / 512) {

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#2 lore raw
Quoted 25 lines · Vishal Verma
Quoted 3 lines · Toshi Kani

nvdimm_clear_poison() expects a physical address, not an offset. Fix nsio_rw_bytes() to call nvdimm_clear_poison() with a physical address.

Good catch!

Quoted 18 lines
Cc Dan Williams <[email protected]>
Cc Dave Jiang <[email protected]>
Cc Vishal Verma <[email protected]>

---
 drivers/nvdimm/claim.c |    3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvdimm/claim.c +0 -0
index ca6d572..0b31073 100644
@@ -254,7 +254,8 @@ static int nsio_rw_bytes(struct
 nd_namespace_common *ndns,

  && (!ndns->claim || !is_nd_btt(ndns->claim))) {
  long cleared;

Quoted 8 lines
Quoted 6 lines

drivers/nvdimm/claim.c +0 -1
-			cleared = nvdimm_clear_poison(&ndns->dev,

offset, size);

drivers/nvdimm/claim.c +2 -0
+			cleared = nvdimm_clear_poison(&ndns->dev,
+					nsio->res.start + offset,

size);

Should we be using nsio->res.start here or nsio->addr ?

nsio->addr is a virtual address. We need to pass the physical address of this range.

Thanks,
-Toshi

Quoted 4 lines
Quoted 4 lines

  if (cleared < size)
  rc = -EIO;
  if (cleared > 0 && cleared / 512) {

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

maintainer Reviewed-by
#3 lore raw
Quoted 2 lines · Toshimitsu
Quoted 1 line · Vishal Verma

On 04/25, Toshi Kani wrote:

[...]

Quoted 5 lines
Quoted 2 lines

Should we be using nsio->res.start here or nsio->addr ?

nsio->addr is a virtual address. We need to pass the physical address of this range.

I see - makes sense.
You can add

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#4 lore raw
Quoted 5 lines · Vishal Verma
Quoted 2 lines · Toshimitsu
Quoted 1 line · Vishal Verma

On 04/25, Toshi Kani wrote:

[...]

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Should we be using nsio->res.start here or nsio->addr ?

nsio->addr is a virtual address. We need to pass the physical address of this range.

I see - makes sense.
You can add

Thanks, applied.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm