From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dEGAH-00069i-DZ for qemu-devel@nongnu.org; Fri, 26 May 2017 10:24:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dEGAG-0003Od-AO for qemu-devel@nongnu.org; Fri, 26 May 2017 10:24:29 -0400 Received: from mail-oi0-x234.google.com ([2607:f8b0:4003:c06::234]:33295) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dEGAG-0003N3-3l for qemu-devel@nongnu.org; Fri, 26 May 2017 10:24:28 -0400 Received: by mail-oi0-x234.google.com with SMTP id w10so14552904oif.0 for ; Fri, 26 May 2017 07:24:28 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20170526071654.kxcqflvpo2tvcrvu@hz-desktop> References: <20170526023213.18741-1-haozhong.zhang@intel.com> <20170526023213.18741-2-haozhong.zhang@intel.com> <20170526065132.ayapfebbft5lyigd@hz-desktop> <20170526071654.kxcqflvpo2tvcrvu@hz-desktop> From: Dan Williams Date: Fri, 26 May 2017 07:24:26 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RESEND PATCH 2/2] hostmem-file: add an attribute 'align' to set its alignment List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Eduardo Habkost , Peter Crosthwaite , Stefan Hajnoczi , Xiao Guangrong , Igor Mammedov , Paolo Bonzini , Dan Williams , Richard Henderson On Fri, May 26, 2017 at 12:16 AM, Haozhong Zhang wrote: > On 05/26/17 07:05 +0000, Marc-Andr=C3=A9 Lureau wrote: >> Hi >> >> On Fri, May 26, 2017 at 10:51 AM Haozhong Zhang >> wrote: >> >> > On 05/26/17 06:39 +0000, Marc-Andr=C3=A9 Lureau wrote: >> > > Hi >> > > >> > > On Fri, May 26, 2017 at 6:34 AM Haozhong Zhang > > > >> > > wrote: >> > > >> > > > file_ram_alloc() currently maps the backend file via mmap to a vir= tual >> > > > address aligned to the value returned by qemu_fd_getpagesize(). Wh= en a >> > > > DAX device (e.g. /dev/dax0.0) is used as the backend file, its ker= nel >> > > > mmap implementation may require an alignment larger than what >> > > > qemu_fd_get_pagesize() returns (e.g. 2MB vs. 4KB), and mmap may fa= il. >> > > > >> > > >> > > How is the accepted value queried? Any chance to configure it >> > > automatically? >> > >> > Take /dev/dax0.0 for example. The value can be read from >> > /sys/class/dax/dax0.0/device/dax_region/align. >> > >> >> Should this work be left to management layer, or could qemu figure it ou= t >> by itself (using udev?) >> > > For DAX device only, QEMU can figure out the proper alignment by > itself. However, I'm not sure whether there are other non-DAX cases > requiring non-default alignment, so I think it's better to just add an > interface (i.e. align attribute) in QEMU and let other management > tools (e.g. libvirt?) fill a proper value. I can't imagine any cases where you would want to specify an alignment. If it's regular file mmap any alignment is fine, and if it's device-dax only the configured alignment of the device instance is allowed. So, I don't think this should be a configurable option, just read it from the device instance and you're done.