From: Jason Wang <jasowang@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>, qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>, "Kevin Wolf" <kwolf@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
qemu-block@nongnu.org, "David Hildenbrand" <david@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Michael Roth" <mdroth@linux.vnet.ibm.com>,
"Amit Shah" <amit@kernel.org>, "Max Reitz" <mreitz@redhat.com>,
"Eric Auger" <eric.auger@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [RFC v3 4/6] qmp: add QMP command x-debug-virtio-queue-status
Date: Mon, 18 May 2020 11:31:40 +0800 [thread overview]
Message-ID: <f16d440f-bb1a-5564-c9ba-44e933e19560@redhat.com> (raw)
In-Reply-To: <e9a92c29-162f-e2eb-0a6c-c1e08e99ffa7@redhat.com>
On 2020/5/15 下午11:16, Laurent Vivier wrote:
> On 08/05/2020 04:57, Jason Wang wrote:
>> On 2020/5/7 下午7:49, Laurent Vivier wrote:
>>> This new command shows internal status of a VirtQueue.
>>> (vrings and indexes).
>>>
>>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>>
>> It looks to me that packed virtqueue is not supported. It's better to
>> add them in the future.
> I agree, it's why the series still remains an "RFC".
>
> ...
>>> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
>>> index 59bf6ef651a6..57552bf05014 100644
>>> --- a/hw/virtio/virtio.c
>>> +++ b/hw/virtio/virtio.c
>>> @@ -3877,6 +3877,41 @@ static VirtIODevice *virtio_device_find(const
>>> char *path)
>>> return NULL;
>>> }
>>> +VirtQueueStatus *qmp_x_debug_virtio_queue_status(const char *path,
>>> + uint16_t queue,
>>> Error **errp)
>>> +{
>>> + VirtIODevice *vdev;
>>> + VirtQueueStatus *status;
>>> +
>>> + vdev = virtio_device_find(path);
>>> + if (vdev == NULL) {
>>> + error_setg(errp, "Path %s is not a VirtIO device", path);
>>> + return NULL;
>>> + }
>>> +
>>> + if (queue >= VIRTIO_QUEUE_MAX || !virtio_queue_get_num(vdev,
>>> queue)) {
>>> + error_setg(errp, "Invalid virtqueue number %d", queue);
>>> + return NULL;
>>> + }
>>> +
>>> + status = g_new0(VirtQueueStatus, 1);
>>> + status->queue_index = vdev->vq[queue].queue_index;
>>> + status->inuse = vdev->vq[queue].inuse;
>>> + status->vring_num = vdev->vq[queue].vring.num;
>>> + status->vring_num_default = vdev->vq[queue].vring.num_default;
>>> + status->vring_align = vdev->vq[queue].vring.align;
>>> + status->vring_desc = vdev->vq[queue].vring.desc;
>>> + status->vring_avail = vdev->vq[queue].vring.avail;
>>> + status->vring_used = vdev->vq[queue].vring.used;
>>> + status->last_avail_idx = vdev->vq[queue].last_avail_idx;
>>
>> This might not be correct when vhost is used.
>>
>> We may consider to sync last_avail_idx from vhost backends here?
> Yes, but I don't know how to do that. Where can I find the information?
It could be synced through vhost ops vhost_get_vring_base(), see
vhost_virtqueue_stop().
Thanks
>
> Thanks,
> Laurent
next prev parent reply other threads:[~2020-05-18 3:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200507114927.6733-1-lvivier@redhat.com>
[not found] ` <20200507114927.6733-2-lvivier@redhat.com>
2020-05-07 15:38 ` [RFC v3 1/6] qmp: add QMP command x-debug-query-virtio Eric Blake
[not found] ` <20200507114927.6733-4-lvivier@redhat.com>
2020-05-07 15:47 ` [RFC v3 3/6] qmp: decode feature bits in virtio-status Eric Blake
2020-05-08 2:54 ` Jason Wang
[not found] ` <20200507114927.6733-7-lvivier@redhat.com>
2020-05-07 15:51 ` [RFC v3 6/6] hmp: add x-debug-virtio commands Eric Blake
[not found] ` <20200507114927.6733-5-lvivier@redhat.com>
2020-05-08 2:57 ` [RFC v3 4/6] qmp: add QMP command x-debug-virtio-queue-status Jason Wang
2020-05-15 15:16 ` Laurent Vivier
2020-05-18 3:31 ` Jason Wang [this message]
[not found] ` <20200507114927.6733-6-lvivier@redhat.com>
2020-05-08 3:03 ` [RFC v3 5/6] qmp: add QMP command x-debug-virtio-queue-element Jason Wang
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=f16d440f-bb1a-5564-c9ba-44e933e19560@redhat.com \
--to=jasowang@redhat.com \
--cc=amit@kernel.org \
--cc=armbru@redhat.com \
--cc=david@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eric.auger@redhat.com \
--cc=fam@euphon.net \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--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).