[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [Qemu-devel] [PATCH] qdev: Make -device FOO, help hel
Re: [Qemu-trivial] [Qemu-devel] [PATCH] qdev: Make -device FOO, help help again when FOO is not pluggable
Tue, 17 Mar 2015 08:15:53 +0100
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Eduardo Habkost <address@hidden> writes:
> On Mon, Mar 16, 2015 at 06:33:52PM +0100, Markus Armbruster wrote:
>> Doesn't work since commit 31bed55 changed qdev_device_help() to reject
>> abstract devices and devices that have
>> cannot_instantiate_with_device_add_yet set.
>> The former makes sense: abstract devices are purely internal, and the
>> implementation of the help feature can't cope with them.
>> The latter makes less sense: the implementation works fine, and even
>> though you can't -device such a device, the help may still be useful
>> elsewhere, for instance with -global.
>> Revert the latter by moving the cannot_instantiate_with_device_add_yet
>> check back to the other caller of qdev_get_device_class(),
> This reintroduces the following crash:
> $ ./x86_64-softmmu/qemu-system-x86_64 -device host-x86_64-cpu,help
> /home/ehabkost/rh/proj/virt/qemu/target-i386/cpu.c:1391: host_x86_cpu_initfn:
> Assertion `(kvm_allowed)' failed.
> Aborted (core dumped)
> And this (which is not x86-specific because other arches also call
> cpu_exec_init() inside instance_init):
> $ ./x86_64-softmmu/qemu-system-x86_64 -monitor stdio
> QEMU 2.2.50 monitor - type 'help' for more information
> (qemu) device_add Nehalem-x86_64-cpu,help
> (qemu) Segmentation fault (core dumped)
I foolishly assumed that I can object_new() any device, so testing one
with cannot_instantiate_with_device_add_yet was enough. Thanks for
We clearly need a test that object_new()s every known type. Could this
be done with -object? Probably not if we want to catch known bad side
> Should we:
> 1) Live with the crashes until we move all code with side-effects outside
> instance_init (including bot not limited to cpu_exec_init() calls on most
> CPU classes);
> 2) add a "instance_init_is_unsafe" flag to those classes classes; or
To honor Anthony's long and distinguished service, we should name it
If my working idea "you can object_new() any type, and in fact you have
to for introspection" is correct, then this as a stop gap, not a
solution. If it's not correct, please educate me.
> 3) Keep the current code until we fix the classes that have unsafe
> instance_init functions?
The help regression is already in 2.2, which reduces the urgency of
fixing it a bit.
Once we know which types's instance_init misbehave, (2) is easy. (1)
might be, can't say.
"Until we fix" is potentially unbounded time, which makes me wary of
both (1) and (3). If we pick either of them now, and a fix doesn't
appear during the next development cycle, I'd like us to switch to (2)
as a stop gap for 2.4.