mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [tip: x86/tdx] x86/virt/seamldr: Add module update locking
@ 2026-06-05 21:25 tip-bot2 for Dave Hansen
  0 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Dave Hansen @ 2026-06-05 21:25 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Dave Hansen, x86, linux-kernel

The following commit has been merged into the x86/tdx branch of tip:

Commit-ID:     6e97c234cdf0d11f51f75e918b3f612e57ecd027
Gitweb:        https://git.kernel.org/tip/6e97c234cdf0d11f51f75e918b3f612e57ecd027
Author:        Dave Hansen <dave.hansen@linux.intel.com>
AuthorDate:    Fri, 22 May 2026 08:43:02 -07:00
Committer:     Dave Hansen <dave.hansen@linux.intel.com>
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 <dave.hansen@linux.intel.com>
---
 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) == 256);
 
 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);
 
 #endif /* _ASM_X86_SEAMLDR_H */
diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.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");

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [tip: x86/tdx] x86/virt/seamldr: Add module update locking
@ 2026-05-26 15:43 tip-bot2 for Dave Hansen
  0 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Dave Hansen @ 2026-05-26 15:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Dave Hansen, x86, linux-kernel

The following commit has been merged into the x86/tdx branch of tip:

Commit-ID:     eb71a4c940613eee3af7337189534c2faa3ffb03
Gitweb:        https://git.kernel.org/tip/eb71a4c940613eee3af7337189534c2faa3ffb03
Author:        Dave Hansen <dave.hansen@linux.intel.com>
AuthorDate:    Fri, 22 May 2026 08:43:02 -07:00
Committer:     Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Tue, 26 May 2026 08:41:51 -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.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---
 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) == 256);
 
 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);
 
 #endif /* _ASM_X86_SEAMLDR_H */
diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.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");

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [tip: x86/tdx] x86/virt/seamldr: Add module update locking
@ 2026-05-26 15:32 tip-bot2 for Dave Hansen
  0 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Dave Hansen @ 2026-05-26 15:32 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Dave Hansen, x86, linux-kernel

The following commit has been merged into the x86/tdx branch of tip:

Commit-ID:     d34f37c3101c0364dba0d561e4911bc6496a2d0a
Gitweb:        https://git.kernel.org/tip/d34f37c3101c0364dba0d561e4911bc6496a2d0a
Author:        Dave Hansen <dave.hansen@linux.intel.com>
AuthorDate:    Fri, 22 May 2026 08:43:02 -07:00
Committer:     Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Tue, 26 May 2026 08:29:15 -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.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---
 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) == 256);
 
 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);
 
 #endif /* _ASM_X86_SEAMLDR_H */
diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.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");

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [tip: x86/tdx] x86/virt/seamldr: Add module update locking
@ 2026-05-22 17:26 tip-bot2 for Dave Hansen
  0 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Dave Hansen @ 2026-05-22 17:26 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Dave Hansen, x86, linux-kernel

The following commit has been merged into the x86/tdx branch of tip:

Commit-ID:     6693d4c89e884a1e277cac31a396afbfb3210327
Gitweb:        https://git.kernel.org/tip/6693d4c89e884a1e277cac31a396afbfb3210327
Author:        Dave Hansen <dave.hansen@linux.intel.com>
AuthorDate:    Fri, 22 May 2026 08:43:02 -07:00
Committer:     Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Fri, 22 May 2026 10:20:08 -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.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---
 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) == 256);
 
 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);
 
 #endif /* _ASM_X86_SEAMLDR_H */
diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.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");

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-05 21:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-05 21:25 [tip: x86/tdx] x86/virt/seamldr: Add module update locking tip-bot2 for Dave Hansen
  -- strict thread matches above, loose matches on Subject: below --
2026-05-26 15:43 tip-bot2 for Dave Hansen
2026-05-26 15:32 tip-bot2 for Dave Hansen
2026-05-22 17:26 tip-bot2 for Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®