qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Bug 1896298] [NEW] memory leak
@ 2020-09-18 22:39 Michael Slade
  2020-09-18 23:20 ` [Bug 1896298] " Michael Slade
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Michael Slade @ 2020-09-18 22:39 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

qemu trunk as of today leaks memory FAST when freedos' edit is running.

To reproduce, download:

https://www.ibiblio.org/pub/micro/pc-
stuff/freedos/files/repositories/1.3/cdrom.iso

Then run:

$ qemu-system-i386 -cdrom cdrom.iso

select your language then select "return to DOS", then type

> edit

it will consume memory at ~10MB/s

This does NOT happen when adding -enable-kvm

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1896298

Title:
  memory leak

Status in QEMU:
  New

Bug description:
  qemu trunk as of today leaks memory FAST when freedos' edit is
  running.

  To reproduce, download:

  https://www.ibiblio.org/pub/micro/pc-
  stuff/freedos/files/repositories/1.3/cdrom.iso

  Then run:

  $ qemu-system-i386 -cdrom cdrom.iso

  select your language then select "return to DOS", then type

  > edit

  it will consume memory at ~10MB/s

  This does NOT happen when adding -enable-kvm

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1896298/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1896298] Re: memory leak
  2020-09-18 22:39 [Bug 1896298] [NEW] memory leak Michael Slade
@ 2020-09-18 23:20 ` Michael Slade
  2020-12-02  7:55 ` Thomas Huth
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Michael Slade @ 2020-09-18 23:20 UTC (permalink / raw)
  To: qemu-devel

Note, this also occurs with freeDOS 1.2, at least.

Note 2, 4.2 stable does not exhibit the bug.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1896298

Title:
  memory leak

Status in QEMU:
  New

Bug description:
  qemu trunk as of today leaks memory FAST when freedos' edit is
  running.

  To reproduce, download:

  https://www.ibiblio.org/pub/micro/pc-
  stuff/freedos/files/repositories/1.3/cdrom.iso

  Then run:

  $ qemu-system-i386 -cdrom cdrom.iso

  select your language then select "return to DOS", then type

  > edit

  it will consume memory at ~10MB/s

  This does NOT happen when adding -enable-kvm

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1896298/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1896298] Re: memory leak
  2020-09-18 22:39 [Bug 1896298] [NEW] memory leak Michael Slade
  2020-09-18 23:20 ` [Bug 1896298] " Michael Slade
@ 2020-12-02  7:55 ` Thomas Huth
  2021-05-11 13:35 ` Thomas Huth
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Thomas Huth @ 2020-12-02  7:55 UTC (permalink / raw)
  To: qemu-devel

Confirmed, this is still reproducible with the current v5.2-rc4...

** Changed in: qemu
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1896298

Title:
  memory leak

Status in QEMU:
  Confirmed

Bug description:
  qemu trunk as of today leaks memory FAST when freedos' edit is
  running.

  To reproduce, download:

  https://www.ibiblio.org/pub/micro/pc-
  stuff/freedos/files/repositories/1.3/cdrom.iso

  Then run:

  $ qemu-system-i386 -cdrom cdrom.iso

  select your language then select "return to DOS", then type

  > edit

  it will consume memory at ~10MB/s

  This does NOT happen when adding -enable-kvm

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1896298/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1896298] Re: memory leak
  2020-09-18 22:39 [Bug 1896298] [NEW] memory leak Michael Slade
  2020-09-18 23:20 ` [Bug 1896298] " Michael Slade
  2020-12-02  7:55 ` Thomas Huth
@ 2021-05-11 13:35 ` Thomas Huth
  2021-05-13 12:16 ` [Bug 1896298] Re: TCG memory leak with FreeDOS 'edit' Thomas Huth
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Thomas Huth @ 2021-05-11 13:35 UTC (permalink / raw)
  To: qemu-devel

** Tags added: tcg

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1896298

Title:
  memory leak

Status in QEMU:
  Confirmed

