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: 13547679 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 D34F31B94C for ; Tue, 6 Feb 2024 17:40:10 +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=1707241212; cv=none; b=L3DVgvsP8CFeUfE4gkUAPguwvF1dLhF9tNmtIpiKVdeuZR95r8hxoEZUExO2TtmqgofYCyyGn/dFs1CkuCWo/RaF4vDNPpHBz4a0qVUSo67blOxg0jCP4GU1Gi8uP3sTZVvvRU0X4pQ9WEBDKbcNun1ZfmCAdMd0Y53VEwSY3A8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707241212; c=relaxed/simple; bh=S1tCYMcNXkihabDiqpDnmfHcIQO8CZnjsn5bQsn7UME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DO2IGjiOczT3NyEr1yWgItAnnNgy5JqCOE8p7l28iWiUZrNC6KsZN3Z3Ds22DRQi6V+H7pCiIEtSy0HcJUBrbATEuDDe1mO+ADT1Al13965+QDrz4k5kyAUkJ+2N6Xi3tuCmgqRSsUkEk+xhOP5lPOpFtMNKNRlReouc9uk/SYQ= 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=AbLgSjUJ; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AbLgSjUJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707241209; 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=AbLgSjUJRvcDwj1oqJH049uXse8mqrpUmi9/7SjoopQD0oqDTxOi+G/EN1sS+pSORq9Aoy 3spLtY3OARvU+MS7+mj5qYVptZ+5+CbNVCmuJMeDGCpafUSpKbp5ybXkapMSVGrX8NCLbL Qb/lghYw8u18K85FBGgj1BjyWGJETjE= 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: kvm@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 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);