From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoCXG-0001X6-J4 for qemu-devel@nongnu.org; Tue, 02 Aug 2011 06:49:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QoCXE-0001ZK-LC for qemu-devel@nongnu.org; Tue, 02 Aug 2011 06:49:18 -0400 Received: from goliath.siemens.de ([192.35.17.28]:30881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoCXE-0001Ym-3R for qemu-devel@nongnu.org; Tue, 02 Aug 2011 06:49:16 -0400 Message-ID: <4E37D621.3050302@siemens.com> Date: Tue, 02 Aug 2011 12:49:05 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1312226782-26882-1-git-send-email-anthony.perard@citrix.com> <4E37052E.70707@web.de> In-Reply-To: <4E37052E.70707@web.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] xen: Avoid useless allocation in Xen case. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony PERARD Cc: Alexander Graf , Xen Devel , QEMU-devel , Stefano Stabellini On 2011-08-01 21:57, Jan Kiszka wrote: > On 2011-08-01 21:26, Anthony PERARD wrote: >> The code_gen_buffer is not use by Xen and can be really big (several >> GB). Even if the host RAM is not used, this buffer just burn the address >> space of the QEMU process. >> >> So to "avoid" this allocation, the asked tb_size is set to the minimum. >> >> The other way to do that would be to not call code_gen_alloc when Xen is >> enabled. >> >> Signed-off-by: Anthony PERARD >> --- >> vl.c | 8 ++++++++ >> 1 files changed, 8 insertions(+), 0 deletions(-) >> >> diff --git a/vl.c b/vl.c >> index d8c7c01..bd60a89 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -3106,6 +3106,14 @@ int main(int argc, char **argv, char **envp) >> } >> } >> >> + if (xen_enabled()) { >> + /* Allocate only the minimum amount of memory for the code_gen_buffer. >> + * Xen does not use it and we need the virtual address space for the >> + * MapCache. >> + */ >> + tb_size = 1; >> + } >> + > > The same applies to kvm, please generalize. Actually, qemu-kvm avoids this overhead today by making code_gen_alloc return immediately when kvm is on. Also not very beautiful. Can't we simply skip cpu_exec_init_all for any accel != TCG, e.g. by moving that call to tcg_init? Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] xen: Avoid useless allocation in Xen case. Date: Tue, 02 Aug 2011 12:49:05 +0200 Message-ID: <4E37D621.3050302@siemens.com> References: <1312226782-26882-1-git-send-email-anthony.perard@citrix.com> <4E37052E.70707@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4E37052E.70707@web.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: Anthony PERARD Cc: Alexander Graf , Xen Devel , QEMU-devel , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On 2011-08-01 21:57, Jan Kiszka wrote: > On 2011-08-01 21:26, Anthony PERARD wrote: >> The code_gen_buffer is not use by Xen and can be really big (several >> GB). Even if the host RAM is not used, this buffer just burn the address >> space of the QEMU process. >> >> So to "avoid" this allocation, the asked tb_size is set to the minimum. >> >> The other way to do that would be to not call code_gen_alloc when Xen is >> enabled. >> >> Signed-off-by: Anthony PERARD >> --- >> vl.c | 8 ++++++++ >> 1 files changed, 8 insertions(+), 0 deletions(-) >> >> diff --git a/vl.c b/vl.c >> index d8c7c01..bd60a89 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -3106,6 +3106,14 @@ int main(int argc, char **argv, char **envp) >> } >> } >> >> + if (xen_enabled()) { >> + /* Allocate only the minimum amount of memory for the code_gen_buffer. >> + * Xen does not use it and we need the virtual address space for the >> + * MapCache. >> + */ >> + tb_size = 1; >> + } >> + > > The same applies to kvm, please generalize. Actually, qemu-kvm avoids this overhead today by making code_gen_alloc return immediately when kvm is on. Also not very beautiful. Can't we simply skip cpu_exec_init_all for any accel != TCG, e.g. by moving that call to tcg_init? Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux