From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 319A4C43461 for ; Thu, 20 May 2021 12:10:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 084806105A for ; Thu, 20 May 2021 12:10:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232666AbhETML4 (ORCPT ); Thu, 20 May 2021 08:11:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49061 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242409AbhETMLP (ORCPT ); Thu, 20 May 2021 08:11:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621512593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2dAV78HOpA0s1qDhNtkCx6CZU7A5bPuHPyNp12FridI=; b=Wv2jH4lsdg6zCYbLRh0F803tOMmb1YX2ZkvQRnScZCMxdC8wb5Xn4vybQT5u2KZgptniD0 PVEbthPLsZkcc1nB4MaKHhDKazTQxB+G3YM1kYIlJEC+qKpkMos7ujQeTONMrU6u/SRLPJ ChPlCuthQyQ9gldYLsvfr4F5xwD1W28= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-205-S00pPrkrM_WPP2LFlS_hrA-1; Thu, 20 May 2021 08:09:51 -0400 X-MC-Unique: S00pPrkrM_WPP2LFlS_hrA-1 Received: by mail-wm1-f72.google.com with SMTP id f141-20020a1c1f930000b029017ce5240ed6so241880wmf.5 for ; Thu, 20 May 2021 05:09:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2dAV78HOpA0s1qDhNtkCx6CZU7A5bPuHPyNp12FridI=; b=bWOscHsHv0Ft8eLc73SAG91ly9rHxTWW1i1GfOGvewlKDQncADzc8TgomLDdp9D8lZ OrrwVyWNaBqINuuu+CBchT5HBe2mwQpS+GZZ49LqRJ+5fiTYRc01SiIQGLsarFGg6/Ir 6l104TvTEcxIAz+jOEs4CGvhJ5sDm4ctdGzynSqDOi3DHckZ8+hcQcVlYXrr1KgDMpeI 7mG4U1L56WeYAyQxMwU7KcCYhZfn5BOMwKgKOu1+4mggrrXd9cohzHvWZPJm8mS80+Zz 4DNXQo9ZwpFiIRU0aISbhtwRBS2UKo3OWd4/GLPPs7C3zVgm7ypq26MUlCqoA7UQMfd+ 3aoA== X-Gm-Message-State: AOAM533T3aMpd1O1mY1gOO9W+xb9C3783j5zKLALdMLj3frqAxznD3s9 mJ0ld7bU1UinVLWNc4P4HAiyxdfIUr+lZTwwWv2JgY3Kphav5IDfWYoQoXz9T6OaBiQM6cMGxzy NREy+LG4AgLbwYP8nB7kd1wqf X-Received: by 2002:a05:6000:2ca:: with SMTP id o10mr4036126wry.234.1621512590004; Thu, 20 May 2021 05:09:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6d5uWDaH9xRwXmWQ6G/SkWg2HrDiHqSGmItKZYKWhxlzobkIg+2IdRlmIWTQ/Bbzt4aE8Mw== X-Received: by 2002:a05:6000:2ca:: with SMTP id o10mr4036090wry.234.1621512589783; Thu, 20 May 2021 05:09:49 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id u11sm1215500wrw.14.2021.05.20.05.09.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 May 2021 05:09:48 -0700 (PDT) Subject: Re: [PATCH 0/6] Don't use BIT() macro in UAPI headers To: Joe Richey , trivial@kernel.org Cc: Joe Richey , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , 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 References: <20210520104343.317119-1-joerichey94@gmail.com> From: Paolo Bonzini Message-ID: Date: Thu, 20 May 2021 14:09:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210520104343.317119-1-joerichey94@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/05/21 12:43, 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 > 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. > > Joe Richey (6): > x86/elf: Don't use BIT() macro in UAPI headers > KVM: X86: Don't use BIT() macro in UAPI headers > drivers: firmware: psci: Don't use BIT() macro in UAPI headers > uacce: Don't use BIT() macro in UAPI headers > media: vicodec: Don't use BIT() macro in UAPI headers > tools headers UAPI: Sync pkt_sched.h with the kernel sources > > arch/x86/include/uapi/asm/hwcap2.h | 2 +- > include/uapi/linux/kvm.h | 4 +- > include/uapi/linux/psci.h | 2 +- > include/uapi/linux/v4l2-controls.h | 22 ++--- > include/uapi/misc/uacce/uacce.h | 2 +- > tools/include/uapi/linux/kvm.h | 4 +- > tools/include/uapi/linux/pkt_sched.h | 122 ++++++++++++++++++++++++--- > 7 files changed, 130 insertions(+), 28 deletions(-) > Will queue the KVM one, thanks! Paolo From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BE02C433ED for ; Thu, 20 May 2021 12:11:36 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB9BF6108D for ; Thu, 20 May 2021 12:11:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB9BF6108D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DJf8eDZp3tUpV0lDpZvSZOQGsEa5xxudanvBviNvmLY=; b=q/icy4GBOphS3uAWImFrbNesVP Aff1bWDTbIyzFJZiCZOLTEATEdRt+JIj+oJpfd4wEqWDhIzXAIqSJYUZhLkKkXwGDyd27uKetsO4A SYgUucZybo/cACRiljsRGRtM+rvgx0KwZ/QeYeeneHT7KQLJILYxCL3lQn2EoM2w685JYsQm5Gw2e BZdoyHB6VQG0OtQf4Nfpe0HWsY3Vy7/NpzJdfcgja8CHSGg17T5V1alJfuIAuoAsAmhBXzo/qELTe hVemFyVZl7f5u7eP++KzT6ii0QGoHLOTnXvf5aNZVNT4LGxRrkpmPVQzALNaEvnZzvV8JudrUm5vU qfZlq2/A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljhV3-000jov-N4; Thu, 20 May 2021 12:10:02 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljhV1-000jo5-76 for linux-arm-kernel@desiato.infradead.org; Thu, 20 May 2021 12:09:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=2dAV78HOpA0s1qDhNtkCx6CZU7A5bPuHPyNp12FridI=; b=sAY6dt3g/wrgGmNDw+4vMoPYge dBX/bx1ygUUjLYIerBF9xNg5apvkegabCJc/G/QvD19GBIDju8qukyp5LnK1XK8b9FD9Uq6jVxe9K vXJ5Wbw6F7Dt+gM51qTCppver3uXTX8Sla0AUpJCr5GMKFABFvLtDcNsv/FATUZi4ow/2OP4kfcnC KZp/930Y72t1rkN0V1PW8WV6T1dsJI6ifguJ1taWbmO8zueHduG77dCydef22Tw/hpiPSQNBliJCE DweYPpARH4xc8cE83MUCDQ+CXlDNiJqQCl6g/XQKj1VO29QDm3zwepCA5R7BNBTLngzl2sSd/eARL 3DcQ2Zzg==; Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljhUy-00GIkn-CY for linux-arm-kernel@lists.infradead.org; Thu, 20 May 2021 12:09:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621512593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2dAV78HOpA0s1qDhNtkCx6CZU7A5bPuHPyNp12FridI=; b=Wv2jH4lsdg6zCYbLRh0F803tOMmb1YX2ZkvQRnScZCMxdC8wb5Xn4vybQT5u2KZgptniD0 PVEbthPLsZkcc1nB4MaKHhDKazTQxB+G3YM1kYIlJEC+qKpkMos7ujQeTONMrU6u/SRLPJ ChPlCuthQyQ9gldYLsvfr4F5xwD1W28= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-244-hjeU2FCeNHelT-kpDYpMDw-1; Thu, 20 May 2021 08:09:51 -0400 X-MC-Unique: hjeU2FCeNHelT-kpDYpMDw-1 Received: by mail-wr1-f70.google.com with SMTP id s7-20020adfc5470000b0290106eef17cbdso8526814wrf.11 for ; Thu, 20 May 2021 05:09:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2dAV78HOpA0s1qDhNtkCx6CZU7A5bPuHPyNp12FridI=; b=VF6W520GnzX4Y7eYaEqWZaQ8xGTl2R6g8Mw1NwHy102JNoc/t8RzJTp0j66W1ayDVC S2ubQfVpGCsztJuP5qXFjUnA7KFt3RxmzRVB0dCoFrp0pstQGCnzEtavhtLl16jaFMWW AJPA4gWasl92xn22Spy6in2LcxEfcV6YFST7Y4wCLfekKHMCHGPVKwF571uPy9B4M02Z l2a8nIxNRWnr+lXWaWZsKI5PoYKw/7ac2sYNp5/ZTJ4FMwfsBxxBPIiZglgh+7v3MYUe Sa+Aw/FOJellN192uoYycuUBs46rcgKsj+lCIAhlH+F94gTP8AZzxzfXL5rYoSmw27EI i2rg== X-Gm-Message-State: AOAM533ahm1jTnpz0+TXo6mO/uQWWAotpTDuEmOU3wADVA4A7P0nsDVn KbfyaOeAW+QJuhF6bLOq0h/jHulaCU4/hOfybZkW3HnT5YfV2Q3nEw97/dL58HGPe8lsK/97XFG kgbWW8Kg/A8lRTw2BGBWGDuoLRSmPBRxiPXk= X-Received: by 2002:a05:6000:2ca:: with SMTP id o10mr4036123wry.234.1621512590004; Thu, 20 May 2021 05:09:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6d5uWDaH9xRwXmWQ6G/SkWg2HrDiHqSGmItKZYKWhxlzobkIg+2IdRlmIWTQ/Bbzt4aE8Mw== X-Received: by 2002:a05:6000:2ca:: with SMTP id o10mr4036090wry.234.1621512589783; Thu, 20 May 2021 05:09:49 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id u11sm1215500wrw.14.2021.05.20.05.09.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 May 2021 05:09:48 -0700 (PDT) Subject: Re: [PATCH 0/6] Don't use BIT() macro in UAPI headers To: Joe Richey , trivial@kernel.org Cc: Joe Richey , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , 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 References: <20210520104343.317119-1-joerichey94@gmail.com> From: Paolo Bonzini Message-ID: Date: Thu, 20 May 2021 14:09:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210520104343.317119-1-joerichey94@gmail.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210520_050956_648024_2DF10F3B X-CRM114-Status: GOOD ( 23.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 20/05/21 12:43, 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 > 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. > > Joe Richey (6): > x86/elf: Don't use BIT() macro in UAPI headers > KVM: X86: Don't use BIT() macro in UAPI headers > drivers: firmware: psci: Don't use BIT() macro in UAPI headers > uacce: Don't use BIT() macro in UAPI headers > media: vicodec: Don't use BIT() macro in UAPI headers > tools headers UAPI: Sync pkt_sched.h with the kernel sources > > arch/x86/include/uapi/asm/hwcap2.h | 2 +- > include/uapi/linux/kvm.h | 4 +- > include/uapi/linux/psci.h | 2 +- > include/uapi/linux/v4l2-controls.h | 22 ++--- > include/uapi/misc/uacce/uacce.h | 2 +- > tools/include/uapi/linux/kvm.h | 4 +- > tools/include/uapi/linux/pkt_sched.h | 122 ++++++++++++++++++++++++--- > 7 files changed, 130 insertions(+), 28 deletions(-) > Will queue the KVM one, thanks! Paolo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel