All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Jonah Palmer <jonah.palmer@oracle.com>, qemu-devel@nongnu.org
Cc: fam@euphon.net, kwolf@redhat.com, thuth@redhat.com,
	qemu-block@nongnu.org, mst@redhat.com, michael.roth@amd.com,
	david@redhat.com, armbru@redhat.com, amit@kernel.org,
	dgilbert@redhat.com, eric.auger@redhat.com,
	dmitrii.stepanov@cloud.ionos.com, kraxel@redhat.com,
	stefanha@redhat.com, pbonzini@redhat.com, si-wei.liu@oracle.com,
	marcandre.lureau@redhat.com, joao.m.martins@oracle.com,
	mreitz@redhat.com, Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	laurent@vivier.eu
Subject: Re: [PATCH v6 6/6] hmp: add virtio commands
Date: Thu, 22 Jul 2021 17:18:58 +0800	[thread overview]
Message-ID: <d0ef30f7-518a-1e16-489c-c85889a3b9e2@redhat.com> (raw)
In-Reply-To: <5fb48b8e-4380-45b5-2057-97d0e72dcf54@oracle.com>


在 2021/7/21 下午5:11, Jonah Palmer 写道:
>
>
> On 7/13/21 10:40 PM, Jason Wang wrote:
>>
>> 在 2021/7/12 下午6:35, Jonah Palmer 写道:
>>> +void hmp_virtio_queue_status(Monitor *mon, const QDict *qdict)
>>> +{
>>> +    Error *err = NULL;
>>> +    const char *path = qdict_get_try_str(qdict, "path");
>>> +    int queue = qdict_get_int(qdict, "queue");
>>> +    VirtQueueStatus *s = qmp_x_debug_virtio_queue_status(path, 
>>> queue, &err);
>>> +
>>> +    if (err != NULL) {
>>> +        hmp_handle_error(mon, err);
>>> +        return;
>>> +    }
>>> +
>>> +    monitor_printf(mon, "%s:\n", path);
>>> +    monitor_printf(mon, "  device_type:          %s\n",
>>> +                   VirtioType_str(s->device_type));
>>> +    monitor_printf(mon, "  index:                %d\n", 
>>> s->queue_index);
>>> +    monitor_printf(mon, "  inuse:                %d\n", s->inuse);
>>> +    monitor_printf(mon, "  last_avail_idx:       %d (%"PRId64" %% 
>>> %"PRId64")\n",
>>> +                   s->last_avail_idx, s->last_avail_idx % 
>>> s->vring_num,
>>> +                   s->vring_num);
>>> +    monitor_printf(mon, "  shadow_avail_idx:     %d (%"PRId64" %% 
>>> %"PRId64")\n",
>>> +                   s->shadow_avail_idx, s->shadow_avail_idx % 
>>> s->vring_num,
>>> +                   s->vring_num);
>>> +    monitor_printf(mon, "  used_idx:             %d (%"PRId64" %% 
>>> %"PRId64")\n",
>>> +                   s->used_idx, s->used_idx % s->vring_num, 
>>> s->vring_num);
>>
>>
>> The modular information is not the case of packed ring where the 
>> queue size does not have to be a power of 2.
> Doesn't modulo work for any integer, regardless if it's a power of 2 or not? Could you clarify this for me?


For packed ring, the index doesn't increase freely, it's always small 
than the virtqueue size.

So showing the modulo arithmetic seems useless since the device or 
driver doesn't use modulo for calculating the real offset.

Thanks


>
> Thank you,



  reply	other threads:[~2021-07-22  9:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12 10:35 [PATCH v6 0/6] hmp, qmp: Add some commands to introspect virtio devices Jonah Palmer
2021-07-12 10:35 ` [PATCH v6 1/6] qmp: add QMP command x-debug-query-virtio Jonah Palmer
2021-08-07 12:35   ` Markus Armbruster
2021-08-10  6:36     ` Jonah Palmer
2021-08-23 13:27       ` Markus Armbruster
2021-08-26  6:18         ` Jonah Palmer
2021-09-01 11:15           ` Markus Armbruster
2021-07-12 10:35 ` [PATCH v6 2/6] qmp: add QMP command x-debug-virtio-status Jonah Palmer
2021-08-07 12:42   ` Markus Armbruster
2021-08-10  6:50     ` Jonah Palmer
2021-09-03  8:26   ` Michael S. Tsirkin
2021-07-12 10:35 ` [PATCH v6 3/6] qmp: decode feature bits in virtio-status Jonah Palmer
2021-07-12 10:35 ` [PATCH v6 4/6] qmp: add QMP command x-debug-virtio-queue-status Jonah Palmer
2021-07-14  2:37   ` Jason Wang
2021-07-21  8:59     ` Jonah Palmer
2021-07-22  9:22       ` Jason Wang
2021-07-26  9:33         ` Jonah Palmer
2021-08-26  6:25           ` Jonah Palmer
2021-08-27  3:11             ` Jason Wang
2021-08-07 12:45   ` Markus Armbruster
2021-08-10  7:25     ` Jonah Palmer
2021-07-12 10:35 ` [PATCH v6 5/6] qmp: add QMP command x-debug-virtio-queue-element Jonah Palmer
2021-07-12 10:35 ` [PATCH v6 6/6] hmp: add virtio commands Jonah Palmer
2021-07-14  2:40   ` Jason Wang
2021-07-21  9:11     ` Jonah Palmer
2021-07-22  9:18       ` Jason Wang [this message]
2021-07-26  9:38         ` Jonah Palmer
2021-07-13 15:25 ` [PATCH v6 0/6] hmp,qmp: Add some commands to introspect virtio devices Michael S. Tsirkin
2021-07-14  2:42 ` [PATCH v6 0/6] hmp, qmp: " Jason Wang
2021-07-21  8:53   ` Jonah Palmer
2021-07-22  9:16     ` Jason Wang
2021-07-26  9:11       ` Jonah Palmer

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=d0ef30f7-518a-1e16-489c-c85889a3b9e2@redhat.com \
    --to=jasowang@redhat.com \
    --cc=amit@kernel.org \
    --cc=armbru@redhat.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=dmitrii.stepanov@cloud.ionos.com \
    --cc=eric.auger@redhat.com \
    --cc=fam@euphon.net \
    --cc=joao.m.martins@oracle.com \
    --cc=jonah.palmer@oracle.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=marcandre.lureau@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=si-wei.liu@oracle.com \
    --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 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.