qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Greg Kurz" <groug@kaod.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH 0/2] cpu/core: Fix "help" of CPU core device types
Date: Fri,  9 Apr 2021 18:03:37 +0200	[thread overview]
Message-ID: <20210409160339.500167-1-groug@kaod.org> (raw)

Thomas Huth recently reported an annoying crash:

$ ./qemu-system-ppc64 -device power8_v2.0-spapr-cpu-core,help
/home/thuth/devel/qemu/include/hw/boards.h:24:
 MACHINE: Object 0x5635bd53af10 is not an instance of type machine
Aborted (core dumped)

This is caused by an early use of qdev_get_machine(), before the
machine creation, which triggers a side-effect of creating a
dummy "container" object instead of the machine. This is needed
by user mode emulation, which doesn't really care about the
type of the parent of the CPU model. This is toxic for system
mode though because the system mode specific code usually assume
MACHINE(qdev_get_machine()).

This series brings separate implementations between user and
system mode. The breakage with "cpu-code,help" is fixed by using
current_machine.

Greg Kurz (2):
  qdev: Separate implementations of qdev_get_machine() for user and
    system
  cpu/core: Fix "help" of CPU core device types

 hw/core/machine.c        | 14 ++++++++++++++
 hw/core/qdev.c           |  2 +-
 hw/cpu/core.c            | 10 ++++++++--
 include/hw/qdev-core.h   |  1 +
 stubs/meson.build        |  1 +
 stubs/qdev-get-machine.c | 11 +++++++++++
 6 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 stubs/qdev-get-machine.c

-- 
2.26.3




             reply	other threads:[~2021-04-09 16:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 16:03 Greg Kurz [this message]
2021-04-09 16:03 ` [PATCH 1/2] qdev: Separate implementations of qdev_get_machine() for user and system Greg Kurz
2021-04-09 20:14   ` Eduardo Habkost
2021-04-10  6:33     ` Greg Kurz
2021-04-10  4:56   ` Thomas Huth
2021-04-10  8:59   ` Markus Armbruster
2021-04-15  8:26     ` Greg Kurz
2021-04-13 22:25   ` Eduardo Habkost
2021-04-15 10:53     ` Greg Kurz
2021-04-15 12:39   ` Philippe Mathieu-Daudé
2021-04-15 13:30     ` Greg Kurz
2021-04-15 16:45       ` Philippe Mathieu-Daudé
2021-04-15 16:56         ` Greg Kurz
2021-04-15 19:07           ` Philippe Mathieu-Daudé
2021-04-16  6:42             ` Greg Kurz
2021-04-19 15:45             ` Thomas Huth
2021-04-09 16:03 ` [PATCH 2/2] cpu/core: Fix "help" of CPU core device types Greg Kurz
2021-04-09 20:04   ` Eduardo Habkost
2021-04-10  4:53   ` Thomas Huth

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=20210409160339.500167-1-groug@kaod.org \
    --to=groug@kaod.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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).