From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Liu Subject: Re: [PATCH 4/4] hvmloader: add support to load extra ACPI tables from qemu Date: Thu, 21 Jan 2016 11:35:55 +0800 Message-ID: <56A0521B.4090207@oracle.com> References: <569F575902000078000C8EDC@prv-mh.provo.novell.com> <569F4C2C.7040300@citrix.com> <20160120101526.GC4939@hz-desktop.sh.intel.com> <569F6336.2040104@linux.intel.com> <569F88AC.40100@citrix.com> <569F9DA5.7010903@citrix.com> <20160120145310.GF11445@hz-desktop.sh.intel.com> <20160120151312.GH24581@char.us.oracle.com> <20160120152902.GA6362@hz-desktop.sh.intel.com> <20160120154106.GC1742@char.us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20160120154106.GC1742@char.us.oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Konrad Rzeszutek Wilk Cc: Kevin Tian , Wei Liu , Ian Campbell , Stefano Stabellini , Andrew Cooper , Ian Jackson , xen-devel@lists.xen.org, Jan Beulich , Jun Nakajima , Xiao Guangrong , Keir Fraser List-Id: xen-devel@lists.xenproject.org On 01/20/2016 11:41 PM, Konrad Rzeszutek Wilk wrote: >>>>> Neither of these are sufficient however. That gets Qemu a mapping of >>>>> the NVDIMM, not the guest. Something, one way or another, has to turn >>>>> this into appropriate add-to-phymap hypercalls. >>>>> >>>> >>>> Yes, those hypercalls are what I'm going to add. >>> >>> Why? >>> >>> What you need (in a rought hand-wave way) is to: >>> - mount /dev/pmem0 >>> - mmap the file on /dev/pmem0 FS >>> - walk the VMA for the file - extract the MFN (machien frame numbers) >> If I understand right, in this case the MFN is the block layout of the DAX-file? If we find all the file blocks, then we get all the MFN. >> Can this step be done by QEMU? Or does linux kernel provide some >> approach for the userspace to do the translation? > The ioctl(fd, FIBMAP, &block) may help, which can get the LBAs that a given file occupies. -Bob > I don't know. I would think no - as you wouldn't want the userspace > application to figure out the physical frames from the virtual > address (unless they are root). But then if you look in > /proc//maps and /proc//smaps there are some data there. > > Hm, /proc//pagemaps has something intersting > > See pagemap_read function. That looks to be doing it? > >> >> Haozhong >> >>> - feed those frame numbers to xc_memory_mapping hypercall. The >>> guest pfns would be contingous. >>> Example: say the E820_NVDIMM starts at 8GB->16GB, so an 8GB file on >>> /dev/pmem0 FS - the guest pfns are 0x200000 upward. >>> >>> However the MFNs may be discontingous as the NVDIMM could be an >>> 1TB - and the 8GB file is scattered all over. >>> >>> I believe that is all you would need to do?