x86/microcode: Sanitize __wait_for_cpus()
mainline inclusion from mainline-v6.7-rc1 commit 0772b9aa1a8f7322dce8588c231cff8b57298a53 category: feature bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I8XRMW CVE: NA -------------------------------- The code is too complicated for no reason: - The return value is pointless as this is a strict boolean. - It's way simpler to count down from num_online_cpus() and check for zero. - The timeout argument is pointless as this is always one second. - Touching the NMI watchdog every 100ns does not make any sense, neither does checking every 100ns. This is really not a hotpath operation. Preload the atomic counter with the number of online CPUs and simplify the whole timeout logic. Delay for one microsecond and touch the NMI watchdog once per millisecond. Intel-SIG: commit 0772b9aa1a8f x86/microcode: Sanitize __wait_for_cpus(). Microcode restructuring backport. Signed-off-by:Thomas Gleixner <tglx@linutronix.de> Signed-off-by:
Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20231002115903.204251527@linutronix.de [ Aubrey Li: amend commit log ] Signed-off-by:
Aubrey Li <aubrey.li@linux.intel.com>
Loading
Please sign in to comment