From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xkbqm-0002Y6-OP for qemu-devel@nongnu.org; Sat, 01 Nov 2014 12:48:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xkbqf-0004F2-7L for qemu-devel@nongnu.org; Sat, 01 Nov 2014 12:48:28 -0400 Received: from cantor2.suse.de ([195.135.220.15]:50843 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xkbqf-0004Eu-19 for qemu-devel@nongnu.org; Sat, 01 Nov 2014 12:48:21 -0400 Message-ID: <54550ED3.5090504@suse.de> Date: Sat, 01 Nov 2014 17:48:19 +0100 From: =?windows-1252?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1414857371-12294-1-git-send-email-ehabkost@redhat.com> <1414857371-12294-4-git-send-email-ehabkost@redhat.com> <54550CF4.3050200@suse.de> <20141101164545.GD3298@thinpad.lan.raisama.net> In-Reply-To: <20141101164545.GD3298@thinpad.lan.raisama.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/3] qdev: Use qdev_device_add_get_class() for -device , help List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Igor Mammedov , Gonglei , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini Am 01.11.2014 um 17:45 schrieb Eduardo Habkost: > On Sat, Nov 01, 2014 at 05:40:20PM +0100, Andreas F=E4rber wrote: >> Am 01.11.2014 um 16:56 schrieb Eduardo Habkost: >>> Make sure we try to list properties from classes that can be safely u= sed with >>> "-device". >>> >>> Fixes the following crashes: >>> >>> $ qemu-system-x86_64 -device x86_64-cpu,help >>> ** >>> ERROR:qom/object.c:336:object_initialize_with_type: assertion faile= d: (type->abstract =3D=3D false) >>> Aborted (core dumped) >>> $ qemu-system-x86_64 -device host-x86_64-cpu,help >>> qemu-system-x86_64: [...]/target-i386/cpu.c:1329: host_x86_cpu_init= fn: Assertion `(kvm_allowed)' failed. >>> Aborted (core dumped) >>> >>> After applying this patch: >>> >>> $ qemu-system-x86_64 -device x86_64-cpu,help >>> Parameter 'driver' expects non-abstract device type >>> $ qemu-system-x86_64 -device host-x86_64-cpu,help >>> Parameter 'driver' expects pluggable device type >>> >>> Signed-off-by: Eduardo Habkost >>> --- >>> qdev-monitor.c | 9 +++------ >>> 1 file changed, 3 insertions(+), 6 deletions(-) >>> >>> diff --git a/qdev-monitor.c b/qdev-monitor.c >>> index a9702d8..ebfa701 100644 >>> --- a/qdev-monitor.c >>> +++ b/qdev-monitor.c >>> @@ -235,12 +235,9 @@ int qdev_device_help(QemuOpts *opts) >>> return 0; >>> } >>> =20 >>> - if (!object_class_by_name(driver)) { >>> - const char *typename =3D find_typename_by_alias(driver); >>> - >>> - if (typename) { >>> - driver =3D typename; >>> - } >>> + qdev_get_device_class(&driver, &local_err); >>> + if (local_err) { >>> + goto error; >>> } >>> =20 >>> prop_list =3D qmp_device_list_properties(driver, &local_err); >> >> Is dc->cannot_instantiate_with_device_add_yet || (qdev_hotplug && >> !dc->hotpluggable) really relevant here? Or should that rather remain >> outside the common function in 1/3? >=20 > cannot_instantiate_with_device_add_yet makes sure we won't try to > instantiate classes that are not device_add-safe yet (like X86CPU, that > has lots of assumptions and side-effects inside instance_init()). Maybe I'm misunderstanding? Does this code path apply only to device_add (then you are right) or does it also apply to -device? Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg