qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Igor Mammedov" <imammedo@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-devel] Subject: [PATCH 00/27] Fix APIC-ID-based CPU topology, take 3
Date: Wed, 24 Oct 2012 15:49:34 -0200	[thread overview]
Message-ID: <1351101001-14589-1-git-send-email-ehabkost@redhat.com> (raw)

Overview of patches:
 * 1-3 are just header dependency/conflict cleanups
 * 4 is the APIC ID initialization patch sent earlier by Igor
 * 5-6 change the KVM code to use the APIC ID as vcpu_id, on i386
 * 7-21 refactor the PC initialization code to allow a compatibility
   argument to be easily set by the pc-1.2 machine-init function later
 * 22-23 just make the PC code ready to support APIC IDs != cpu_index
   (but keeps existing behavior)
 * 24 just changes testing infrastructure to allow a target-i386-specific
   unit-test to be added
 * 25 adds utility functions that implement the topology-based APIC ID
   calculation
 * 26 just makes pc-1.2 and pc-1.3 use different machine-init functions
 * 27 finally implements the fix, keeping compatibility on pc-1.2

Changes v2 -> v3:
 * Not creating a new "PC" class, anymore
 * Patch 1: move qemu_open() & qemu_close() to qemu-stdio.h, too
 * Include "[PATCH v5] target-i386: initialize APIC at CPU level" from Igor
 * Let the PC code set the APIC ID directly, between cpu_x86_init() and
   x86_cpu_realize() calls, instead of adding new arguments to X86CPU init
   functions
 * Changes to the PC initialization code: introduce a PCInitArgs struct
 * Use a separate machine init function, that enables the compatibility mode
   on pc-1.2

Changes v1 -> v2:

 * Created a qemu-stdio.h file for some I/O related definitions
 * Now all the topology-based APIC ID calculation logic is inside pc.c
 * I have now created a "PC" object just to carry the machine-type compatibility
   flag that keeps the previous behavior.
   * Dropped the qemu_global_get() function, as it is not needed anymore
 * Fixed compile errors on non-x86 targets with KVM enabled (ppc, s390x)
 * Add more descriptive comments on THE FW_CFG_MAX_CPUS calculation
 * Add pointers to documentation on topology.h

Bug description:

The CPU APIC IDs generated by QEMU are broken if the number of cores-per-socket
or threads-per-core are not powers of 2, as the bits on the APIC ID do not
correspond to what's expected to reflect the CPU sockets/cores/threads
topology[1].

[1] http://software.intel.com/en-us/articles/intel-64-architecture-processor-topolog
y-enumeration/

This series is available on git, at:
 https://github.com/ehabkost/qemu-hacks/commits/apicid-topology-v3


Eduardo Habkost (26):
  move I/O-related definitions from qemu-common.h to a new header
    (qemu-stdio.h)
  cpus.h: include qemu-stdio.h
  hw/apic.c: rename bit functions to not conflict with bitops.h
  kvm: create kvm_arch_vcpu_id() function
  target-i386: kvm: set vcpu_id to APIC ID instead of CPU index
  pc: pc_init1(): always use rom_memory on pc_memory_init() call
  pc: pc_init1(): remove MemoryRegion arguments
  pc: pc_init1(): get QEMUMachineInitArgs argument
  pc: create PCInitArgs struct
  pc: add PC_DEFAULT_CPU_MODEL #define
  pc: add PCInitArgs parameter to pc_cpus_init()
  pc: pass PCInitArgs struct to pc_memory_init()
  pc: use FWCfgState* instead of void* for fw_cfg data
  pc: rename bochs_bios_init() to pc_bios_init()
  pc: pass PCInitArgs struct to pc_bios_init()
  xen_machine_pv: use cpu_init() instead of cpu_x86_init()
  pc: isolate the code that create CPUs
  cpu_x86_init: check for x86_cpu_realize() errors
  target-i386: do not call x86_cpu_realize() on cpu_x86_init()
  fw_cfg: remove FW_CFG_MAX_CPUS from fw_cfg_init()
  pc: set CPU APIC ID explicitly
  pc: set fw_cfg data based on APIC ID calculation
  tests: support target-specific unit tests
  target-i386: topology & APIC ID utility functions
  pc: create separate init function for pc-1.3
  pc: generate APIC IDs according to CPU topology

