All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-arm] [PATCH] virtio: Mark virtio-device as non-user-creatable
Date: Wed, 2 Aug 2017 10:10:21 -0300	[thread overview]
Message-ID: <20170802131021.GF3108@localhost.localdomain> (raw)
In-Reply-To: <20170801230155.21083-1-ehabkost@redhat.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio: Mark virtio-device as non-user-creatable
Date: Wed, 2 Aug 2017 10:10:21 -0300	[thread overview]
Message-ID: <20170802131021.GF3108@localhost.localdomain> (raw)
In-Reply-To: <20170801230155.21083-1-ehabkost@redhat.com>

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

  parent reply	other threads:[~2017-08-02 13:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
2017-08-02 13:10   ` Eduardo Habkost

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=20170802131021.GF3108@localhost.localdomain \
    --to=ehabkost@redhat.com \
    --cc=armbru@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.