lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 28 Apr 2023 07:01:35 +0000
From:   "Zhijian Li (Fujitsu)" <lizhijian@...itsu.com>
To:     Ira Weiny <ira.weiny@...el.com>, "x86@...nel.org" <x86@...nel.org>,
        "nvdimm@...ts.linux.dev" <nvdimm@...ts.linux.dev>,
        "kexec@...ts.infradead.org" <kexec@...ts.infradead.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Yasunori Gotou (Fujitsu)" <y-goto@...itsu.com>,
        "Xiao Yang (Fujitsu)" <yangx.jy@...itsu.com>,
        "Shiyang Ruan (Fujitsu)" <ruansy.fnst@...itsu.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Vishal Verma <vishal.l.verma@...el.com>,
        Dave Jiang <dave.jiang@...el.com>
Subject: Re: [RFC PATCH v2 2/3] drivers/nvdimm: export memmap of namespace to
 vmcoreinfo



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@...el.com>
>> CC: Vishal Verma <vishal.l.verma@...el.com>
>> CC: Dave Jiang <dave.jiang@...el.com>
>> CC: Ira Weiny <ira.weiny@...el.com>
>> Signed-off-by: Li Zhijian <lizhijian@...itsu.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
>>
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