* [Qemu-devel] [PATCH] xen: Avoid useless allocation in Xen case.
@ 2011-08-01 19:26 Anthony PERARD
2011-08-01 19:57 ` Jan Kiszka
0 siblings, 1 reply; 5+ messages in thread
From: Anthony PERARD @ 2011-08-01 19:26 UTC (permalink / raw)
To: QEMU-devel; +Cc: Anthony PERARD, Xen Devel, Alexander Graf, Stefano Stabellini
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 <anthony.perard@citrix.com>
---
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;
+ }
+
/* init the dynamic translator */
cpu_exec_init_all(tb_size * 1024 * 1024);
--
Anthony PERARD
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] xen: Avoid useless allocation in Xen case.
2011-08-01 19:26 [Qemu-devel] [PATCH] xen: Avoid useless allocation in Xen case Anthony PERARD
@ 2011-08-01 19:57 ` Jan Kiszka
2011-08-02 10:49 ` Jan Kiszka
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2011-08-01 19:57 UTC (permalink / raw)
To: Anthony PERARD; +Cc: Xen Devel, QEMU-devel, Stefano Stabellini, Alexander Graf
[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]
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 <anthony.perard@citrix.com>
> ---
> 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.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] xen: Avoid useless allocation in Xen case.
2011-08-01 19:57 ` Jan Kiszka
@ 2011-08-02 10:49 ` Jan Kiszka
2011-08-02 12:13 ` Anthony PERARD
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2011-08-02 10:49 UTC (permalink / raw)
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 <anthony.perard@citrix.com>
>> ---
>> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] xen: Avoid useless allocation in Xen case.
2011-08-02 10:49 ` Jan Kiszka
@ 2011-08-02 12:13 ` Anthony PERARD
2011-08-02 12:49 ` Jan Kiszka
0 siblings, 1 reply; 5+ messages in thread
From: Anthony PERARD @ 2011-08-02 12:13 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Xen Devel, Alexander Graf, Stefano Stabellini, QEMU-devel
On Tue, Aug 2, 2011 at 11:49, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> 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?
In the function cpu_exec_init_all(), the call to cpu_gen_init() (and I
suppose to io_mem_init()) is still required. So we can not move the
whole function to tcg_init().
But I can maybe use "if (!tcg_enabled())" instead of a check to xen.
Until no tcg code is use when kvm/xen is enabled.
--
Anthony PERARD
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] xen: Avoid useless allocation in Xen case.
2011-08-02 12:13 ` Anthony PERARD
@ 2011-08-02 12:49 ` Jan Kiszka
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2011-08-02 12:49 UTC (permalink / raw)
To: Anthony PERARD; +Cc: Xen Devel, Alexander Graf, Stefano Stabellini, QEMU-devel
On 2011-08-02 14:13, Anthony PERARD wrote:
> On Tue, Aug 2, 2011 at 11:49, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>> 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?
>
> In the function cpu_exec_init_all(), the call to cpu_gen_init() (and I
> suppose to io_mem_init()) is still required. So we can not move the
> whole function to tcg_init().
>
> But I can maybe use "if (!tcg_enabled())" instead of a check to xen.
> Until no tcg code is use when kvm/xen is enabled.
I would prefer to take the chance and clean up. Anything TCG related
belongs to tcg_init (or a function called from it). Shared services
should be initialized as before. Will send a patch to make a start.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-08-02 12:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-01 19:26 [Qemu-devel] [PATCH] xen: Avoid useless allocation in Xen case Anthony PERARD
2011-08-01 19:57 ` Jan Kiszka
2011-08-02 10:49 ` Jan Kiszka
2011-08-02 12:13 ` Anthony PERARD
2011-08-02 12:49 ` Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).