Igor Mammedov (1):
  target-i386: initialize APIC at CPU level

 cpus.h                 |   2 +
 hw/apic.c              |  35 +++++-----
 hw/fw_cfg.c            |   1 -
 hw/pc.c                | 185 ++++++++++++++++++++++++++++---------------------
 hw/pc.h                |  32 ++++++---
 hw/pc_piix.c           | 140 +++++++++++++++++--------------------
 hw/ppc_newworld.c      |   1 +
 hw/ppc_oldworld.c      |   1 +
 hw/sun4m.c             |   3 +
 hw/sun4u.c             |   1 +
 hw/xen_machine_pv.c    |   4 +-
 kvm-all.c              |   2 +-
 kvm.h                  |   3 +
 qemu-common.h          |  59 +---------------
 qemu-stdio.h           |  76 ++++++++++++++++++++
 target-i386/cpu.c      |  57 +++++++++++++++
 target-i386/cpu.h      |  14 ++++
 target-i386/helper.c   |   7 +-
 target-i386/kvm.c      |   5 ++
 target-i386/topology.h | 133 +++++++++++++++++++++++++++++++++++
 target-ppc/kvm.c       |   5 ++
 target-s390x/kvm.c     |   5 ++
 tests/.gitignore       |   1 +
 tests/Makefile         |  19 ++++-
 tests/test-x86-cpuid.c | 101 +++++++++++++++++++++++++++
 25 files changed, 645 insertions(+), 247 deletions(-)
 create mode 100644 qemu-stdio.h
 create mode 100644 target-i386/topology.h
 create mode 100644 tests/test-x86-cpuid.c

-- 
1.7.11.7

             reply	other threads:[~2012-10-24 17:48 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-24 17:49 Eduardo Habkost [this message]
2012-10-24 17:49 ` [Qemu-devel] [PATCH 01/27] move I/O-related definitions from qemu-common.h to a new header (qemu-stdio.h) Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 02/27] cpus.h: include qemu-stdio.h Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 03/27] hw/apic.c: rename bit functions to not conflict with bitops.h Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 04/27] target-i386: initialize APIC at CPU level Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 05/27] kvm: create kvm_arch_vcpu_id() function Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 06/27] target-i386: kvm: set vcpu_id to APIC ID instead of CPU index Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 07/27] pc: pc_init1(): always use rom_memory on pc_memory_init() call Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 08/27] pc: pc_init1(): remove MemoryRegion arguments Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 09/27] pc: pc_init1(): get QEMUMachineInitArgs argument Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 10/27] pc: create PCInitArgs struct Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 11/27] pc: add PC_DEFAULT_CPU_MODEL #define Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 12/27] pc: add PCInitArgs parameter to pc_cpus_init() Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 13/27] pc: pass PCInitArgs struct to pc_memory_init() Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 14/27] pc: use FWCfgState* instead of void* for fw_cfg data Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 15/27] pc: rename bochs_bios_init() to pc_bios_init() Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 16/27] pc: pass PCInitArgs struct " Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 17/27] xen_machine_pv: use cpu_init() instead of cpu_x86_init() Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 18/27] pc: isolate the code that create CPUs Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 19/27] cpu_x86_init: check for x86_cpu_realize() errors Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 20/27] target-i386: do not call x86_cpu_realize() on cpu_x86_init() Eduardo Habkost
2012-10-31 16:32   ` Igor Mammedov
2012-10-31 16:43     ` Andreas Färber
2012-10-31 17:10       ` Eduardo Habkost
2012-11-01 12:53       ` Igor Mammedov
2012-10-31 17:01     ` Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 21/27] fw_cfg: remove FW_CFG_MAX_CPUS from fw_cfg_init() Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 22/27] pc: set CPU APIC ID explicitly Eduardo Habkost
2012-11-01 14:04   ` Igor Mammedov
2012-11-01 14:30     ` Eduardo Habkost
2012-11-01 14:50       ` Igor Mammedov
2012-10-24 17:49 ` [Qemu-devel] [PATCH 23/27] pc: set fw_cfg data based on APIC ID calculation Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 24/27] tests: support target-specific unit tests Eduardo Habkost
2012-10-24 17:49 ` [Qemu-devel] [PATCH 25/27] target-i386: topology & APIC ID utility functions Eduardo Habkost
2012-10-24 17:50 ` [Qemu-devel] [PATCH 26/27] pc: create separate init function for pc-1.3 Eduardo Habkost
2012-10-24 18:12   ` Michael S. Tsirkin
2012-10-25 13:23     ` Eduardo Habkost
2012-10-24 17:50 ` [Qemu-devel] [PATCH 27/27] pc: generate APIC IDs according to CPU topology Eduardo Habkost
2012-11-01 14:46   ` Igor Mammedov
2012-11-01 15:16     ` Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1351101001-14589-1-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=afaerber@suse.de \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).