KVM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 00/15] Replace current_machine by qdev_get_machine()
@ 2020-01-09 15:21 Philippe Mathieu-Daudé
  2020-01-09 15:21 ` [PATCH 01/15] target/arm/kvm: Use CPUState::kvm_state in kvm_arm_pmu_supported() Philippe Mathieu-Daudé
                   ` (15 more replies)
  0 siblings, 16 replies; 42+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-01-09 15:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marcelo Tosatti, Peter Maydell, qemu-arm, Eduardo Habkost,
	Juan Quintela, kvm, Paolo Bonzini, Marcel Apfelbaum,
	Alistair Francis, qemu-ppc, Dr. David Alan Gilbert,
	Richard Henderson, David Gibson, Philippe Mathieu-Daudé

Blurb from previous question [1]:

  "hw/boards.h" declare current_machine, and vl.c defines it:

    current_machine = MACHINE(object_new_with_class(OBJECT_CLASS(machine_class)));
    object_property_add_child(object_get_root(), "machine",
                              OBJECT(current_machine), &error_abort);

  The bigger user of 'current_machine' is the accel/KVM code.

  Recently in a0628599f..cc7d44c2e0 "Replace global smp variables
  with machine smp properties" we started to use MACHINE(qdev_get_machine()).
  Following a0628599f..cc7d44c2e0, a5e0b33119 use 'current_machine' again.

  qdev_get_machine() resolves the machine in the QOM composition tree.

Paolo answered [2]:

> I would always use MACHINE(qdev_get_machine()), espeecially outside
> vl.c.  Ideally, current_machine would be static within vl.c or even
> unused outside the object_property_add_child() that you quote above.

Let's remove the global current_machine.

I am still confused by this comment:

  /* qdev_get_machine() can return something that's not TYPE_MACHINE
   * if this is one of the user-only emulators; in that case there's
   * no need to check the ignore_memory_transaction_failures board flag.
   */

[1] https://www.mail-archive.com/qemu-devel@nongnu.org/msg669475.html
[2] https://www.mail-archive.com/qemu-devel@nongnu.org/msg669493.html

Philippe Mathieu-Daudé (15):
  target/arm/kvm: Use CPUState::kvm_state in kvm_arm_pmu_supported()
  hw/ppc/spapr_rtas: Use local MachineState variable
  hw/ppc/spapr_rtas: Access MachineState via SpaprMachineState argument
  hw/ppc/spapr_rtas: Restrict variables scope to single switch case
  device-hotplug: Replace current_machine by qdev_get_machine()
  migration/savevm: Replace current_machine by qdev_get_machine()
  hw/core/machine-qmp-cmds: Replace current_machine by
    qdev_get_machine()
  target/arm/monitor: Replace current_machine by qdev_get_machine()
  device_tree: Replace current_machine by qdev_get_machine()
  memory: Replace current_machine by qdev_get_machine()
  exec: Replace current_machine by qdev_get_machine()
  accel: Introduce the current_accel() method
  accel: Replace current_machine->accelerator by current_accel() method
  accel/accel: Replace current_machine by qdev_get_machine()
  vl: Make current_machine a local variable

 include/hw/boards.h        |  2 --
 include/sysemu/accel.h     |  2 ++
 accel/accel.c              |  7 +++++++
 accel/kvm/kvm-all.c        |  4 ++--
 accel/tcg/tcg-all.c        |  2 +-
 device-hotplug.c           |  2 +-
 device_tree.c              |  4 +++-
 exec.c                     | 10 ++++++----
 hw/core/machine-qmp-cmds.c |  4 ++--
 hw/ppc/spapr_rtas.c        |  6 +++---
 memory.c                   |  6 ++++--
 migration/savevm.c         | 10 +++++-----
 target/arm/kvm.c           |  4 +---
 target/arm/kvm64.c         |  4 ++--
 target/arm/monitor.c       |  3 ++-
 target/i386/kvm.c          |  2 +-
 target/ppc/kvm.c           |  2 +-
 vl.c                       |  6 +++---
 18 files changed, 46 insertions(+), 34 deletions(-)

