Re: [PATCH] libnvdimm: fix phys_addr for nvdimm_clear_poison

From: Kani, Toshimitsu
Date: Tue Apr 25 2017 - 17:51:24 EST


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 <toshi.kani@xxxxxxx>
> > Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
> > Cc: Dave Jiang <dave.jiang@xxxxxxxxx>
> > Cc: Vishal Verma <vishal.l.verma@xxxxxxxxx>
> > ---
> > Â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) {