linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>
To: Ira Weiny <ira.weiny@intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>,
	"kexec@lists.infradead.org" <kexec@lists.infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Yasunori Gotou (Fujitsu)" <y-goto@fujitsu.com>,
	"Xiao Yang (Fujitsu)" <yangx.jy@fujitsu.com>,
	"Shiyang Ruan (Fujitsu)" <ruansy.fnst@fujitsu.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Dave Jiang <dave.jiang@intel.com>
Subject: Re: [RFC PATCH v2 2/3] drivers/nvdimm: export memmap of namespace to vmcoreinfo
Date: Fri, 28 Apr 2023 07:01:35 +0000	[thread overview]
Message-ID: <541c8d7c-5912-5446-5e7e-0feeae911de8@fujitsu.com> (raw)
In-Reply-To: <644afc2952c25_1a1c5294e0@iweiny-mobl.notmuch>



On 28/04/2023 06:50, Ira Weiny wrote:
> 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@intel.com>
>> CC: Vishal Verma <vishal.l.verma@intel.com>
>> CC: Dave Jiang <dave.jiang@intel.com>
>> CC: Ira Weiny <ira.weiny@intel.com>
>> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
>> ---
>>   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,

Users who want to manage the namespace of pmem usually use the 'ndctl' command. The following cases
would touch the memmap of the namespace.

a. create namespace 'ndctl create-namespace -f -e namespace0.0 --mode=fsdax -s $(((1024+16)<<20)) -M dev'
b. change namespace size 'ndctl create-namespace -f -e namespace0.0 --mode=fsdax -s $(((1024)<<20)) -M dev'
c. change memmap location 'ndctl create-namespace -f -e namespace0.0 --mode=fsdax -s $(((1024+16)<<20)) -M mem'
d. destroy namespace 'ndctl destroy-namespace -f namespace0.0'

Unlike the former 3 cases, the case d, it will not invoke '__nvdimm_setup_pfn()'. Instead, ndctl
just do something like 'echo 0 >/sys/bus/nd/devices/namespace0.0/size'

We have to delete this namespace from devm_memmap_vmcore in this case. So here is an odd place
but it works. I have tried to find a place pairing with __nvdimm_setup_pfn(), but i failed
at last. If you have any good idea, please let me know :)

Thanks
Zhijian

> 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
>>
> 
> 

  reply	other threads:[~2023-04-28  7:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-27 10:18 [RFC PATCH v2 0/3] pmem memmap dump support Li Zhijian
2023-04-27 10:18 ` [RFC PATCH v2 1/3] crash: export dev memmap header to vmcoreinfo Li Zhijian
2023-04-27 10:18 ` [RFC PATCH v2 2/3] drivers/nvdimm: export memmap of namespace " Li Zhijian
2023-04-27 22:50   ` Ira Weiny
2023-04-28  7:01     ` Zhijian Li (Fujitsu) [this message]
2023-04-27 10:18 ` [RFC PATCH v2 3/3] resource, crash: Make kexec_file_load support pmem Li Zhijian
2023-04-27 11:39   ` Greg Kroah-Hartman
2023-04-28  7:36     ` Zhijian Li (Fujitsu)
2023-04-27 20:41   ` Jane Chu
2023-04-28  7:10     ` Zhijian Li (Fujitsu)
2023-04-27 10:18 ` [RFC PATCH v2 kexec-tools] kexec: Add and mark pmem region into PT_LOADs Li Zhijian
2023-04-27 10:18 ` [RFC PATCH v2 makedumpfile 1/3] elf_info.c: Introduce is_pmem_pt_load_range Li Zhijian
2023-04-27 10:18 ` [RFC PATCH v2 makedumpfile 2/3] makedumpfile.c: Exclude all pmem pages Li Zhijian
2023-04-27 10:18 ` [RFC PATCH v2 makedumpfile 3/3] makedumpfile.c: Allow excluding metadata of pmem region Li Zhijian
2023-04-28 18:59 ` [RFC PATCH v2 0/3] pmem memmap dump support Dan Williams
2023-05-08  9:45   ` Zhijian Li (Fujitsu)
2023-05-10 10:41     ` Zhijian Li (Fujitsu)
2023-05-25  5:36       ` Li, Zhijian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=541c8d7c-5912-5446-5e7e-0feeae911de8@fujitsu.com \
    --to=lizhijian@fujitsu.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=ruansy.fnst@fujitsu.com \
    --cc=vishal.l.verma@intel.com \
    --cc=x86@kernel.org \
    --cc=y-goto@fujitsu.com \
    --cc=yangx.jy@fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).