qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 3/3] tcg: allocate TB structs before the corr


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v2 3/3] tcg: allocate TB structs before the corresponding translated code
Date: Tue, 6 Jun 2017 01:24:11 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

On 06/05/2017 03:49 PM, Emilio G. Cota wrote:
+TranslationBlock *tcg_tb_alloc(TCGContext *s)
+{
+    void *aligned;
+
+    aligned = (void *)ROUND_UP((uintptr_t)s->code_gen_ptr, 
QEMU_CACHELINE_SIZE);
+    if (unlikely(aligned + sizeof(TranslationBlock) > s->code_gen_highwater)) {
+        return NULL;
+    }
+    s->code_gen_ptr += aligned - s->code_gen_ptr + sizeof(TranslationBlock);
+    return aligned;

We don't really need the 2/3 patch. We don't gain anything by telling the compiler that the structure is more aligned than it needs to be.

We can query the line size at runtime, as suggested by Pranith, and use that for the alignment here. Which means that the binary isn't tied to a particular cpu implementation, which is clearly preferable for distributions.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]