Re: [RFC PATCH v2 2/3] drivers/nvdimm: export memmap of namespace to vmcoreinfo

From: Ira Weiny
Date: Thu Apr 27 2023 - 18:50:32 EST


Li Zhijian wrote:
> Each namespace has its own memmap, it will be udpated when
> namespace initializing/creating, updating, and deleting.
>
> CC: Dan Williams <dan.j.williams@xxxxxxxxx>
> CC: Vishal Verma <vishal.l.verma@xxxxxxxxx>
> CC: Dave Jiang <dave.jiang@xxxxxxxxx>
> CC: Ira Weiny <ira.weiny@xxxxxxxxx>
> Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx>
> ---
> drivers/nvdimm/namespace_devs.c | 2 ++
> drivers/nvdimm/pfn_devs.c | 3 +++
> 2 files changed, 5 insertions(+)
>
> diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
> index c60ec0b373c5..096203e6203f 100644
> --- a/drivers/nvdimm/namespace_devs.c
> +++ b/drivers/nvdimm/namespace_devs.c
> @@ -8,6 +8,7 @@
> #include <linux/slab.h>
> #include <linux/list.h>
> #include <linux/nd.h>
> +#include <linux/crash_core.h>
> #include "nd-core.h"
> #include "pmem.h"
> #include "pfn.h"
> @@ -853,6 +854,7 @@ static ssize_t size_store(struct device *dev,
> if (rc == 0 && val == 0 && is_namespace_pmem(dev)) {
> struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
>
> + devm_memmap_vmcore_delete(to_ndns(dev));

This seems like an odd place to put this. Could you explain the reasoning
more?

Ira

> kfree(nspm->uuid);
> nspm->uuid = NULL;
> }
> diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
> index af7d9301520c..80076996b2da 100644
> --- a/drivers/nvdimm/pfn_devs.c
> +++ b/drivers/nvdimm/pfn_devs.c
> @@ -9,6 +9,7 @@
> #include <linux/slab.h>
> #include <linux/fs.h>
> #include <linux/mm.h>
> +#include <linux/crash_core.h>
> #include "nd-core.h"
> #include "pfn.h"
> #include "nd.h"
> @@ -716,6 +717,8 @@ static int __nvdimm_setup_pfn(struct nd_pfn *nd_pfn, struct dev_pagemap *pgmap)
> } else
> return -ENXIO;
>
> + devm_memmap_vmcore_update(ndns, altmap->base_pfn, PHYS_PFN(offset),
> + nd_pfn->mode == PFN_MODE_PMEM);
> return 0;
> }
>
> --
> 2.29.2
>