From patchwork Tue Feb 6 17:39:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Schneider X-Patchwork-Id: 197574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1706186dyb; Tue, 6 Feb 2024 09:43:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGn9mNUE1FK5C8DgidtObVIZJ7x91OYPuZLotdbHInAp9CwSLhcFGqFme+R8WuEQSJ8Mj/3 X-Received: by 2002:a17:907:96a5:b0:a36:2df:5ded with SMTP id hd37-20020a17090796a500b00a3602df5dedmr2669325ejc.72.1707241401429; Tue, 06 Feb 2024 09:43:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707241401; cv=pass; d=google.com; s=arc-20160816; b=Gw6UZiMbLfsYnsWKsPCqYmSF8fZ3QX26SVg07kI0xADmMvnEnGji3eriebC7gjG7vp U7UyaCaf5tbzZv/P+YXVQE/V46II2URhG4Iq8r9CG1dcAvdrp6gN1dxSzUnpq+/zQZtn 0FkFXDhA4RH5G0Piw/WPPaIyNZV9gs+PQQlDIm9YEmnXjCg/tAy2rblL2Djy5bDrYJ0Y LY/WEGeoIf7RKy/vdUb1B1CFA49CF5M2uvYf9wOuwQZKq+y25hXUvZF2qqVoN0l1Xist 8XUyl0yt1Z161MOI0RlCRhyzO5krx7dVuFCBzr4j54dSzbjip9ElJISfkah1r38Bzc83 lzaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=e9TbiIW7v7P2/Ue8wq2AyQZ0xtrZV7cRznu5SFXHEEQ=; fh=wPpqlsHVLieyl5/8RKyk+a14ZkybqPiCLRP1bAm83vY=; b=zz5x2G5fXN68iPE68yws/dF/cGACOr7pNBlbvndKjRGO09dyZP7rT6MfrR5wTqKO6e afFyDR/gx/cNMvzFU0emkvPtQeoMFO0/si5fQFmIa4KgY4Jvu/sCttqt8LrS+RaDoU1G b+8StyZSiw71q1BfCg0uF1tq4XSX4/CLCjGZ97Pt5fngYgIPpPPG6xO1LBX2w1ifg4Y2 advc/eobMr/8SUg2XaLnZjDt02vFSLGRewk6ztSiEcJ43yMuDGJF7fclGGLGS5kbQQbt ayB+kYoIkmW4odPbYLu2IRcdB6EpQExW4xhgH46FCsQMJsNPOssdZreOqvQrqvPGQW46 FToQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V99u+Uce; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-55415-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55415-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCXj2it/PEFKlfl09s3cZep99TlGJEWf30KF53zRj0V9V2I38KekWxhTdtY7N1+TVt81Zp7jCyCwwPYYuUbtBvi8ussrtg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gs23-20020a170906f19700b00a385d11fcc5si11612ejb.199.2024.02.06.09.43.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 09:43:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55415-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V99u+Uce; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-55415-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55415-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E28191F27952 for ; Tue, 6 Feb 2024 17:43:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 167C81BF2B; Tue, 6 Feb 2024 17:40:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V99u+Uce" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF31914003 for ; Tue, 6 Feb 2024 17:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707241213; cv=none; b=qftxBwEKTQzPiTkvAQ3GB256b/00M9jRP04FOBh7zhOePjt5uJYiGkHGr75hy6ExIYV7Tlm9yNGP0WgReUUcLVUhFCw9s4Kppge7f10HJwWm3P5sQBrtbw55Lh+p2Q+Sd8NrYeK4n1HqhZ056Od7oVhbCY0FZlx4nDPCQAcIc/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707241213; c=relaxed/simple; bh=S1tCYMcNXkihabDiqpDnmfHcIQO8CZnjsn5bQsn7UME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eQSzH9F2YykDf9weK8PLn3vFQmtDFhYZkMWoTZi6SI+qDHRaLvBuIfz23/8bL1OSwTuCeD+T1K0zBRuCCjW6ByNl5jaF4mxtKeMgl1JWelbtZQZO+vNC2vWjdl4p/oIfI8vxIiQyxFSpdR+IE8RLQDC6V+AzVzuNIq7A+56S0JA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=V99u+Uce; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707241210; 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=e9TbiIW7v7P2/Ue8wq2AyQZ0xtrZV7cRznu5SFXHEEQ=; b=V99u+UceR2Jpq/vJH/CA10p2Ua53l1j3dJTD3AYNgn53PORQ4SfDQU/tBMhhGaACZpcYk8 8qQESLy8CdKhpZZGvcG3jLexeyteBVyfjvCL/0NkBWidXcOwEbfkCuTqXcoaAsE7/fTVDG 1KCEGZtjKf6Uu+8Q/R6LUcaIbEGZrj8= 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-488-3Nw8cN53NgCVyR-ABxYhyA-1; Tue, 06 Feb 2024 12:40:06 -0500 X-MC-Unique: 3Nw8cN53NgCVyR-ABxYhyA-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 CC028101FA2E; Tue, 6 Feb 2024 17:40:04 +0000 (UTC) Received: from vschneid-thinkpadt14sgen2i.remote.csb (unknown [10.39.193.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D20342026D06; Tue, 6 Feb 2024 17:40:00 +0000 (UTC) From: Valentin Schneider To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-arch@vger.kernel.org, x86@kernel.org Cc: Josh Poimboeuf , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , 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 v2 4/5] x86/speculation: Make mds_user_clear __ro_after_init Date: Tue, 6 Feb 2024 18:39:10 +0100 Message-ID: <20240206173911.4131670-5-vschneid@redhat.com> In-Reply-To: <20240206173911.4131670-1-vschneid@redhat.com> References: <20240206173911.4131670-1-vschneid@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790172359714974787 X-GMAIL-MSGID: 1790172359714974787 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 Acked-by: Josh Poimboeuf --- 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);