Re: [PATCHv3 1/6] cpu_x86: Refactor storage of CPUID data to add support for KVM features

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

 



On Mon, Nov 04, 2013 at 14:55:02 +0100, Peter Krempa wrote:
> The CPUID functions were stored in multiple arrays according to a
> specified prefix of those. This made it very hard to add another prefix
> to store KVM CPUID features (0x40000000). Instead of hardcoding a third
> array this patch changes the approach used:
> 
> The code is refactored to use a single array where the CPUID functions
> are stored ordered by the cpuid function so that they don't depend on
> the specific prefix and don't waste memory. The code is also less
> complex using this approach. A trateoff to this is the change from O(N)
> complexity to O(N^2) in x86DataAdd and x86DataSubtract. The rest of the
> functions were already using O(N^2) algorithms.

It's always fun reviewing patches that try to remove relics of my first
libvirt commit made 4 years ago :-)

> diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
> index 1785665..ba6a2b0 100644
> --- a/src/cpu/cpu_x86.c
> +++ b/src/cpu/cpu_x86.c
> @@ -84,14 +84,13 @@ enum compare_result {
> 
> 
>  struct virCPUx86DataIterator {
> -    virCPUx86Data *data;
> +    const virCPUx86Data *data;
>      int pos;
> -    bool extended;
>  };

Why do we need to keep the iterator at all when everything is now stored
in a single array? But that's mostly an additional cleanup to be done.

...

Good thing is the cputest passes after this series.

ACK

Jirka

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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]