mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
cpu-data: Pretend to always run on logical processor #0
The output of cpuid depends on the logical processor id the process runs on, as reflected by the "local apic id" present in cpuid leaves (eax=1,ebx=0), (eax=11,ebx=0), and (eax=11,ebx=1). This produces arbitrary changes in the output files that complicate comparisons. This patch masks the occurences of the local apic id with 0x00, so that two consecutive runs of "./cpu-data.py gather" produce identical results. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
05e73a8747
commit
10b5e789c5
@ -36,6 +36,13 @@ def gather_name(args):
|
|||||||
|
|
||||||
|
|
||||||
def gather_cpuid_leaves(args):
|
def gather_cpuid_leaves(args):
|
||||||
|
def mask(regs, eax_in, ecx_in, eax_mask, ebx_mask, ecx_mask, edx_mask):
|
||||||
|
if regs["eax_in"] == eax_in and regs["ecx_in"] == ecx_in:
|
||||||
|
regs["eax"] &= eax_mask
|
||||||
|
regs["ebx"] &= ebx_mask
|
||||||
|
regs["ecx"] &= ecx_mask
|
||||||
|
regs["edx"] &= edx_mask
|
||||||
|
|
||||||
leave_pattern = re.compile(
|
leave_pattern = re.compile(
|
||||||
"^\\s*"
|
"^\\s*"
|
||||||
"(0x[0-9a-f]+)\\s*"
|
"(0x[0-9a-f]+)\\s*"
|
||||||
@ -60,7 +67,7 @@ def gather_cpuid_leaves(args):
|
|||||||
match = leave_pattern.match(line)
|
match = leave_pattern.match(line)
|
||||||
if not match:
|
if not match:
|
||||||
continue
|
continue
|
||||||
yield {
|
regs = {
|
||||||
"eax_in": int(match.group(1), 0),
|
"eax_in": int(match.group(1), 0),
|
||||||
"ecx_in": int(match.group(2), 0),
|
"ecx_in": int(match.group(2), 0),
|
||||||
"eax": int(match.group(3), 0),
|
"eax": int(match.group(3), 0),
|
||||||
@ -68,6 +75,13 @@ def gather_cpuid_leaves(args):
|
|||||||
"ecx": int(match.group(5), 0),
|
"ecx": int(match.group(5), 0),
|
||||||
"edx": int(match.group(6), 0)}
|
"edx": int(match.group(6), 0)}
|
||||||
|
|
||||||
|
# local apic id. Pretend to always run on logical processor #0.
|
||||||
|
mask(regs, 0x01, 0x00, 0xffffffff, 0x00ffffff, 0xffffffff, 0xffffffff)
|
||||||
|
mask(regs, 0x0b, 0x00, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffff00)
|
||||||
|
mask(regs, 0x0b, 0x01, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffff00)
|
||||||
|
|
||||||
|
yield regs
|
||||||
|
|
||||||
|
|
||||||
def gather_msr():
|
def gather_msr():
|
||||||
msrs = dict()
|
msrs = dict()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user