Re: [libvirt PATCH] cpu-data.py: Filter out apic current logical processor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 28, 2023 at 16:26:15 +0200, Tim Wiederhake wrote:
> Commit 10b5e789c5 attempts to filter out the logical processor id
> in the generated data to remove noise and irrelevant changes in the
> output.
> 
> cpuid-leaf 0x0B may have more than two sub-leaves though. Filter out
> logical processor id from all sub-leaves of 0x0B and 0x1F (superset
> of the information in 0x0B).
> 
> Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
> ---
>  tests/cputestdata/cpu-data.py | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/cputestdata/cpu-data.py b/tests/cputestdata/cpu-data.py
> index 498e07b2f7..b5641f7c16 100755
> --- a/tests/cputestdata/cpu-data.py
> +++ b/tests/cputestdata/cpu-data.py
> @@ -107,11 +107,14 @@ def gather_cpuid_leaves_kcpuid(output):
>  
>  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
> +        if eax_in != regs["eax_in"]:
> +            return
> +        if ecx_in != regs["ecx_in"] and ecx_in is not None:

My brain would be happier if the two expressions were swapped, i.e.:

           if ecx_in is not None and ecx_in != regs["ecx_in"]:

but both should work as we're not in C...

> +            return
> +        regs["eax"] &= eax_mask
> +        regs["ebx"] &= ebx_mask
> +        regs["ecx"] &= ecx_mask
> +        regs["edx"] &= edx_mask
>  
>      cpuid = args.path_to_cpuid or "cpuid"
>      try:
> @@ -132,8 +135,8 @@ def gather_cpuid_leaves(args):
>      for regs in reglist:
>          # 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)
> +        mask(regs, 0x0b, None, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000)
> +        mask(regs, 0x1f, None, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000)
>  
>          yield regs

Reviewed-by: Jiri Denemark <jdenemar@xxxxxxxxxx>




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux