* [Qemu-devel] [PATCH] virtio: Mark virtio-device as non-user-creatable
@ 2017-08-01 23:01 Eduardo Habkost
2017-08-02 12:33 ` Halil Pasic
2017-08-02 13:10 ` Eduardo Habkost
0 siblings, 2 replies; 5+ messages in thread
From: Eduardo Habkost @ 2017-08-01 23:01 UTC (permalink / raw)
To: qemu-devel; +Cc: Markus Armbruster, Michael S. Tsirkin
TYPE_VIRTIO_DEVICE devices are already not usable with -device
and device_add, but they are reported as user-creatable on
"-device help" and through monitor interfaces.
Mark them as not user-creatable to avoid confusing users, and to
allow automated testing (e.g. scripts/device-crash-test) to skip
them.
Before this patch, device-crash-test will try to test
virtio-device devices with all machine-types:
$ time ./scripts/device-crash-test -D virtio-device -v ./x86_64-softmmu/qemu-system-x86_64
[...]
INFO: Total: 1088 test cases
INFO: Skipped 408 test cases
real 0m49.775s
After this patch, the script won't try to test virtio-device
devices:
$ time ./scripts/device-crash-test -D virtio-device -v ./x86_64-softmmu/qemu-system-x86_64
INFO: Total: 0 test cases
real 0m0.092s
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/virtio/virtio.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 464947f..c4bdb94 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2653,6 +2653,17 @@ static void virtio_device_class_init(ObjectClass *klass, void *data)
dc->unrealize = virtio_device_unrealize;
dc->bus_type = TYPE_VIRTIO_BUS;
dc->props = virtio_properties;
+ /*
+ * Reason:
+ * - TYPE_VIRTIO_DEVICE devices are not visible to guests
+ * unless they are created and controlled by transport-specific
+ * devices (virtio-pci, virtio-mmio, and virtio-ccw).
+ * - A TYPE_VIRTIO_BUS bus is never available for plugging
+ * using -device/device_add, as virtio-bus buses are
+ * created on the fly and immediately populated by the
+ * transport-specific devices' realize methods.
+ */
+ dc->user_creatable = false;
vdc->start_ioeventfd = virtio_device_start_ioeventfd_impl;
vdc->stop_ioeventfd = virtio_device_stop_ioeventfd_impl;
--
2.9.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio: Mark virtio-device as non-user-creatable
2017-08-01 23:01 [Qemu-devel] [PATCH] virtio: Mark virtio-device as non-user-creatable Eduardo Habkost
@ 2017-08-02 12:33 ` Halil Pasic
2017-08-03 14:45 ` Eduardo Habkost
2017-08-02 13:10 ` Eduardo Habkost
1 sibling, 1 reply; 5+ messages in thread
From: Halil Pasic @ 2017-08-02 12:33 UTC (permalink / raw)
To: Eduardo Habkost, qemu-devel; +Cc: Markus Armbruster, Michael S. Tsirkin
On 08/02/2017 01:01 AM, Eduardo Habkost wrote:
> TYPE_VIRTIO_DEVICE devices are already not usable with -device
> and device_add, but they are reported as user-creatable on
> "-device help" and through monitor interfaces.
I've tried -device virtio-rng on s390x and from what I see, it
seems we 'auto-magically' create the 'controlling' virtio-rng-ccw
device. So I have to ask what do you mean by 'already not usable'?
>
> Mark them as not user-creatable to avoid confusing users, and to
> allow automated testing (e.g. scripts/device-crash-test) to skip
> them.
>
> Before this patch, device-crash-test will try to test
> virtio-device devices with all machine-types:
>
> $ time ./scripts/device-crash-test -D virtio-device -v ./x86_64-softmmu/qemu-system-x86_64
> [...]
> INFO: Total: 1088 test cases
> INFO: Skipped 408 test cases
>
> real 0m49.775s
>
> After this patch, the script won't try to test virtio-device
> devices:
>
> $ time ./scripts/device-crash-test -D virtio-device -v ./x86_64-softmmu/qemu-system-x86_64
> INFO: Total: 0 test cases
>
> real 0m0.092s
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> hw/virtio/virtio.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 464947f..c4bdb94 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -2653,6 +2653,17 @@ static void virtio_device_class_init(ObjectClass *klass, void *data)
> dc->unrealize = virtio_device_unrealize;
> dc->bus_type = TYPE_VIRTIO_BUS;
> dc->props = virtio_properties;
> + /*
> + * Reason:
> + * - TYPE_VIRTIO_DEVICE devices are not visible to guests
> + * unless they are created and controlled by transport-specific
> + * devices (virtio-pci, virtio-mmio, and virtio-ccw).
> + * - A TYPE_VIRTIO_BUS bus is never available for plugging
> + * using -device/device_add, as virtio-bus buses are
> + * created on the fly and immediately populated by the
> + * transport-specific devices' realize methods.
> + */
> + dc->user_creatable = false;
> vdc->start_ioeventfd = virtio_device_start_ioeventfd_impl;
> vdc->stop_ioeventfd = virtio_device_stop_ioeventfd_impl;
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio: Mark virtio-device as non-user-creatable
2017-08-01 23:01 [Qemu-devel] [PATCH] virtio: Mark virtio-device as non-user-creatable Eduardo Habkost
2017-08-02 12:33 ` Halil Pasic
@ 2017-08-02 13:10 ` Eduardo Habkost
1 sibling, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2017-08-02 13:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Markus Armbruster, Michael S. Tsirkin, Peter Maydell, qemu-arm
On Tue, Aug 01, 2017 at 08:01:55PM -0300, Eduardo Habkost wrote:
> TYPE_VIRTIO_DEVICE devices are already not usable with -device
> and device_add, but they are reported as user-creatable on
> "-device help" and through monitor interfaces.
>
> Mark them as not user-creatable to avoid confusing users, and to
> allow automated testing (e.g. scripts/device-crash-test) to skip
> them.
>
> Before this patch, device-crash-test will try to test
> virtio-device devices with all machine-types:
>
> $ time ./scripts/device-crash-test -D virtio-device -v ./x86_64-softmmu/qemu-system-x86_64
> [...]
> INFO: Total: 1088 test cases
> INFO: Skipped 408 test cases
>
> real 0m49.775s
>
> After this patch, the script won't try to test virtio-device
> devices:
>
> $ time ./scripts/device-crash-test -D virtio-device -v ./x86_64-softmmu/qemu-system-x86_64
> INFO: Total: 0 test cases
>
> real 0m0.092s
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> hw/virtio/virtio.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 464947f..c4bdb94 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -2653,6 +2653,17 @@ static void virtio_device_class_init(ObjectClass *klass, void *data)
> dc->unrealize = virtio_device_unrealize;
> dc->bus_type = TYPE_VIRTIO_BUS;
> dc->props = virtio_properties;
> + /*
> + * Reason:
> + * - TYPE_VIRTIO_DEVICE devices are not visible to guests
> + * unless they are created and controlled by transport-specific
> + * devices (virtio-pci, virtio-mmio, and virtio-ccw).
> + * - A TYPE_VIRTIO_BUS bus is never available for plugging
> + * using -device/device_add, as virtio-bus buses are
> + * created on the fly and immediately populated by the
> + * transport-specific devices' realize methods.
> + */
Oops, I just found out that this is not true on virtio-mmio:
unused virtio-mmio-bus buses are available for plugging when
virtio-mmio devices are created.
So at least on arm, there are virtio-bus buses where
virtio-device devices can be plugged by users, and this patch is
incorrect.
> + dc->user_creatable = false;
> vdc->start_ioeventfd = virtio_device_start_ioeventfd_impl;
> vdc->stop_ioeventfd = virtio_device_stop_ioeventfd_impl;
>
> --
> 2.9.4
>
--
Eduardo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio: Mark virtio-device as non-user-creatable
2017-08-02 12:33 ` Halil Pasic
@ 2017-08-03 14:45 ` Eduardo Habkost
2017-08-03 22:11 ` Halil Pasic
0 siblings, 1 reply; 5+ messages in thread
From: Eduardo Habkost @ 2017-08-03 14:45 UTC (permalink / raw)
To: Halil Pasic; +Cc: qemu-devel, Markus Armbruster, Michael S. Tsirkin
On Wed, Aug 02, 2017 at 02:33:00PM +0200, Halil Pasic wrote:
>
>
> On 08/02/2017 01:01 AM, Eduardo Habkost wrote:
> > TYPE_VIRTIO_DEVICE devices are already not usable with -device
> > and device_add, but they are reported as user-creatable on
> > "-device help" and through monitor interfaces.
>
> I've tried -device virtio-rng on s390x and from what I see, it
> seems we 'auto-magically' create the 'controlling' virtio-rng-ccw
> device. So I have to ask what do you mean by 'already not usable'?
virtio-rng is just an alias for virtio-rng-<transport>, and it's
not a TYPE_VIRTIO_DEVICE device.
virtio-rng-device is the TYPE_VIRTIO_DEVICE subclass, and you
shouldn't be able to use "-device virtio-rng-device". Except
that it works with "qemu-system-arm -machine virt", as I noted on
another message, and this patch breaks it.
--
Eduardo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio: Mark virtio-device as non-user-creatable
2017-08-03 14:45 ` Eduardo Habkost
@ 2017-08-03 22:11 ` Halil Pasic
0 siblings, 0 replies; 5+ messages in thread
From: Halil Pasic @ 2017-08-03 22:11 UTC (permalink / raw)
To: Eduardo Habkost; +Cc: qemu-devel, Markus Armbruster, Michael S. Tsirkin
On 08/03/2017 04:45 PM, Eduardo Habkost wrote:
> On Wed, Aug 02, 2017 at 02:33:00PM +0200, Halil Pasic wrote:
>>
>>
>> On 08/02/2017 01:01 AM, Eduardo Habkost wrote:
>>> TYPE_VIRTIO_DEVICE devices are already not usable with -device
>>> and device_add, but they are reported as user-creatable on
>>> "-device help" and through monitor interfaces.
>>
>> I've tried -device virtio-rng on s390x and from what I see, it
>> seems we 'auto-magically' create the 'controlling' virtio-rng-ccw
>> device. So I have to ask what do you mean by 'already not usable'?
>
> virtio-rng is just an alias for virtio-rng-<transport>, and it's
> not a TYPE_VIRTIO_DEVICE device.
>
> virtio-rng-device is the TYPE_VIRTIO_DEVICE subclass, and you
> shouldn't be able to use "-device virtio-rng-device". Except
> that it works with "qemu-system-arm -machine virt", as I noted on
> another message, and this patch breaks it.
>
Sorry, I was in a hurry leaving for holiday (I'm in a holiday
for approx 2 weeks) and acted on assumptions -- obviously wrong
ones.
AFAIU you withdrew the patch because of this arm exception in
the other message.
Sorry for the noise.
Halil
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-03 22:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-01 23:01 [Qemu-devel] [PATCH] virtio: Mark virtio-device as non-user-creatable Eduardo Habkost
2017-08-02 12:33 ` Halil Pasic
2017-08-03 14:45 ` Eduardo Habkost
2017-08-03 22:11 ` Halil Pasic
2017-08-02 13:10 ` Eduardo Habkost
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).