[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALI
From: |
Lluís Vilanova |
Subject: |
Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED |
Date: |
Tue, 05 Apr 2016 18:23:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Peter Maydell writes:
> On 5 April 2016 at 13:57, Lluís Vilanova <address@hidden> wrote:
>> Emilio G Cota writes:
>>
>>> I'm assuming windows compilers don't support this attribute.
>>> Signed-off-by: Emilio G. Cota <address@hidden>
>>> ---
>>> include/qemu/compiler.h | 10 ++++++++++
>>> 1 file changed, 10 insertions(+)
>>
>>> diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
>>> index 8f1cc7b..fb946f1 100644
>>> --- a/include/qemu/compiler.h
>>> +++ b/include/qemu/compiler.h
>>> @@ -41,6 +41,16 @@
>>> # define QEMU_PACKED __attribute__((packed))
>>> #endif
>>
>>> +#define QEMU_CACHELINE (64)
>> [...]
>>
>> You should make this a value taken from configure. In linux you could use
>> something like:
>>
>> getconf LEVEL1_DCACHE_LINESIZE
>>
>> Or an equivalent program using sysconf(3) if getconf is not present.
> The cache line size at compile time is not necessarily the cache
> line size at runtime...
True, but exposing it as a configure flag allows tunning for the target arch
during cross-compilation. It would be bettwe to use the compiler to tell you
about the target cache line size, but I'm not aware of a way to do it.
Got it!
gcc -march=native --help=params -v 2>&1 | grep "param l1-cache-line-size" |
sed -e 's/.* --param l1-cache-line-size=\([0-9]\+\) .*/\1/'
Cheers,
Lluis
- Re: [Qemu-devel] [PATCH 05/10] include: add spinlock wrapper, (continued)
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED, Paolo Bonzini, 2016/04/05
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED, Lluís Vilanova, 2016/04/05
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED, Peter Maydell, 2016/04/05
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED, Paolo Bonzini, 2016/04/05
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED,
Lluís Vilanova <=
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED, Richard Henderson, 2016/04/05
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED, Peter Maydell, 2016/04/05
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED, Lluís Vilanova, 2016/04/05
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED, Richard Henderson, 2016/04/05
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED, Lluís Vilanova, 2016/04/05
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED, Paolo Bonzini, 2016/04/06
- Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED, Laurent Desnogues, 2016/04/06
[Qemu-devel] [PATCH 10/10] tb hash: track translated blocks with qht, Emilio G. Cota, 2016/04/05
[Qemu-devel] [PATCH 08/10] qht: QEMU's fast, resizable and scalable Hash Table, Emilio G. Cota, 2016/04/05