From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH v2 08/18] nvdimm: init backend memory mapping and config data area Date: Thu, 17 Sep 2015 17:14:16 +0800 Message-ID: <55FA8468.4000108@linux.intel.com> References: <1439563931-12352-1-git-send-email-guangrong.xiao@linux.intel.com> <1439563931-12352-9-git-send-email-guangrong.xiao@linux.intel.com> <20150825160353.GD8344@stefanha-thinkpad.redhat.com> <55DD979A.70804@linux.intel.com> <20150828115851.GM4917@stefanha-thinkpad.redhat.com> <55E3F2EF.8070501@linux.intel.com> <20150901091400.GB5051@stefanha-thinkpad.redhat.com> <55F842D9.2010104@redhat.com> <55FA7C30.10208@linux.intel.com> <20150917110452.1ffaed44@nial.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Paolo Bonzini , Stefan Hajnoczi , Stefan Hajnoczi , gleb@kernel.org, mtosatti@redhat.com, mst@redhat.com, rth@twiddle.net, ehabkost@redhat.com, kvm@vger.kernel.org, qemu-devel@nongnu.org To: Igor Mammedov Return-path: Received: from mga03.intel.com ([134.134.136.65]:12070 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754210AbbIQJUP (ORCPT ); Thu, 17 Sep 2015 05:20:15 -0400 In-Reply-To: <20150917110452.1ffaed44@nial.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/17/2015 05:04 PM, Igor Mammedov wrote: > On Thu, 17 Sep 2015 16:39:12 +0800 > Xiao Guangrong wrote: > >> >> >> On 09/16/2015 12:10 AM, Paolo Bonzini wrote: >>> >>> >>> On 01/09/2015 11:14, Stefan Hajnoczi wrote: >>>>>> >>>>>> When I was digging into live migration code, i noticed that the same MR name may >>>>>> cause the name "idstr", please refer to qemu_ram_set_idstr(). >>>>>> >>>>>> Since nvdimm devices do not have parent-bus, it will trigger the abort() in that >>>>>> function. >>>> I see. The other devices that use a constant name are on a bus so the >>>> abort doesn't trigger. >>> >>> However, the MR name must be the same across the two machines. Indices >>> are not friendly to hotplug. Even though hotplug isn't supported now, >>> we should prepare and try not to change migration format when we support >>> hotplug in the future. >>> >> >> Thanks for your reminder. >> >>> Is there any other fixed value that we can use, for example the base >>> address of the NVDIMM? >> >> How about use object_get_canonical_path(OBJECT(dev)) (the @dev is NVDIMM >> device) ? > if you use split backend/frotnend idea then existing backends > already have a stable name derived from backend's ID and you won't need to care > about it. > Yes, i am using this idea and addressing your suggestion that use memory_region_init_alias() to partly map hostmem to guest's address space. The code is like this: /* get the memory region from backend memory. */ mr = host_memory_backend_get_memory(dimm->hostmem, errp); /* nvdimm_nr will map to guest address space. */ memory_region_init_alias(&nvdimm->nvdimm_mr, OBJECT(dev), object_get_canonical_path(OBJECT(dev)), mr, 0, size - nvdimm->label_size); /* the label size at the end of the file used as label_data of NVDIMM. */ ...... So there are two memory regions, one is the backend-mem and another one is nvdimm_mr in the example above. The name i am worried about is the name of nvdimm_mr.