From: Dave Hansen <dave.hansen@intel.com>
To: "Sun, Ning" <ning.sun@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>
Cc: Frederic Weisbecker <frederic@kernel.org>,
"x86@kernel.org" <x86@kernel.org>,
"tboot-devel@lists.sourceforge.net"
<tboot-devel@lists.sourceforge.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/boot/tboot: Fix off-by-one AP WFS wait count and timeout check
Date: Fri, 4 Dec 2026 07:30:06 -0800 [thread overview]
Message-ID: <b7a73c94-07cc-47a8-9666-7bd028effde6@intel.com> (raw)
In-Reply-To: <PH8PR11MB6878E3E31D150EF91A22B361874A2@PH8PR11MB6878.namprd11.prod.outlook.com>
On 12/3/26 21:39, Sun, Ning wrote:
> In tboot_dying_cpu(), ap_wfs_count is incremented before checking
> whether this is the last secondary CPU going offline and calling
> tboot_wait_for_aps(). However, the currently dying CPU is still
> executing the hotplug teardown path and has not yet halted into
> Wait-For-SIPI (WFS) mode.
>
> Consequently, tboot->num_in_wfs can only equal (ap_wfs_count - 1)
> at this point, causing tboot_wait_for_aps() to unconditionally busy-wait
> for the full AP_WAIT_TIMEOUT duration (1 second) and fail when
> offlining the final secondary CPU.
>
> Furthermore, tboot_wait_for_aps() checks `if (timeout)` instead of
> `if (!timeout)` when logging a timeout warning-an inverted condition
> that was previously masked because the off-by-one bug always forced
> `timeout` down to zero.
>
> Pass `atomic_read(&ap_wfs_count) - 1` to tboot_wait_for_aps() in
> tboot_dying_cpu() (while keeping ap_wfs_count incremented for the
> subsequent WFS transition), and fix the inverted timeout warning
> condition in tboot_wait_for_aps().
>
> Tested on an Intel TXT platform with tboot 1.12.2 by offlining all
> secondary CPUs and verifying that no timeout warning occurs.
The changelog appears to have become rather contaminated with AI
detritus. Could you clean it up a bit please?
What is the end user visible effect of this bug and of the fix?
What's up with this fixes tag?
How long has this bug been there, how did you find it, and why do you
think it persisted so long?
Fixes: 5527c230f3d7 ("intel_txt: Intel(R) TXT and tboot kernel support")
linux.git$ git show 5527c230f3d7
fatal: ambiguous argument '5527c230f3d7': unknown revision or path ...
My tree has:
commit 3162534069597e34dd0ac9eb711be8dc23835ae7
Author: Joseph Cihula <joseph.cihula@intel.com>
Date: Tue Jun 30 19:30:59 2009 -0700
x86, intel_txt: Intel TXT boot support
but that doesn't match the SHA1 *or* the commit summary exactly.
What's up?
next prev parent reply other threads:[~2026-12-04 15:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 5:39 [PATCH] x86/boot/tboot: Fix off-by-one AP WFS wait count and timeout check Sun, Ning
2026-12-04 15:30 ` Dave Hansen [this message]
2026-12-04 17:58 ` Sun, Ning
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b7a73c94-07cc-47a8-9666-7bd028effde6@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=frederic@kernel.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=ning.sun@intel.com \
--cc=tboot-devel@lists.sourceforge.net \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.