From nobody Mon Jun 8 07:24:44 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 D62A13D646B; Fri, 5 Jun 2026 21:25:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780694714; cv=none; b=ZLdYN5+TBzyvNZPJTnO+j0HN/377TRFnCnhUP7lgGuO0LCKpzvuJ7me+uLIlf3sAAPLEmRVK4+ICD+twkTaTZYHTjzGllpteYCpk9kDdgCtgMUbdttjIVd2IXaGzToBj9lqVrkUpdUzGDrPnUFeLh1fNquzFwy29Sf5b1HYWp4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780694714; c=relaxed/simple; bh=Lu0m3xPWD1+V0wXYnjobmJu/vbqi8BCrkAQF10H5VYA=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=IK48thhELe5cS1ak5tlm8+jnV56edJBZiGbfgTdiW/8jh5mwzCD8WqdwqWR1HHlt7FuE0xdn/F6IBeWkGOBwyK6P06o8VvZ1QvNbEH6SklCcmKMClnG2t4PH9sNCsB/QVISIZGQG5QWfvCsbQgareNAf/9ag8VSmpm/gp44MwYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0yWhH817; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=IvXCzxqR; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0yWhH817"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IvXCzxqR" Date: Fri, 05 Jun 2026 21:25:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780694711; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vq3Da5tj2kOlMhJre0GNC7OITdDGY9IVSIJKQJoW67E=; b=0yWhH817HHJs1DwUD3dKfhlhxf2SxuKtpxBqCvX43mL8/7QoyPZK7n3C4dqsQ0GoqReDe3 WoEQxuL5f4Ea4BxASZxf2gfjRplVS+p7i+Jmpb+qQ1ly81sA3sK7v6ppshnnjwXa2ZK2rT jccYcDrYkFyTPaCgcJzoygz8MrROl55y9/+y3zlkMueTW55EYLZ/VFs9iUiFIIa9MWtl3k yN4gE0VKNz3+peB3vJAZSmAWwAArFl+JcVvxNt3ELi+4NXqhOIf6R6AlrWr5/C07kPcKDd 5LoL/7UOFCAVmfamFnqPXyGOtQgXa6Rz6KtnVUSioJUR2qpSjB/e0m4DkQEqNQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780694711; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vq3Da5tj2kOlMhJre0GNC7OITdDGY9IVSIJKQJoW67E=; b=IvXCzxqR0Tfov7jsSQ0f/mQesCB5t3GF6zuUQgwcYGekTaCz8sMvxDI3qnpY6jhrdENYiE /1sxfZ2dF0ds4/Aw== From: "tip-bot2 for Dave Hansen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/tdx] x86/virt/seamldr: Add module update locking Cc: Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178069470988.710.13221847698599751441.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/tdx branch of tip: Commit-ID: 6e97c234cdf0d11f51f75e918b3f612e57ecd027 Gitweb: https://git.kernel.org/tip/6e97c234cdf0d11f51f75e918b3f612e5= 7ecd027 Author: Dave Hansen AuthorDate: Fri, 22 May 2026 08:43:02 -07:00 Committer: Dave Hansen CommitterDate: Wed, 03 Jun 2026 08:59:43 -07:00 x86/virt/seamldr: Add module update locking TDX metadata like the version number changes during a module update. Add functions to lock out module updates. The current stop_machine() implementation uses worker threads. The scheduler actually does a full, normal context switch over to that thread. preempt_disable() obviously inhibits that context switch and thus, locks out stop_machine() users like the module update. Thanks to Chao for the idea of using preempt_disable(). Signed-off-by: Dave Hansen --- arch/x86/include/asm/seamldr.h | 2 ++ arch/x86/virt/vmx/tdx/seamldr.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/arch/x86/include/asm/seamldr.h b/arch/x86/include/asm/seamldr.h index 43084e2..cfc6a1b 100644 --- a/arch/x86/include/asm/seamldr.h +++ b/arch/x86/include/asm/seamldr.h @@ -32,5 +32,7 @@ static_assert(sizeof(struct seamldr_info) =3D=3D 256); =20 int seamldr_get_info(struct seamldr_info *seamldr_info); int seamldr_install_module(const u8 *data, u32 data_len); +void seamldr_lock_module_update(void); +void seamldr_unlock_module_update(void); =20 #endif /* _ASM_X86_SEAMLDR_H */ diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamld= r.c index f5591d7..b1137ca 100644 --- a/arch/x86/virt/vmx/tdx/seamldr.c +++ b/arch/x86/virt/vmx/tdx/seamldr.c @@ -350,3 +350,19 @@ out: return ret; } EXPORT_SYMBOL_FOR_MODULES(seamldr_install_module, "tdx-host"); + +/* + * stop_machine() does not interrupt preemption-disabled regions. + * Simply disabling preempt prevents updates. + */ +void seamldr_lock_module_update(void) +{ + preempt_disable(); +} +EXPORT_SYMBOL_FOR_MODULES(seamldr_lock_module_update, "tdx-host"); + +void seamldr_unlock_module_update(void) +{ + preempt_enable(); +} +EXPORT_SYMBOL_FOR_MODULES(seamldr_unlock_module_update, "tdx-host");