qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH qom-cpu for-next 0/2] QOM CPUState, part 12: CPU loo


From: Andreas Färber
Subject: [Qemu-devel] [PATCH qom-cpu for-next 0/2] QOM CPUState, part 12: CPU loops, revisited
Date: Tue, 30 Jul 2013 18:55:57 +0200

Hello everyone,

A short CPUState series for a change: This mini-series replaces our home-grown
CPU list (first_cpu global and CPUState::next_cpu) with a QTAILQ.

To avoid repeated QTAILQ_FOREACH(foo, cpus, node) I am proposing a wrapper
CPU_FOREACH(foo) to hide the implementation details, as requested by mst,
while keeping inline loops, as requested by Markus.

The bulk of patch 1 is mechanical for/while loop conversions, except for:
exec.c: QTAILQ_INSERT_TAIL()
linux-user/syscall.c: QTAILQ_REMOVE() -- untested!

Having such a stable API will help with vCPU hot-unplug.

Patch 2 is controversial: It drops qemu_for_each_cpu() on Markus' request.
I'm including it as RFC to showcase what exactly those suggestions involve.
Converting from for (cpu = ...) to CPU_FOREACH(cpu) is obviously much more
straightforward than converting between function and loop, therefore with
patch 1 in mind, it seems best to still use for loops, which since recently
no longer require CPUArchState, the original trigger for qemu_for_each_cpu().

Available for testing at:
git://github.com/afaerber/qemu-cpu.git qom-cpu-12.v1
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-12.v1

Regards,
Andreas

>From CPUState part 10 v1:
* Instead of replacing every loop with qemu_for_each_cpu()
  replace loops with CPU_FOREACH() macro, based on QTAILQ_FOREACH().

Cc: Markus Armbruster <address@hidden>
Cc: Michael S. Tsirkin <address@hidden>
Cc: Anthony Liguori <address@hidden>
Cc: Blue Swirl <address@hidden>
Cc: Aurélien Jarno <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Eduardo Habkost <address@hidden>
Cc: Igor Mammedov <address@hidden>
Cc: Riku Voipio <address@hidden>

Andreas Färber (2):
  cpu: Use QTAILQ for CPU list
  cpu: Replace qemu_for_each_cpu()

 arch_init.c               | 11 ++++-----
 cpus.c                    | 58 ++++++++++++++++++++---------------------------
 cputlb.c                  |  2 +-
 dump.c                    | 10 ++++----
 exec.c                    | 33 ++++++++-------------------
 gdbstub.c                 | 14 ++++++------
 hw/acpi/piix4.c           | 20 ++++++++--------
 hw/arm/boot.c             |  2 +-
 hw/i386/kvm/clock.c       |  2 +-
 hw/i386/kvmvapic.c        |  2 +-
 hw/i386/pc.c              |  3 +--
 hw/ppc/e500.c             |  2 +-
 hw/ppc/ppc.c              |  2 +-
 hw/ppc/spapr.c            |  4 ++--
 include/qom/cpu.h         | 20 ++++++++--------
 kvm-all.c                 |  8 +++----
 linux-user/elfload.c      |  2 +-
 linux-user/main.c         | 10 +++++---
 linux-user/syscall.c      | 17 ++------------
 memory_mapping.c          |  5 ++--
 monitor.c                 |  2 +-
 qom/cpu.c                 | 30 ++++++++----------------
 target-i386/helper.c      |  3 +--
 target-i386/misc_helper.c |  2 +-
 target-mips/op_helper.c   | 10 ++++----
 target-ppc/excp_helper.c  |  2 +-
 translate-all.c           |  4 ++--
 27 files changed, 113 insertions(+), 167 deletions(-)

-- 
1.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]