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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F80ECDB474 for ; Thu, 12 Oct 2023 20:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442730AbjJLUnx (ORCPT ); Thu, 12 Oct 2023 16:43:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343782AbjJLUnv (ORCPT ); Thu, 12 Oct 2023 16:43:51 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F40DC0 for ; Thu, 12 Oct 2023 13:43:50 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7388FC433C8; Thu, 12 Oct 2023 20:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697143429; bh=1qxJg5+j9FJGAfywTfM++up5rCZnKv8AEAHUzemY4yg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rnhjuxLAXn08gU7SSWiaXeSQ/z40RDPINScZOQUn+20Z9DUUmXFf/THtAab3m3nmf r37qxmYeB8UeoMrO4ljLr/FHX/xrjZJhNZ8hT84NxmkZ0WYbF2xDS5pYLowofABtSF NTcxbMXDsuyLND8FICU3XacuSAFv+r8gFj9yOkIM6Ndt5neWKvwdw/waAm09SBssWu 54T6n4a3noGyYlAW1S2OZ6ZP/fTN2NUkiYgVh/H+SxGG5E/tlFOqhS1It0qkOZLGou OR59fXT0SypmpJzz3lwfXT3fox3vvR+MjBZNAEstoeGxwPx1BXlYMEyCRN9X6Y9A2/ QD06Tsc1gDbcg== Date: Thu, 12 Oct 2023 13:43:47 -0700 From: Josh Poimboeuf To: Ingo Molnar Cc: Breno Leitao , tglx@linutronix.de, bp@alien8.de, Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Pawan Gupta , leit@meta.com, "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Subject: Re: [PATCH v4] x86/bugs: Add a separate config for each mitigation Message-ID: <20231012204347.4aei5jr64fsv2iv5@treble> References: <20231010103028.4192223-1-leitao@debian.org> <20231012170548.o5vi4kgpvpjyld7s@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 12, 2023 at 08:51:24PM +0200, Ingo Molnar wrote: > > Another way to avoid ifdeffery: > > > > static enum retbleed_mitigation_cmd retbleed_cmd __ro_after_init = > > IS_ENABLED(CONFIG_MITIGATION_RETBLEED) ? RETBLEED_CMD_AUTO : RETBLEED_CMD_OFF; > > I think we could make it a simple: > > static enum retbleed_mitigation_cmd retbleed_cmd __ro_after_init = IS_ENABLED(CONFIG_MITIGATION_RETBLEED); > > Because RETBLEED_CMD_AUTO && RETBLEED_CMD_OFF maps naturally to 1 and 0. > Maybe add a comment to the enum to maintain this property in the future > too. Hm, that both obfuscates the default and makes it fragile. The fact that it would need a comment to try to prevent breaking it in the future is a clue that maybe we shouldn't do it ;-) -- Josh