Received: from eggs.gnu.org ([2001:4830:134:3::10]:41578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anTlt-000642-3b for qemu-devel@nongnu.org; Tue, 05 Apr 2016 12:24:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anTlq-00057Y-A5 for qemu-devel@nongnu.org; Tue, 05 Apr 2016 12:24:05 -0400 Received: from roura.ac.upc.edu ([147.83.33.10]:50162 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anTlp-00056o-Uq for qemu-devel@nongnu.org; Tue, 05 Apr 2016 12:24:02 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <1459834253-8291-1-git-send-email-cota@braap.org> <1459834253-8291-3-git-send-email-cota@braap.org> <87shz0tdr3.fsf@fimbulvetr.bsc.es> Date: Tue, 05 Apr 2016 18:23:52 +0200 In-Reply-To: (Peter Maydell's message of "Tue, 5 Apr 2016 13:58:15 +0100") Message-ID: <87d1q4rplz.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 02/10] compiler.h: add QEMU_CACHELINE + QEMU_ALIGN() + QEMU_CACHELINE_ALIGNED List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: MTTCG Devel , Peter Crosthwaite , QEMU Developers , "Emilio G. Cota" , Paolo Bonzini , Sergey Fedorov , Alex =?utf-8?Q?Benn=C3=A9e?= , Richard Henderson Peter Maydell writes: > On 5 April 2016 at 13:57, Llu=C3=ADs Vilanova wrote: >> Emilio G Cota writes: >>=20 >>> I'm assuming windows compilers don't support this attribute. >>> Signed-off-by: Emilio G. Cota >>> --- >>> include/qemu/compiler.h | 10 ++++++++++ >>> 1 file changed, 10 insertions(+) >>=20 >>> 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 >>=20 >>> +#define QEMU_CACHELINE (64) >> [...] >>=20 >> You should make this a value taken from configure. In linux you could use >> something like: >>=20 >> getconf LEVEL1_DCACHE_LINESIZE >>=20 >> 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=3Dnative --help=3Dparams -v 2>&1 | grep "param l1-cache-line-s= ize" | sed -e 's/.* --param l1-cache-line-size=3D\([0-9]\+\) .*/\1/' Cheers, Lluis