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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 934C2C636D3 for ; Wed, 8 Feb 2023 20:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uk2p8PJChRgNkGYh73Hh5aJtUwDDQ8ZjPx35sSeP3oQ=; b=xe8fgK7JnrLXJM WNFdzk6NztEQrRgMSUBu7UjtTCf40WH//sLtU+fZsA7O6wcyhAu8rZUa+DLmLSH3SOKPrtgKDmtQx Z7rto6le4Fj7RVEEEPYrsZgAimsto1Jt131lx7B68jENg8EeTkffwlSNjVM8s/gsZDKub0f+Kpigf KeQAQR1arluNFOpcZU7ln7DOyBBHeAV/eMWiqao+pJSdt0j6dRWuAjQLhxVIxUrq+7GGSbP9dR+XO txCqay+hbQqxEKd8zt+7/KLIElXsQxycvt60bloB15GIIXf4rKY+wyL3r7Qb697bZce6I40TQP+8d fzrSjO/Obb/jDGTLYrzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPrTd-00Gw2R-Cv; Wed, 08 Feb 2023 20:55:37 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPrTZ-00Gw0x-73 for linux-arm-kernel@lists.infradead.org; Wed, 08 Feb 2023 20:55:35 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AEBD71477; Wed, 8 Feb 2023 12:56:09 -0800 (PST) Received: from FVFF77S0Q05N.cambridge.arm.com (unknown [10.57.90.29]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 39C5E3F8C6; Wed, 8 Feb 2023 12:55:25 -0800 (PST) Date: Wed, 8 Feb 2023 20:55:19 +0000 From: Mark Rutland To: Peter Zijlstra Cc: Dave Hansen , Ard Biesheuvel , linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Kees Cook , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen Subject: Re: [PATCH v2 3/3] efi: x86: Wire up IBT annotation in memory attributes table Message-ID: References: <20230206124938.272988-1-ardb@kernel.org> <20230206124938.272988-4-ardb@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230208_125533_326383_320060F6 X-CRM114-Status: GOOD ( 17.83 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 08, 2023 at 09:14:53PM +0100, Peter Zijlstra wrote: > On Wed, Feb 08, 2023 at 07:17:15AM -0800, Dave Hansen wrote: > > On 2/6/23 04:49, Ard Biesheuvel wrote: > > > --- a/arch/x86/kernel/apm_32.c > > > +++ b/arch/x86/kernel/apm_32.c > > > @@ -609,7 +609,7 @@ static long __apm_bios_call(void *_call) > > > > > > apm_irq_save(flags); > > > firmware_restrict_branch_speculation_start(); > > > - ibt = ibt_save(); > > > + ibt = ibt_save(true); > > > > My only nit with these is the bare use of 'true'/'false'. It's > > impossible to tell at the call-site what the 'true' means. So, if you > > happen to respin these and see a nice way to remedy this I'd appreciate it. > > I've often wished for a named argument extention to C, much like named > initializers, such that one can write: > > ibt_save(.disable = true); > > Because the thing you mention is very common with boolean arguments, the > what gets lost in the argument name and true/false just isn't very > telling. > > But yeah, even if by some miracle all compiler guys were like, YES! and > implemented it tomorrow, we couldn't use it for a good few years anyway > :-/ Well... ;) | [mark@lakrids:~]% cat args.c | #include | #include | | struct foo_args { | bool enable; | unsigned long other; | }; | | void __foo(struct foo_args args) | { | printf("foo:\n" | " enable: %s\n" | " other: 0x%lx\n", | args.enable ? "YES" : "NO", | args.other); | } | | #define foo(args...) \ | __foo((struct foo_args) { args }) | | | int main(int argc, char *argv[]) | { | foo(true); | foo(.enable = true); | foo(false, .other=0xdead); | } | [mark@lakrids:~]% gcc args.c -o args | [mark@lakrids:~]% ./args | foo: | enable: YES | other: 0x0 | foo: | enable: YES | other: 0x0 | foo: | enable: NO | other: 0xdead Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel