• D
    i386: improve sorting of CPU model names · c7dbff4b
    Daniel P. Berrangé 提交于
    The current list of CPU model names output by "-cpu help" is sorted
    alphabetically based on the internal QOM class name. The text that is
    displayed, however, uses the CPU model name, which is equivalent to the
    QOM class name, minus a suffix. Unfortunately that suffix has an effect
    on the sort ordering, for example, causing the various Broadwell
    variants to appear reversed:
    
      x86 486
      x86 Broadwell-IBRS        Intel Core Processor (Broadwell, IBRS)
      x86 Broadwell-noTSX-IBRS  Intel Core Processor (Broadwell, no TSX, IBRS
      x86 Broadwell-noTSX       Intel Core Processor (Broadwell, no TSX)
      x86 Broadwell             Intel Core Processor (Broadwell)
      x86 Conroe                Intel Celeron_4x0 (Conroe/Merom Class Core 2)
    
    By sorting on the actual CPU model name text that is displayed, the
    result is
    
      x86 486
      x86 Broadwell             Intel Core Processor (Broadwell)
      x86 Broadwell-IBRS        Intel Core Processor (Broadwell, IBRS)
      x86 Broadwell-noTSX       Intel Core Processor (Broadwell, no TSX)
      x86 Broadwell-noTSX-IBRS  Intel Core Processor (Broadwell, no TSX, IBRS)
      x86 Conroe                Intel Celeron_4x0 (Conroe/Merom Class Core 2)
    
    This requires extra string allocations during sorting, but this is not a
    concern given the usage scenario and the number of CPU models that exist.
    Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
    Message-Id: <20180606165527.17365-3-berrange@redhat.com>
    Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
    c7dbff4b
cpu.c 192.9 KB