Skip to contentSkip to conversation

tcg: Fix occasional TCG broken problem when ldst optimization enabled

PATCH Superseded Yeongkyoon Lee 2 participants 2 messages Mar 22, 2013

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcg: Fix occasional TCG broken problem when ldst optimization enabled

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.

---

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(-)
translate-all.c +1 -1
index 1f3237e..7851e1a 100644
@@ -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
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 21 lines · Yeongkyoon Lee

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.

---

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(-)
translate-all.c +0 -0
index 1f3237e..7851e1a 100644

translate-all.c bool is_tcg_gen_code(uintptr_t tc_ptr) · line 1316

Quoted 6 lines
translate-all.c +1 -1
@@ -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