Bug description:
  qemu trunk as of today leaks memory FAST when freedos' edit is
  running.

  To reproduce, download:

  https://www.ibiblio.org/pub/micro/pc-
  stuff/freedos/files/repositories/1.3/cdrom.iso

  Then run:

  $ qemu-system-i386 -cdrom cdrom.iso

  select your language then select "return to DOS", then type

  > edit

  it will consume memory at ~10MB/s

  This does NOT happen when adding -enable-kvm

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1896298/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1896298] Re: TCG memory leak with FreeDOS 'edit'
  2020-09-18 22:39 [Bug 1896298] [NEW] memory leak Michael Slade
                   ` (2 preceding siblings ...)
  2021-05-11 13:35 ` Thomas Huth
@ 2021-05-13 12:16 ` Thomas Huth
  2021-05-25 14:51 ` Alex Bennée
  2021-05-25 16:45 ` [Bug 1896298] [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu Alex Bennée
  5 siblings, 0 replies; 13+ messages in thread
From: Thomas Huth @ 2021-05-13 12:16 UTC (permalink / raw)
  To: qemu-devel

This is an automated cleanup. This bug report has been moved to QEMU's
new bug tracker on gitlab.com and thus gets marked as 'expired' now.
Please continue with the discussion here:

 https://gitlab.com/qemu-project/qemu/-/issues/283


** Summary changed:

- memory leak
+ TCG memory leak with FreeDOS 'edit'

** Changed in: qemu
       Status: Confirmed => Expired

** Bug watch added: gitlab.com/qemu-project/qemu/-/issues #283
   https://gitlab.com/qemu-project/qemu/-/issues/283

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1896298

Title:
  TCG memory leak with FreeDOS 'edit'

Status in QEMU:
  Expired

Bug description:
  qemu trunk as of today leaks memory FAST when freedos' edit is
  running.

  To reproduce, download:

  https://www.ibiblio.org/pub/micro/pc-
  stuff/freedos/files/repositories/1.3/cdrom.iso

  Then run:

  $ qemu-system-i386 -cdrom cdrom.iso

  select your language then select "return to DOS", then type

  > edit

  it will consume memory at ~10MB/s

  This does NOT happen when adding -enable-kvm

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1896298/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1896298] Re: TCG memory leak with FreeDOS 'edit'
  2020-09-18 22:39 [Bug 1896298] [NEW] memory leak Michael Slade
                   ` (3 preceding siblings ...)
  2021-05-13 12:16 ` [Bug 1896298] Re: TCG memory leak with FreeDOS 'edit' Thomas Huth
@ 2021-05-25 14:51 ` Alex Bennée
  2021-05-25 16:45 ` [Bug 1896298] [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu Alex Bennée
  5 siblings, 0 replies; 13+ messages in thread
From: Alex Bennée @ 2021-05-25 14:51 UTC (permalink / raw)
  To: qemu-devel

Just to repeat the work around discussed on the GitLab page: -accel tcg
,tb-size=32 will prevent the rapid increase of memory due to self
modifying code.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1896298

Title:
  TCG memory leak with FreeDOS 'edit'

Status in QEMU:
  Expired

Bug description:
  qemu trunk as of today leaks memory FAST when freedos' edit is
  running.

  To reproduce, download:

  https://www.ibiblio.org/pub/micro/pc-
  stuff/freedos/files/repositories/1.3/cdrom.iso

  Then run:

  $ qemu-system-i386 -cdrom cdrom.iso

  select your language then select "return to DOS", then type

  > edit

  it will consume memory at ~10MB/s

  This does NOT happen when adding -enable-kvm

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1896298/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1896298] [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu
  2020-09-18 22:39 [Bug 1896298] [NEW] memory leak Michael Slade
                   ` (4 preceding siblings ...)
  2021-05-25 14:51 ` Alex Bennée
@ 2021-05-25 16:45 ` Alex Bennée
  2021-05-25 16:45   ` Alex Bennée
                     ` (2 more replies)
  5 siblings, 3 replies; 13+ messages in thread
