qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: P J P <ppandit@redhat.com>,
	Qemu Developers <qemu-devel@nongnu.org>,
	zhangboxian <zhangboxian@huawei.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 1/2] virtio: check VirtQueue Vring object is set
Date: Tue, 28 Nov 2017 10:37:57 +0000	[thread overview]
Message-ID: <20171128103757.GD17146@stefanha-x1.localdomain> (raw)
In-Reply-To: <20171128101154.64b49cb0.cohuck@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

On Tue, Nov 28, 2017 at 10:11:54AM +0100, Cornelia Huck wrote:
> On Mon, 27 Nov 2017 23:25:28 +0530 (IST)
> P J P <ppandit@redhat.com> wrote:
> > +-- On Mon, 27 Nov 2017, Stefan Hajnoczi wrote --+
> > | > +    if (!vdev->vq[n].vring.num || !desc || !vdev->vq[n].vring.align) {
> > | ...
> > |   vdev->vq[n].vring.desc = desc;
> > |
> > | Why !desc?
> > 
> > virtio_queue_set_rings
> >  virtio_init_region_cache
> >    VirtQueue *vq = &vdev->vq[n];
> >    ...
> >    addr = vq->vring.desc;
> >    if (!addr) {
> >        return;
> >    }
> > 
> > These checks seem to be repeating all over. As mentioned earlier, could these 
> > be collated in one place, maybe virtio_queue_get_num()?
> > 
> >   int virtio_queue_get_num(VirtIODevice *vdev, int n)
> >   {
> >       VirtQueue *vq = &vdev->vq[n];
> > 
> >       if (!vq->.vring.num
> >            || !vq->vring.desc
> >            || !vq->vring.align) {
> >           return 0;  /* vq not set */
> >       }
> > 
> >       return vdev->vq[n].vring.num;
> >   }
> 
> This is conflating different things:
> - vq does not exist (num == 0)
> - vq is not setup by the guest (desc == 0)
> - vq has no valid alignment (which is only relevant for legacy)

I agree.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2017-11-28 10:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-24 18:34 [Qemu-devel] [PATCH v3 0/2] check VirtiQueue Vring objects P J P
2017-11-24 18:34 ` [Qemu-devel] [PATCH v3 1/2] virtio: check VirtQueue Vring object is set P J P
2017-11-27 10:03   ` Cornelia Huck
2017-11-27 11:15   ` Stefan Hajnoczi
2017-11-27 17:55     ` P J P
2017-11-28  9:11       ` Cornelia Huck
2017-11-28 10:37         ` Stefan Hajnoczi [this message]
2017-11-28 11:27           ` P J P
2017-11-28 12:00             ` Cornelia Huck
2017-11-29 10:11               ` P J P
2017-11-29 11:16                 ` Cornelia Huck
2017-11-30  9:16                   ` P J P
2017-11-24 18:34 ` [Qemu-devel] [PATCH v3 2/2] tests: add test to check VirtQueue object P J P

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=20171128103757.GD17146@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=ppandit@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhangboxian@huawei.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).