[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4Y+boDPGU_02AhzUCCHfHdPaviMd5sTJTuV5RuYNor4wRpg@mail.gmail.com>
Date: Tue, 12 Sep 2017 16:42:56 +0200
From: Dmitry Vyukov <dvyukov@...gle.com>
To: Radim Krčmář <rkrcmar@...hat.com>,
David Hildenbrand <david@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
KVM list <kvm@...r.kernel.org>
Cc: llvmlinux@...ts.linuxfoundation.org,
Alexander Potapenko <glider@...gle.com>,
andreyknvl <andreyknvl@...gle.com>,
Michael Davidson <md@...gle.com>,
Greg Hackmann <ghackmann@...gle.com>,
Nick Desaulniers <ndesaulniers@...gle.com>
Subject: "KVM: x86: generalize guest_cpuid_has_ helpers" breaks clang
Hi Radim,
I've just noticed that your commit "KVM: x86: generalize
guest_cpuid_has_ helpers" breaks clang build on this assert:
static __always_inline struct cpuid_reg x86_feature_cpuid(unsigned x86_feature)
{
unsigned x86_leaf = x86_feature / 32;
BUILD_BUG_ON(!__builtin_constant_p(x86_leaf));
In clang __builtin_constant_p is never true for function arguments,
it's true only for compile-time constants (what you can use as stack
array size, or C++ template argument). What would work is an
additional macro along the lines of:
#define x86_feature_cpuid(x) (BUILD_BUG_ON(!__builtin_constant_p(x),
__x86_feature_cpuid(x))
But again assuming that caller pass the constant directly.
Could you please fix it?
Thanks
Powered by blists - more mailing lists