-- 
2.21.1


^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, back to index

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09 15:21 [PATCH 00/15] Replace current_machine by qdev_get_machine() Philippe Mathieu-Daudé
2020-01-09 15:21 ` [PATCH 01/15] target/arm/kvm: Use CPUState::kvm_state in kvm_arm_pmu_supported() Philippe Mathieu-Daudé
2020-01-10  9:59   ` Alistair Francis
2020-01-09 15:21 ` [PATCH 02/15] hw/ppc/spapr_rtas: Use local MachineState variable Philippe Mathieu-Daudé
2020-01-09 17:13   ` Greg Kurz
2020-01-13  1:11   ` David Gibson
2020-01-09 15:21 ` [PATCH 03/15] hw/ppc/spapr_rtas: Access MachineState via SpaprMachineState argument Philippe Mathieu-Daudé
2020-01-09 17:13   ` Greg Kurz
2020-01-13  1:11   ` David Gibson
2020-01-09 15:21 ` [PATCH 04/15] hw/ppc/spapr_rtas: Restrict variables scope to single switch case Philippe Mathieu-Daudé
2020-01-09 17:43   ` Greg Kurz
2020-01-10  9:34     ` Philippe Mathieu-Daudé
2020-01-10  9:50       ` Greg Kurz
2020-01-10 19:18         ` Eric Blake
2020-01-13  7:16         ` David Gibson
2020-01-09 15:21 ` [PATCH 05/15] device-hotplug: Replace current_machine by qdev_get_machine() Philippe Mathieu-Daudé
2020-01-12  9:42   ` Alistair Francis
2020-01-09 15:21 ` [PATCH 06/15] migration/savevm: " Philippe Mathieu-Daudé
2020-01-09 15:52   ` Dr. David Alan Gilbert
2020-01-12  9:43   ` Alistair Francis
2020-01-14 13:27   ` Juan Quintela
2020-01-09 15:21 ` [PATCH 07/15] hw/core/machine-qmp-cmds: " Philippe Mathieu-Daudé
2020-01-12  9:44   ` Alistair Francis
2020-01-09 15:21 ` [PATCH 08/15] target/arm/monitor: " Philippe Mathieu-Daudé
2020-01-12  9:47   ` Alistair Francis
2020-01-09 15:21 ` [PATCH 09/15] device_tree: " Philippe Mathieu-Daudé
2020-01-12  9:47   ` Alistair Francis
2020-01-09 15:21 ` [PATCH 10/15] memory: " Philippe Mathieu-Daudé
2020-01-12  9:48   ` Alistair Francis
2020-01-12 13:45     ` Philippe Mathieu-Daudé
2020-01-14  2:02       ` Alistair Francis
2020-01-09 15:21 ` [PATCH 11/15] exec: " Philippe Mathieu-Daudé
2020-01-14  1:57   ` Alistair Francis
2020-01-09 15:21 ` [PATCH 12/15] accel: Introduce the current_accel() method Philippe Mathieu-Daudé
2020-01-14  1:59   ` Alistair Francis
2020-01-09 15:21 ` [PATCH 13/15] accel: Replace current_machine->accelerator by " Philippe Mathieu-Daudé
2020-01-14  1:58   ` Alistair Francis
2020-01-09 15:21 ` [PATCH 14/15] accel/accel: Replace current_machine by qdev_get_machine() Philippe Mathieu-Daudé
2020-01-14  1:59   ` Alistair Francis
2020-01-09 15:21 ` [PATCH 15/15] vl: Make current_machine a local variable Philippe Mathieu-Daudé
2020-01-14  2:00   ` Alistair Francis
2020-01-21  8:59 ` [PATCH 00/15] Replace current_machine by qdev_get_machine() Markus Armbruster

KVM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kvm/0 kvm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kvm kvm/ https://lore.kernel.org/kvm \
		kvm@vger.kernel.org
	public-inbox-index kvm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.kvm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git