All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvdimm: fix PHYS_PFN/PFN_PHYS mixup
@ 2016-09-19 10:19 Oliver O'Halloran
  2016-09-19 15:56 ` Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver O'Halloran @ 2016-09-19 10:19 UTC (permalink / raw)
  To: linux-nvdimm

nd_activate_region() iomaps any hint addresses required when activating
a region. To prevent duplicate mappings it checks the PFN of the hint to
be mapped against the PFNs of the already mapped hints. Unfortunately it
doesn't convert the PFN back into a physical address before passing it
to devm_nvdimm_ioremap(). Instead it applies PHYS_PFN a second time
which ends about as well as you would imagine.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
---
 drivers/nvdimm/region_devs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index e8d5ba7b29af..4eef88eb5144 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -57,7 +57,7 @@ static int nvdimm_map_flush(struct device *dev, struct nvdimm *nvdimm, int dimm,
 					ndrd->flush_wpq[dimm][j] & PAGE_MASK);
 		else
 			flush_page = devm_nvdimm_ioremap(dev,
-					PHYS_PFN(pfn), PAGE_SIZE);
+					PFN_PHYS(pfn), PAGE_SIZE);
 		if (!flush_page)
 			return -ENXIO;
 		ndrd->flush_wpq[dimm][i] = flush_page
-- 
2.5.5

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

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

* Re: [PATCH] nvdimm: fix PHYS_PFN/PFN_PHYS mixup
  2016-09-19 10:19 [PATCH] nvdimm: fix PHYS_PFN/PFN_PHYS mixup Oliver O'Halloran
@ 2016-09-19 15:56 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2016-09-19 15:56 UTC (permalink / raw)
  To: Oliver O'Halloran; +Cc: linux-nvdimm

On Mon, Sep 19, 2016 at 3:19 AM, Oliver O'Halloran <oohall@gmail.com> wrote:
> nd_activate_region() iomaps any hint addresses required when activating
> a region. To prevent duplicate mappings it checks the PFN of the hint to
> be mapped against the PFNs of the already mapped hints. Unfortunately it
> doesn't convert the PFN back into a physical address before passing it
> to devm_nvdimm_ioremap(). Instead it applies PHYS_PFN a second time
> which ends about as well as you would imagine.
>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/nvdimm/region_devs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
> index e8d5ba7b29af..4eef88eb5144 100644
> --- a/drivers/nvdimm/region_devs.c
> +++ b/drivers/nvdimm/region_devs.c
> @@ -57,7 +57,7 @@ static int nvdimm_map_flush(struct device *dev, struct nvdimm *nvdimm, int dimm,
>                                         ndrd->flush_wpq[dimm][j] & PAGE_MASK);
>                 else
>                         flush_page = devm_nvdimm_ioremap(dev,
> -                                       PHYS_PFN(pfn), PAGE_SIZE);
> +                                       PFN_PHYS(pfn), PAGE_SIZE);
>                 if (!flush_page)
>                         return -ENXIO;
>                 ndrd->flush_wpq[dimm][i] = flush_page

Nice catch, I'll push this for 4.8-final.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

end of thread, other threads:[~2016-09-19 15:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-19 10:19 [PATCH] nvdimm: fix PHYS_PFN/PFN_PHYS mixup Oliver O'Halloran
2016-09-19 15:56 ` Dan Williams

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.