Re: [PATCH v5 10/22] x86/virt/seamldr: Abort updates if errors occurred midway
From: Kiryl Shutsemau
Date: Thu Mar 19 2026 - 09:21:27 EST
On Sun, Mar 15, 2026 at 06:58:30AM -0700, Chao Gao wrote:
> diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.c
> index 978fcca92128..e195703398e7 100644
> --- a/arch/x86/virt/vmx/tdx/seamldr.c
> +++ b/arch/x86/virt/vmx/tdx/seamldr.c
> @@ -190,6 +190,7 @@ enum module_update_state {
> static struct {
> enum module_update_state state;
> int thread_ack;
> + int failed;
bool is enough, right?
> /*
> * Protect update_data. Raw spinlock as it will be acquired from
> * interrupt-disabled contexts.
> @@ -237,12 +238,17 @@ static int do_seamldr_install_module(void *seamldr_params)
> break;
> }
>
> - ack_state();
> + if (ret) {
> + scoped_guard(raw_spinlock, &update_data.lock)
> + update_data.failed++;
I don't see a reason in spin lock here. Just WRITE_ONCE() would work
fine.
--
Kiryl Shutsemau / Kirill A. Shutemov