From: Alex Bennée @ 2021-05-25 16:45 UTC (permalink / raw)
  To: qemu-devel

There are two justifications for making this change. The first is that
i386 emulation is typically for smaller machines where having a 1gb of
generated code is overkill for basic emulation. The second is the
propensity of self-modifying code (c.f. Doom/edit) utilised on i386
systems can trigger a rapid growth in invalidated and re-translated
buffers. This is seen in bug #283. Execution is still inefficient but
at least the host memory isn't so aggressively used up.

That said it's still really just a sticking plaster for user
convenience.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Thomas Huth <thuth@redhat.com>
Cc: 1896298@bugs.launchpad.net
---
 accel/tcg/translate-all.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 640ff6e3e7..f442165674 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -951,9 +951,13 @@ static void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1,
  * Users running large scale system emulation may want to tweak their
  * runtime setup via the tb-size control on the command line.
  */
+#ifdef TARGET_I386
+#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (32 * MiB)
+#else
 #define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (1 * GiB)
 #endif
 #endif
+#endif
 
 #define DEFAULT_CODE_GEN_BUFFER_SIZE \
   (DEFAULT_CODE_GEN_BUFFER_SIZE_1 < MAX_CODE_GEN_BUFFER_SIZE \
-- 
2.20.1

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1896298

Title:
  TCG memory leak with FreeDOS 'edit'

Status in QEMU:
  Expired

Bug description:
  qemu trunk as of today leaks memory FAST when freedos' edit is
  running.

  To reproduce, download:

  https://www.ibiblio.org/pub/micro/pc-
  stuff/freedos/files/repositories/1.3/cdrom.iso

  Then run:

  $ qemu-system-i386 -cdrom cdrom.iso

  select your language then select "return to DOS", then type

  > edit

  it will consume memory at ~10MB/s

  This does NOT happen when adding -enable-kvm

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1896298/+subscriptions


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu
  2021-05-25 16:45 ` [Bug 1896298] [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu Alex Bennée
@ 2021-05-25 16:45   ` Alex Bennée
  2021-06-03 16:33   ` Alex Bennée
  2021-06-03 19:04   ` Richard Henderson
  2 siblings, 0 replies; 13+ messages in thread
From: Alex Bennée @ 2021-05-25 16:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Richard Henderson, Thomas Huth, 1896298, Alex Bennée, Paolo Bonzini

There are two justifications for making this change. The first is that
i386 emulation is typically for smaller machines where having a 1gb of
generated code is overkill for basic emulation. The second is the
propensity of self-modifying code (c.f. Doom/edit) utilised on i386
systems can trigger a rapid growth in invalidated and re-translated
buffers. This is seen in bug #283. Execution is still inefficient but
at least the host memory isn't so aggressively used up.

That said it's still really just a sticking plaster for user
convenience.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Thomas Huth <thuth@redhat.com>
Cc: 1896298@bugs.launchpad.net
---
 accel/tcg/translate-all.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 640ff6e3e7..f442165674 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -951,9 +951,13 @@ static void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1,
  * Users running large scale system emulation may want to tweak their
  * runtime setup via the tb-size control on the command line.
  */
+#ifdef TARGET_I386
+#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (32 * MiB)
+#else
 #define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (1 * GiB)
 #endif
 #endif
+#endif
 
 #define DEFAULT_CODE_GEN_BUFFER_SIZE \
   (DEFAULT_CODE_GEN_BUFFER_SIZE_1 < MAX_CODE_GEN_BUFFER_SIZE \
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu
  2021-05-25 16:45 ` [Bug 1896298] [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu Alex Bennée
  2021-05-25 16:45   ` Alex Bennée
@ 2021-06-03 16:33   ` Alex Bennée
  2021-06-03 16:33     ` [Bug 1896298] " Alex Bennée
  2021-06-03 19:04   ` Richard Henderson
  2 siblings, 1 reply; 13+ messages in thread
From: Alex Bennée @ 2021-06-03 16:33 UTC (permalink / raw)
  To: qemu-devel
  Cc: Richard Henderson, Thomas Huth, 1896298, Alex Bennée, Paolo Bonzini


Alex Bennée <alex.bennee@linaro.org> writes:

> There are two justifications for making this change. The first is that
> i386 emulation is typically for smaller machines where having a 1gb of
> generated code is overkill for basic emulation. The second is the
> propensity of self-modifying code (c.f. Doom/edit) utilised on i386
> systems can trigger a rapid growth in invalidated and re-translated
> buffers. This is seen in bug #283. Execution is still inefficient but
> at least the host memory isn't so aggressively used up.
>
> That said it's still really just a sticking plaster for user
> convenience.

ping?


-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1896298] Re: [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu
  2021-06-03 16:33   ` Alex Bennée
@ 2021-06-03 16:33     ` Alex Bennée
  0 siblings, 0 replies; 13+ messages in thread
From: Alex Bennée @ 2021-06-03 16:33 UTC (permalink / raw)
  To: qemu-devel

Alex Bennée <alex.bennee@linaro.org> writes:

> There are two justifications for making this change. The first is that
> i386 emulation is typically for smaller machines where having a 1gb of
> generated code is overkill for basic emulation. The second is the
> propensity of self-modifying code (c.f. Doom/edit) utilised on i386
> systems can trigger a rapid growth in invalidated and re-translated
> buffers. This is seen in bug #283. Execution is still inefficient but
> at least the host memory isn't so aggressively used up.
>
> That said it's still really just a sticking plaster for user
> convenience.

ping?


-- 
Alex Bennée

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1896298

Title:
  TCG memory leak with FreeDOS 'edit'

Status in QEMU:
  Expired

Bug description:
  qemu trunk as of today leaks memory FAST when freedos' edit is
  running.

  To reproduce, download:

  https://www.ibiblio.org/pub/micro/pc-
  stuff/freedos/files/repositories/1.3/cdrom.iso

  Then run:

  $ qemu-system-i386 -cdrom cdrom.iso

  select your language then select "return to DOS", then type

  > edit

  it will consume memory at ~10MB/s

  This does NOT happen when adding -enable-kvm

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1896298/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu
  2021-05-25 16:45 ` [Bug 1896298] [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu Alex Bennée
  2021-05-25 16:45   ` Alex Bennée
  2021-06-03 16:33   ` Alex Bennée
@ 2021-06-03 19:04   ` Richard Henderson
  2021-06-04  7:42     ` Alex Bennée
  2 siblings, 1 reply; 13+ messages in thread
From: Richard Henderson @ 2021-06-03 19:04 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: Paolo Bonzini, Thomas Huth, 1896298

On 5/25/21 9:45 AM, Alex Bennée wrote:
> There are two justifications for making this change. The first is that
> i386 emulation is typically for smaller machines where having a 1gb of
> generated code is overkill for basic emulation. The second is the
> propensity of self-modifying code (c.f. Doom/edit) utilised on i386
> systems can trigger a rapid growth in invalidated and re-translated
> buffers. This is seen in bug #283. Execution is still inefficient but
> at least the host memory isn't so aggressively used up.
> 
> That said it's still really just a sticking plaster for user
> convenience.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: 1896298@bugs.launchpad.net
> ---
>   accel/tcg/translate-all.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index 640ff6e3e7..f442165674 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -951,9 +951,13 @@ static void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1,
>    * Users running large scale system emulation may want to tweak their
>    * runtime setup via the tb-size control on the command line.
>    */
> +#ifdef TARGET_I386
> +#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (32 * MiB)
> +#else
>   #define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (1 * GiB)
>   #endif
>   #endif
> +#endif
>   
>   #define DEFAULT_CODE_GEN_BUFFER_SIZE \
>     (DEFAULT_CODE_GEN_BUFFER_SIZE_1 < MAX_CODE_GEN_BUFFER_SIZE \
> 

I'm not thrilled, as it is ultra-hacky.

(1) I've got a re-org of this code out for review: 
https://patchew.org/QEMU/20210502231844.1977630-1-richard.henderson@linaro.org/

(2) I'm keen to reorg TCG such that it gets compiled once.  There's currently 
nothing standing in the way of that except work.  But this would introduce a 
use of a target-specific define for the first time into tcg/.  I guess I could 
leave the default sizing back in accel/tcg/ and pass in the default.

Other options?


r~


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu
  2021-06-03 19:04   ` Richard Henderson
@ 2021-06-04  7:42     ` Alex Bennée
  2021-06-04  7:42       ` [Bug 1896298] " Alex Bennée
  0 siblings, 1 reply; 13+ messages in thread
From: Alex Bennée @ 2021-06-04  7:42 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Paolo Bonzini, Thomas Huth, 1896298, qemu-devel


Richard Henderson <richard.henderson@linaro.org> writes:

> On 5/25/21 9:45 AM, Alex Bennée wrote:
>> There are two justifications for making this change. The first is that
>> i386 emulation is typically for smaller machines where having a 1gb of
>> generated code is overkill for basic emulation. The second is the
>> propensity of self-modifying code (c.f. Doom/edit) utilised on i386
>> systems can trigger a rapid growth in invalidated and re-translated
>> buffers. This is seen in bug #283. Execution is still inefficient but
>> at least the host memory isn't so aggressively used up.
>> That said it's still really just a sticking plaster for user
>> convenience.
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Cc: Thomas Huth <thuth@redhat.com>
>> Cc: 1896298@bugs.launchpad.net
>> ---
>>   accel/tcg/translate-all.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
>> index 640ff6e3e7..f442165674 100644
>> --- a/accel/tcg/translate-all.c
>> +++ b/accel/tcg/translate-all.c
>> @@ -951,9 +951,13 @@ static void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1,
>>    * Users running large scale system emulation may want to tweak their
>>    * runtime setup via the tb-size control on the command line.
>>    */
>> +#ifdef TARGET_I386
>> +#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (32 * MiB)
>> +#else
>>   #define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (1 * GiB)
>>   #endif
>>   #endif
>> +#endif
>>     #define DEFAULT_CODE_GEN_BUFFER_SIZE \
>>     (DEFAULT_CODE_GEN_BUFFER_SIZE_1 < MAX_CODE_GEN_BUFFER_SIZE \
>> 
>
> I'm not thrilled, as it is ultra-hacky.

I don't disagree.

> (1) I've got a re-org of this code out for review:
> https://patchew.org/QEMU/20210502231844.1977630-1-richard.henderson@linaro.org/

OK I'll have a look at that.

> (2) I'm keen to reorg TCG such that it gets compiled once.  There's
> currently nothing standing in the way of that except work.  But this
> would introduce a use of a target-specific define for the first time
> into tcg/.  I guess I could leave the default sizing back in
> accel/tcg/ and pass in the default.
>
> Other options?

Some random thoughts in no particular order:

 - a separately flushable translation region for code we detect as SMC heavy

 - a front-end interpreter for SMC code

 - smarter code generation that dynamically loads values from codemem
   (usually the SMC code is just tweaking an #imm value)

None of these seem particularly amenable to a clean non-complex
implementation though. A front-end interpreter would be useful for other
things though - it could even be incomplete and handle only common code
patterns falling back to full generation for anything it can't handle.

>
>
> r~


-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 1896298] Re: [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu
  2021-06-04  7:42     ` Alex Bennée
@ 2021-06-04  7:42       ` Alex Bennée
  0 siblings, 0 replies; 13+ messages in thread
From: Alex Bennée @ 2021-06-04  7:42 UTC (permalink / raw)
  To: qemu-devel

Richard Henderson <richard.henderson@linaro.org> writes:

> On 5/25/21 9:45 AM, Alex Bennée wrote:
>> There are two justifications for making this change. The first is that
>> i386 emulation is typically for smaller machines where having a 1gb of
>> generated code is overkill for basic emulation. The second is the
>> propensity of self-modifying code (c.f. Doom/edit) utilised on i386
>> systems can trigger a rapid growth in invalidated and re-translated
>> buffers. This is seen in bug #283. Execution is still inefficient but
>> at least the host memory isn't so aggressively used up.
>> That said it's still really just a sticking plaster for user
>> convenience.
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Cc: Thomas Huth <thuth@redhat.com>
>> Cc: 1896298@bugs.launchpad.net
>> ---
>>   accel/tcg/translate-all.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
>> index 640ff6e3e7..f442165674 100644
>> --- a/accel/tcg/translate-all.c
>> +++ b/accel/tcg/translate-all.c
>> @@ -951,9 +951,13 @@ static void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1,
>>    * Users running large scale system emulation may want to tweak their
>>    * runtime setup via the tb-size control on the command line.
>>    */
>> +#ifdef TARGET_I386
>> +#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (32 * MiB)
>> +#else
>>   #define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (1 * GiB)
>>   #endif
>>   #endif
>> +#endif
>>     #define DEFAULT_CODE_GEN_BUFFER_SIZE \
>>     (DEFAULT_CODE_GEN_BUFFER_SIZE_1 < MAX_CODE_GEN_BUFFER_SIZE \
>> 
>
> I'm not thrilled, as it is ultra-hacky.

I don't disagree.

> (1) I've got a re-org of this code out for review:
> https://patchew.org/QEMU/20210502231844.1977630-1-richard.henderson@linaro.org/

OK I'll have a look at that.

> (2) I'm keen to reorg TCG such that it gets compiled once.  There's
> currently nothing standing in the way of that except work.  But this
> would introduce a use of a target-specific define for the first time
> into tcg/.  I guess I could leave the default sizing back in
> accel/tcg/ and pass in the default.
>
> Other options?

Some random thoughts in no particular order:

 - a separately flushable translation region for code we detect as SMC
heavy

 - a front-end interpreter for SMC code

 - smarter code generation that dynamically loads values from codemem
   (usually the SMC code is just tweaking an #imm value)

None of these seem particularly amenable to a clean non-complex
implementation though. A front-end interpreter would be useful for other
things though - it could even be incomplete and handle only common code
patterns falling back to full generation for anything it can't handle.

>
>
> r~


-- 
Alex Bennée

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1896298

Title:
  TCG memory leak with FreeDOS 'edit'

Status in QEMU:
  Expired

Bug description:
  qemu trunk as of today leaks memory FAST when freedos' edit is
  running.

  To reproduce, download:

  https://www.ibiblio.org/pub/micro/pc-
  stuff/freedos/files/repositories/1.3/cdrom.iso

  Then run:

  $ qemu-system-i386 -cdrom cdrom.iso

  select your language then select "return to DOS", then type

  > edit

  it will consume memory at ~10MB/s

  This does NOT happen when adding -enable-kvm

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1896298/+subscriptions


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-06-04  8:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 22:39 [Bug 1896298] [NEW] memory leak Michael Slade
2020-09-18 23:20 ` [Bug 1896298] " Michael Slade
2020-12-02  7:55 ` Thomas Huth
2021-05-11 13:35 ` Thomas Huth
2021-05-13 12:16 ` [Bug 1896298] Re: TCG memory leak with FreeDOS 'edit' Thomas Huth
2021-05-25 14:51 ` Alex Bennée
2021-05-25 16:45 ` [Bug 1896298] [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu Alex Bennée
2021-05-25 16:45   ` Alex Bennée
2021-06-03 16:33   ` Alex Bennée
2021-06-03 16:33     ` [Bug 1896298] " Alex Bennée
2021-06-03 19:04   ` Richard Henderson
2021-06-04  7:42     ` Alex Bennée
2021-06-04  7:42       ` [Bug 1896298] " Alex Bennée

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).