2017-04-25 21:17:38

by Kani, Toshimitsu

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Toshi Kani <[email protected]>
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(-)

diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
index ca6d572..0b31073 100644
--- a/drivers/nvdimm/claim.c
+++ b/drivers/nvdimm/claim.c
@@ -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) {


2017-04-25 21:45:54

by Verma, Vishal L

[permalink] [raw]
Subject: Re: [PATCH] libnvdimm: fix phys_addr for nvdimm_clear_poison

On 04/25, Toshi Kani wrote:
> 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!

>
> Signed-off-by: Toshi Kani <[email protected]>
> 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(-)
>
> diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
> index ca6d572..0b31073 100644
> --- a/drivers/nvdimm/claim.c
> +++ b/drivers/nvdimm/claim.c
> @@ -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 ?

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

2017-04-25 21:51:20

by Kani, Toshimitsu

[permalink] [raw]
Subject: Re: [PATCH] libnvdimm: fix phys_addr for nvdimm_clear_poison

On Tue, 2017-04-25 at 15:44 -0600, Vishal Verma wrote:
> On 04/25, Toshi Kani wrote:
> > 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!
>
> >
> > Signed-off-by: Toshi Kani <[email protected]>
> > 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(-)
> >
> > diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
> > index ca6d572..0b31073 100644
> > --- a/drivers/nvdimm/claim.c
> > +++ b/drivers/nvdimm/claim.c
> > @@ -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 ?

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

Thanks,
-Toshi


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

2017-04-25 22:24:23

by Verma, Vishal L

[permalink] [raw]
Subject: Re: [PATCH] libnvdimm: fix phys_addr for nvdimm_clear_poison

On 04/25, Kani, Toshimitsu wrote:
> On Tue, 2017-04-25 at 15:44 -0600, Vishal Verma wrote:
> > On 04/25, Toshi Kani wrote:
[...]
> >
> > 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
Reviewed-by: Vishal Verma <[email protected]>

2017-04-25 22:58:10

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH] libnvdimm: fix phys_addr for nvdimm_clear_poison

On Tue, Apr 25, 2017 at 3:22 PM, Vishal Verma <[email protected]> wrote:
> On 04/25, Kani, Toshimitsu wrote:
>> On Tue, 2017-04-25 at 15:44 -0600, Vishal Verma wrote:
>> > On 04/25, Toshi Kani wrote:
> [...]
>> >
>> > 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
> Reviewed-by: Vishal Verma <[email protected]>

Thanks, applied.