From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH v7 08/35] exec: allow memory to be allocated from any kind of path Date: Wed, 4 Nov 2015 11:12:41 +0800 Message-ID: <563977A9.3000103@linux.intel.com> References: <1446455617-129562-1-git-send-email-guangrong.xiao@linux.intel.com> <1446455617-129562-9-git-send-email-guangrong.xiao@linux.intel.com> <20151103230026.GG4180@thinpad.lan.raisama.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: pbonzini@redhat.com, imammedo@redhat.com, gleb@kernel.org, mtosatti@redhat.com, stefanha@redhat.com, mst@redhat.com, rth@twiddle.net, dan.j.williams@intel.com, kvm@vger.kernel.org, qemu-devel@nongnu.org, vsementsov@virtuozzo.com, eblake@redhat.com To: Eduardo Habkost Return-path: Received: from mga11.intel.com ([192.55.52.93]:2970 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750891AbbKDDT2 (ORCPT ); Tue, 3 Nov 2015 22:19:28 -0500 In-Reply-To: <20151103230026.GG4180@thinpad.lan.raisama.net> Sender: kvm-owner@vger.kernel.org List-ID: On 11/04/2015 07:00 AM, Eduardo Habkost wrote: > On Mon, Nov 02, 2015 at 05:13:10PM +0800, Xiao Guangrong wrote: >> Currently file_ram_alloc() is designed for hugetlbfs, however, the m= emory >> of nvdimm can come from either raw pmem device eg, /dev/pmem, or the= file >> locates at DAX enabled filesystem >> >> So this patch let it work on any kind of path >> >> Signed-off-by: Xiao Guangrong >> --- >> exec.c | 24 ++++++++++++------------ >> 1 file changed, 12 insertions(+), 12 deletions(-) >> >> diff --git a/exec.c b/exec.c >> index 9de38be..9075f4d 100644 >> --- a/exec.c >> +++ b/exec.c >> @@ -1184,25 +1184,25 @@ static void *file_ram_alloc(RAMBlock *block, >> char *c; >> void *area; >> int fd; >> - uint64_t hpagesize; >> + uint64_t pagesize; >> Error *local_err =3D NULL; >> >> - hpagesize =3D qemu_file_get_page_size(path, &local_err); >> + pagesize =3D qemu_file_get_page_size(path, &local_err); >> if (local_err) { >> error_propagate(errp, local_err); >> goto error; >> } >> >> - if (hpagesize =3D=3D getpagesize()) { >> - fprintf(stderr, "Warning: path not on HugeTLBFS: %s\n", pat= h); >> + if (pagesize =3D=3D getpagesize()) { >> + fprintf(stderr, "Memory is not allocated from HugeTlbfs.\n"= ); > > If the point of this patch is to allow file_ram_alloc() to not be > specific to hugetlbfs anymore, this warning can simply go away. > > (And in case if you really want to keep the warning, I don't see the > point of the changes you made to it.) > This is the history why we did it like this: https://lists.gnu.org/archive/html/qemu-devel/2015-10/msg02862.html Q: | What this *actually* is trying to warn against is that | mapping a regular file (as opposed to hugetlbfs) | means transparent huge pages don't work. | So I don't think we should drop this warning completely. | Either let's add the nvdimm magic, or simply check the | page size. A: | Check the page size sounds good, will check: | if (pagesize !=3D getpagesize()) { | ...print something... |} | I agree with you that showing the info is needed, however, | 'Warning' might scare some users, how about drop this word or | just show=E3=80=80=E2=80=9CMemory is not allocated from HugeTlbfs=E2=80= =9D?