Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2129859rdb; Mon, 20 Nov 2023 02:57:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEa3yjGlr9WvFEGb+NfnMfldBctRZOEkskcSJgkRRrzXaJ1KGwQYzA89hWsGXuWDvJSSpko X-Received: by 2002:aa7:9814:0:b0:68e:3eb6:d45 with SMTP id e20-20020aa79814000000b0068e3eb60d45mr4595739pfl.30.1700477827828; Mon, 20 Nov 2023 02:57:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700477827; cv=none; d=google.com; s=arc-20160816; b=ULsi5CRTnvA1Fjkw34Z46k9S0AxooCGxPRRmGIIxwh6/pWLN6Cjgg5DHOEMREGNnNB ZlPKCZEeF2jSLwCVjkZzVnZ/7liSLgdS93sgMl3eKKzckEkNWQ07Khk0qpITtC1y1pqO Mk1E0/f3yuWkkqEsdPG7llFDkNdMSboJIWEKPMF/BaBoXsr7Oc4mnY4lpbikVhGkMLJl a/zrsZgz+esQenol9VloY7DUzZIr24zfa2VANsP2PSHYr3DmwNH6QAwGvhzFb36jCJqO R5yyK2mkg1DflEtWNDR4twVtcLb3lInicr4qGhF2DqXNyLNIuiD/bMJMXP+GHSAHTzQj oC8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qtn+6JJtdQbGCK4bL8AZ/8s8qyj6h0vNojls/57mTy0=; fh=bEaXtmS8lzRItYrE/RfaVyKNdc9i8y6GHBEJVBz/DUE=; b=zXtq6P/4cwPBzi9XyI5DwszqhWgwJmDW2+tf00FIn4gFgcZ7p3/QIcZPG2nCpfbnc9 8Z/o3xOpmNDwc+2v2UY8oRbc9jH4fBC60DS0zGqfoNFifgbl65LL5QzcW1NxnKX6Z5Y1 dV3Jzj70IAkAm5Rli2q+Je95lYtQQHFnUYEEDvkbP8ar8frR3NCVEc4dkHbH3HG6JlJC f6u9b757WfLHjaD3DZSuNeMa9jsHJtdD7N8XCEsxj8NMwSItNCj0vuq5wcnH45TirNUm pFgbLIW3r68GXVXJVk0LNhDpUaV9m0EtbPCDHbK9UyJtQp6y6XFLEHZVH08BXcOt+xP0 dpkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EedCQgO9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id x28-20020aa78f1c000000b006b5c34a0c8csi7829727pfr.251.2023.11.20.02.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 02:57:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EedCQgO9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id EBC2D80465E3; Mon, 20 Nov 2023 02:57:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233100AbjKTK4u (ORCPT + 99 others); Mon, 20 Nov 2023 05:56:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233152AbjKTK43 (ORCPT ); Mon, 20 Nov 2023 05:56:29 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75B42D5E for ; Mon, 20 Nov 2023 02:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700477776; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qtn+6JJtdQbGCK4bL8AZ/8s8qyj6h0vNojls/57mTy0=; b=EedCQgO9sbv9zInDZaG1JMZO4B+aJ4uwLxYxmmy3xwJ7thzAsjQLcc2tOAR7k6As1/deiT H55UiLxJ2DW04uYvj+zlzlU6vqEo6ZmjaTf7akt+FQDa0BQWWB0H7yS+VvcBSUPComvWbB Mh01kE3rjKU8moj/D8hz5A4bTRsCHmw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-VLYCU4uwP9KHCgOT1Uc4aw-1; Mon, 20 Nov 2023 05:56:07 -0500 X-MC-Unique: VLYCU4uwP9KHCgOT1Uc4aw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7DBF5811E91; Mon, 20 Nov 2023 10:56:06 +0000 (UTC) Received: from vschneid-thinkpadt14sgen2i.remote.csb (unknown [10.39.195.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3A89A2026D4C; Mon, 20 Nov 2023 10:56:02 +0000 (UTC) From: Valentin Schneider To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-arch@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Borislav Petkov , Peter Zijlstra , Josh Poimboeuf , Pawan Gupta , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Arnd Bergmann , Jason Baron , Steven Rostedt , Ard Biesheuvel , Frederic Weisbecker , "Paul E. McKenney" , Feng Tang , Andrew Morton , "Mike Rapoport (IBM)" , Vlastimil Babka , David Hildenbrand , "ndesaulniers@google.com" , Michael Kelley , "Masami Hiramatsu (Google)" Subject: [PATCH 4/5] x86/speculation: Make mds_user_clear __ro_after_init Date: Mon, 20 Nov 2023 11:55:27 +0100 Message-ID: <20231120105528.760306-5-vschneid@redhat.com> In-Reply-To: <20231120105528.760306-1-vschneid@redhat.com> References: <20231120105528.760306-1-vschneid@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 20 Nov 2023 02:57:05 -0800 (PST) mds_user_clear is only ever enabled in: o __init mds_select_mitigation() o __init taa_select_mitigation() o __init mmio_select_mitigation() mark it as __ro_after_init. Signed-off-by: Valentin Schneider --- arch/x86/kernel/cpu/bugs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index bb0ab8466b919..bab36096015d8 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -112,7 +112,7 @@ DEFINE_STATIC_KEY_FALSE(switch_mm_cond_ibpb); DEFINE_STATIC_KEY_FALSE(switch_mm_always_ibpb); /* Control MDS CPU buffer clear before returning to user space */ -DEFINE_STATIC_KEY_FALSE(mds_user_clear); +DEFINE_STATIC_KEY_FALSE_RO(mds_user_clear); EXPORT_SYMBOL_GPL(mds_user_clear); /* Control MDS CPU buffer clear before idling (halt, mwait) */ DEFINE_STATIC_KEY_FALSE(mds_idle_clear); -- 2.41.0