Patchwork [Qemu-stable] tcg: Fix occasional TCG broken problem when ldst optimization enabled

login
register
mail settings
Submitter YeongKyoon Lee
Date March 22, 2013, 11:28 a.m.
Message ID <1363951734-27019-1-git-send-email-yeongkyoon.lee@samsung.com>
Download mbox | patch
Permalink /patch/229967/
State New
Headers show

Comments

YeongKyoon Lee - March 22, 2013, 11:28 a.m.
is_tcg_gen_code() checks the upper limit of TCG generated code range wrong, so
that TCG could get broken occasionally only when CONFIG_QEMU_LDST_OPTIMIZATION
enabled. The reason is code_gen_buffer_max_size does not cover the upper range
up to (TCG_MAX_OP_SIZE * OPC_BUF_SIZE), thus code_gen_buffer_max_size should be
modified to code_gen_buffer_size.

Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
---

Here's is the promised patch with Aurelien Jarno for TCG broken problem, which
is supposed to be applied to 1.3.x and 1.4.x releases as well as master.
Thanks to Aurelien Jarno and Stefan Weil.

 translate-all.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Peter Maydell - March 22, 2013, 11:41 a.m.
On 22 March 2013 11:28, Yeongkyoon Lee <yeongkyoon.lee@samsung.com> wrote:
> is_tcg_gen_code() checks the upper limit of TCG generated code range wrong, so
> that TCG could get broken occasionally only when CONFIG_QEMU_LDST_OPTIMIZATION
> enabled. The reason is code_gen_buffer_max_size does not cover the upper range
> up to (TCG_MAX_OP_SIZE * OPC_BUF_SIZE), thus code_gen_buffer_max_size should be
> modified to code_gen_buffer_size.
>
> Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
> ---
>
> Here's is the promised patch with Aurelien Jarno for TCG broken problem, which
> is supposed to be applied to 1.3.x and 1.4.x releases as well as master.
> Thanks to Aurelien Jarno and Stefan Weil.
>
>  translate-all.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/translate-all.c b/translate-all.c
> index 1f3237e..7851e1a 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -1312,7 +1312,7 @@ bool is_tcg_gen_code(uintptr_t tc_ptr)
>         is used instead of code_gen_ptr for upper boundary checking */
>      return (tc_ptr >= (uintptr_t)tcg_ctx.code_gen_buffer &&
>              tc_ptr < (uintptr_t)(tcg_ctx.code_gen_buffer +
> -                    tcg_ctx.code_gen_buffer_max_size));
> +                    tcg_ctx.code_gen_buffer_size));
>  }

Hi; this change makes the comment in this function wrong, so I think
you need to update that too. (The code change itself looks right to me.)

thanks
-- PMM

Patch

diff --git a/translate-all.c b/translate-all.c
index 1f3237e..7851e1a 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -1312,7 +1312,7 @@  bool is_tcg_gen_code(uintptr_t tc_ptr)
        is used instead of code_gen_ptr for upper boundary checking */
     return (tc_ptr >= (uintptr_t)tcg_ctx.code_gen_buffer &&
             tc_ptr < (uintptr_t)(tcg_ctx.code_gen_buffer +
-                    tcg_ctx.code_gen_buffer_max_size));
+                    tcg_ctx.code_gen_buffer_size));
 }
 #endif