Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752156AbdIMNPY (ORCPT ); Wed, 13 Sep 2017 09:15:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55564 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752018AbdIMNPW (ORCPT ); Wed, 13 Sep 2017 09:15:22 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EE2F25F7AD Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com Subject: Re: [PATCH] KVM: x86: fix clang build To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Dmitry Vyukov References: <20170913131346.2701-1-rkrcmar@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <352d4dce-a0d0-67cf-edd3-1d81bf2b3f96@redhat.com> Date: Wed, 13 Sep 2017 15:15:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170913131346.2701-1-rkrcmar@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 13 Sep 2017 13:15:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1230 Lines: 37 On 13.09.2017 15:13, Radim Krčmář wrote: > Clang resolves __builtin_constant_p() to false even if the expression is > constant in the end. The only purpose of that expression was to > differentiate a case where the following expression couldn't be checked > at compile-time, so we can just remove the check. > > Clang handles the following two correctly. Turn it into BUG_ON if there > are any more problems with this. > > Fixes: d6321d493319 ("KVM: x86: generalize guest_cpuid_has_ helpers") > Reported-by: Dmitry Vyukov > Signed-off-by: Radim Krčmář > --- > arch/x86/kvm/cpuid.h | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h > index 1ea3c0e1e3a9..0bc5c1315708 100644 > --- a/arch/x86/kvm/cpuid.h > +++ b/arch/x86/kvm/cpuid.h > @@ -59,7 +59,6 @@ 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)); > BUILD_BUG_ON(x86_leaf >= ARRAY_SIZE(reverse_cpuid)); > BUILD_BUG_ON(reverse_cpuid[x86_leaf].function == 0); > > Reviewed-by: David Hildenbrand -- Thanks, David