[Qemu-devel] [PATCH v2 03/13] tcg: enforce 64-byte alignment of TCGContext

Emilio G. Cota posted 13 patches 8 years, 9 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v2 03/13] tcg: enforce 64-byte alignment of TCGContext
Posted by Emilio G. Cota 8 years, 9 months ago
This will allow us to prevent cache line false sharing in TCGContext.

Before:
$ objdump -t  build/x86_64-linux-user/qemu-x86_64 | grep tcg_ctx
00000000003ea820 g     O .bss   00000000000152d8              tcg_ctx

After:
$ objdump -t  build/x86_64-linux-user/qemu-x86_64 | grep tcg_ctx
00000000003ea880 g     O .bss   0000000000015300              tcg_ctx

Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 tcg/tcg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcg/tcg.h b/tcg/tcg.h
index 6c216bb..5fdbfe3 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -727,7 +727,7 @@ struct TCGContext {
 
     uint16_t gen_insn_end_off[TCG_MAX_INSNS];
     target_ulong gen_insn_data[TCG_MAX_INSNS][TARGET_INSN_START_WORDS];
-};
+} QEMU_ALIGNED(64);
 
 extern TCGContext tcg_ctx;
 extern bool parallel_cpus;
-- 
2.7.4


Re: [Qemu-devel] [PATCH v2 03/13] tcg: enforce 64-byte alignment of TCGContext
Posted by Richard Henderson 8 years, 9 months ago
On 04/25/2017 09:53 AM, Emilio G. Cota wrote:
> This will allow us to prevent cache line false sharing in TCGContext.
> 
> Before:
> $ objdump -t  build/x86_64-linux-user/qemu-x86_64 | grep tcg_ctx
> 00000000003ea820 g     O .bss   00000000000152d8              tcg_ctx
> 
> After:
> $ objdump -t  build/x86_64-linux-user/qemu-x86_64 | grep tcg_ctx
> 00000000003ea880 g     O .bss   0000000000015300              tcg_ctx
> 
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
>   tcg/tcg.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index 6c216bb..5fdbfe3 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -727,7 +727,7 @@ struct TCGContext {
>   
>       uint16_t gen_insn_end_off[TCG_MAX_INSNS];
>       target_ulong gen_insn_data[TCG_MAX_INSNS][TARGET_INSN_START_WORDS];
> -};
> +} QEMU_ALIGNED(64);

Let's drop the alignment and structure re-arrangement for now and focus on the 
task of goto_ptr.


r~