From ae0bd2a05300cbcd8dfcebe557cbdcc33707aaf5 Mon Sep 17 00:00:00 2001 From: Nathaniel Mitchell Date: Tue, 6 Feb 2024 09:48:49 -0800 Subject: [PATCH] Fix hal.cpu to not call set_affinity in single threaded env Signed-off-by: Nathaniel Mitchell --- chipsec/hal/cpu.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chipsec/hal/cpu.py b/chipsec/hal/cpu.py index b6f26ed1..c82d737b 100644 --- a/chipsec/hal/cpu.py +++ b/chipsec/hal/cpu.py @@ -121,8 +121,9 @@ class CPU(hal_base.HALBase): packages: Dict[int, List[int]] = {} cores: Dict[int, List[int]] = {} for thread in range(num_threads): - self.logger.log_hal(f'Setting affinity to: {thread:d}') - self.cs.helper.set_affinity(thread) + if num_threads > 1: + self.logger.log_hal(f'Setting affinity to: {thread:d}') + self.cs.helper.set_affinity(thread) eax = 0xb # cpuid leaf 0B contains x2apic info ecx = 1 # ecx 1 will get us pkg_id in edx after shifting right by _eax (_eax, _, _, _edx) = self.cs.cpu.cpuid(eax, ecx)