qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Riku Voipio" <riku.voipio@iki.fi>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Blue Swirl" <blauwirbel@gmail.com>,
	"Anthony Liguori" <anthony@codemonkey.ws>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Aurélien Jarno" <aurelien@aurel32.net>
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	[thread overview]
Message-ID: <1375203359-17562-1-git-send-email-afaerber@suse.de> (raw)

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 <armbru@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Aurélien Jarno <aurelien@aurel32.net>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Riku Voipio <riku.voipio@iki.fi>

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	other threads:[~2013-07-30 16:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30 16:55 Andreas Färber [this message]
2013-07-30 16:55 ` [Qemu-devel] [PATCH qom-cpu for-next 1/2] cpu: Use QTAILQ for CPU list Andreas Färber
2013-08-21 14:12   ` Andreas Färber
2013-08-21 14:36     ` Peter Maydell
2013-08-21 16:32       ` Andreas Färber
2013-07-30 16:55 ` [Qemu-devel] [RFC qom-cpu for-next 2/2] cpu: Replace qemu_for_each_cpu() Andreas Färber
2013-07-30 18:30   ` Michael S. Tsirkin
2013-08-14 11:49 ` [Qemu-devel] [PATCH qom-cpu for-next 0/2] QOM CPUState, part 12: CPU loops, revisited Andreas Färber
2013-08-30 14:42   ` Andreas Färber

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=1375203359-17562-1-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=armbru@redhat.com \
    --cc=aurelien@aurel32.net \
    --cc=blauwirbel@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).