From patchwork Fri Jul 6 18:50:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 169529 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 74C432C01EA for ; Sat, 7 Jul 2012 04:50:29 +1000 (EST) Received: from localhost ([::1]:55884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SnDbm-0006QW-Ry for incoming@patchwork.ozlabs.org; Fri, 06 Jul 2012 14:50:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SnDbd-0006QB-Va for qemu-devel@nongnu.org; Fri, 06 Jul 2012 14:50:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SnDbc-0007d2-5k for qemu-devel@nongnu.org; Fri, 06 Jul 2012 14:50:17 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:36300) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SnDbb-0007cq-Tx for qemu-devel@nongnu.org; Fri, 06 Jul 2012 14:50:16 -0400 Received: from [192.168.88.2] (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id 3589FA0484; Fri, 6 Jul 2012 22:50:13 +0400 (MSK) Message-ID: <4FF73363.1080409@msgid.tls.msk.ru> Date: Fri, 06 Jul 2012 22:50:11 +0400 From: Michael Tokarev Organization: Telecom Service, JSC User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4 MIME-Version: 1.0 To: Avi Kivity References: <1339922831-23002-1-git-send-email-avi@redhat.com> <4FDDB981.8070309@web.de> <4FDDBFCD.3000608@redhat.com> <4FDDC3C8.5020205@web.de> <4FDDC4B6.5030202@redhat.com> <4FDDD39D.9090800@redhat.com> <4FDDD818.4030700@redhat.com> In-Reply-To: <4FDDD818.4030700@redhat.com> X-Enigmail-Version: 1.4.1 OpenPGP: id=804465C5 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 86.62.121.231 Cc: Blue Swirl , Marcelo Tosatti , Jan Kiszka , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: Re: [Qemu-devel] [PATCH] kvm: align ram_size to page boundary X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On 17.06.2012 17:14, Avi Kivity wrote: > On 06/17/2012 04:06 PM, Blue Swirl wrote: > >>> strtosz() is much too general. We could do it in vl.c without trouble. >>> However, it takes away our ability to emulate a "640k should be enough >>> for everyone" machine. >> >> Then how about current max of target page sizes: 8k? No machine should >> want less than that. > > Okay by me, but I can hear the we-should-have-a-generic-mechanism crowd > charging their megaphone batteries. So, is there some bottom line in that? I think I'll put a (temp) fix/workaround for the debian package to require memory size to be a multiple of 8K, and to produce a warning if that requiriment hasn't met. Something like this: With this patch, running qemu-system-x86_64 -m 1.4g produces the following: warning: requested memory size (1503238553 bytes) truncated to 1503232000 bytes Thanks, /mjt diff --git a/vl.c b/vl.c index 5d9fc55..db98a4a 100644 --- a/vl.c +++ b/vl.c @@ -2671,7 +2675,15 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "qemu: ram size too large\n"); exit(1); } - ram_size = value; +#define RAM_SIZE_GRANULARITY (8*1024) + ram_size = value / RAM_SIZE_GRANULARITY; + ram_size *= RAM_SIZE_GRANULARITY; + if (ram_size != value) { + fprintf(stderr, + "warning: requested memory size (%" PRIu64 " bytes) " + "truncated to %" PRIu64 " bytes\n", + value, (uint64_t)ram_size); + } break; } case QEMU_OPTION_mempath: