Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp816702pxj; Thu, 20 May 2021 23:10:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWGXh5pjhYko5wUImpiCaQ/x40JqRpDCKtJvi1ZqUfHvrmPIG2xkHdsrzY02S2g2KvkR5R X-Received: by 2002:a17:907:96a4:: with SMTP id hd36mr7154527ejc.519.1621577447360; Thu, 20 May 2021 23:10:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621577447; cv=none; d=google.com; s=arc-20160816; b=Qcq52j0s45yrYSSJOpxU9pE/hYaZYKu6bG5U0UpsGaueD6ASlBCvmUNRp0xVVItGbn qeU8dxVZdWqwTHEgUpYE3M71Tc/q6DDDFD6H5rkuX3QfA1EcJ9p9CmBi2OxBpFyb6avA eHzu30RS3u0qBZcxCXVK91aeA0C766mHR2f/lYOTv1d/yjm8t+rbjfJgV5EwbC34HlLD quxyJEZa9rqbHE0q0e+cDg1FRuRGGX03m0eIIHA2sQRn6RwiiC92vVjIoHg0E851TXf3 UGbr4jtpoUCZgH4prFJaHovC4d64+V86lzeEIWHJa/QlQ6sZjsjbV5+x7bKvRMxaqk1Z Mr0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TbJQOEEFF/+nf1KiXSLwJcY/vwU+LRKGaCo1IHQgEHk=; b=UPIX943FqYsBbgn6Sz7vMbrO39T23cOMALFd+UQlNH0tqDb3vBAU2c2fD1ne1zUr4F Tq9JIPcWNoHLXhBDz7GKJcl82yI0P2Ftg0HWPUcIWQ8fUHxX5wDc0zwV3HvYAaEYUx86 RpDIWjHwV0L1BF4nMh+Dw53Sv/QWLl/fPYEQ2WoyYhGujsyHkE7A//YyPu/+n6anQMba oSCOXpqdxMVUzvNsAyA9HL2mbNKZ/8kz8Q8P6cD6r58vWFjU72JhUA6SeCYw5q46qIev o2ODbladFkN/iRMV2ORMolZPVRL0l6N+EbltEKn07e+cCfScFnPn4FfN6yQhJSWef2r5 zO6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nc9d59ur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n16si4377715edw.216.2021.05.20.23.10.24; Thu, 20 May 2021 23:10:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nc9d59ur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240519AbhETPtM (ORCPT + 99 others); Thu, 20 May 2021 11:49:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231663AbhETPtL (ORCPT ); Thu, 20 May 2021 11:49:11 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 901F6C061574 for ; Thu, 20 May 2021 08:47:50 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id b15-20020a17090a550fb029015dad75163dso5519902pji.0 for ; Thu, 20 May 2021 08:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TbJQOEEFF/+nf1KiXSLwJcY/vwU+LRKGaCo1IHQgEHk=; b=nc9d59urRD2gADVZIakW9AaJC1C5aS/uZY9a449dXEeqz33LeD3zgBoFymK/FFzx9W 8UMLGr5qQ1Opl1RnjvIZ6C9oBra3dAeV44x+HMZgRPUb+HQxs2/27kS9SCrLMM42SsDE FnSSqxYyqy07U4oIZlH9vBaexa9vFQtM+SZTp7/kQtYKYom/1FojUrbkRlk0cziddX39 IGt7QouHuVRYLfDXlip7ZuNP1HLcDP81qreveh8VZWPPjps1Jj5vRA50bDfk6i4vB5i2 zn6rIuJFLxJvM/AgFYkEAL2phrdzLXl7hqu0s45hITCo4o2Y7zUpaoplgH8O2oPD0QtS ltMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TbJQOEEFF/+nf1KiXSLwJcY/vwU+LRKGaCo1IHQgEHk=; b=JQQ4sTp5x9e/J0/HkSsHHSfWDfuCRaNZAhaYldsNO28Hz4VciHql9JJQjwYJ18iPfA +CX7W8YVXxJ16U2XnHiByEUlC7deKzVGSw2cQKqNQcmLz71X5qUAi83Ptv/lR6s78TGx /zD+IQCzrz22v0FiTidhoC8QGcrlcLCz2YZd/TczfX5xUjEx2YOnn2bKmG968wiNxRPC uP9Fg6XgAn9H5LCdbOztRZH9c+/OvuI+0gqhmmWLZBlTFSN7tUrYP5RNpoo9SNZURQIM Ooa1vuwWg3nC9KlFIqaHylRfGU8C/bNgyrGxM5C5mUNuZMMXNMRGNyt7Jh4TFk/95A0W wm5A== X-Gm-Message-State: AOAM533T7bNaDKlWrRH94WICT65qNCr8/7VjckQ+Lpse45tOOEtc4rnM vEju7dG4ukovkgmhJ+kzxCXehw== X-Received: by 2002:a17:90b:1902:: with SMTP id mp2mr5550488pjb.176.1621525669947; Thu, 20 May 2021 08:47:49 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id c191sm2278922pfc.94.2021.05.20.08.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 08:47:49 -0700 (PDT) Date: Thu, 20 May 2021 15:47:46 +0000 From: Sean Christopherson To: Joe Richey Cc: trivial@kernel.org, Joe Richey , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Paolo Bonzini , Mark Rutland , Lorenzo Pieralisi , Mauro Carvalho Chehab , Zhangfei Gao , Zhou Wang , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-accelerators@lists.ozlabs.org Subject: Re: [PATCH 0/6] Don't use BIT() macro in UAPI headers Message-ID: References: <20210520104343.317119-1-joerichey94@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210520104343.317119-1-joerichey94@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 20, 2021, Joe Richey wrote: > From: Joe Richey > > The BIT(n) macro is used in the kernel as an alias for (1 << n). > However, it is not defined in the UAPI headers, which means that any > UAPI header files must be careful not to use it, or else the user > will get a linker error. For example, compiling the following program: > > #include > #include > > // Detect if FSGSBASE instructions are enabled > int main() { > unsigned long val = getauxval(AT_HWCAP2); > return !(val & HWCAP2_FSGSBASE); > } > > Results in the following likner error: > > /usr/bin/ld: /tmp/cceFpAdR.o: in function `main': > gs.c:(.text+0x21): undefined reference to `BIT' > > This patch series changes all UAPI uses of BIT() to just be open-coded. > However, there really should be a check for this in checkpatch.pl Any reason not to provide such a patch in this series? :-) > Currently, the script actually _encourages_ users to use the BIT macro > even if adding things to UAPI. > > Running `rg "BIT\(" **/uapi/**` shows no more usage of BIT() in any > UAPI headers. Tested by building a basic kernel. Changes are trivial.