From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Virtio-Dev <virtio-dev@lists.oasis-open.org>
Subject: Re: [virtio-dev] Re: queue_enable vs QueueReady
Date: Tue, 2 Jun 2020 00:20:30 -0400 [thread overview]
Message-ID: <20200602001440-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1768dfde-36c7-f0c7-89d1-8b3e3f99761d@redhat.com>
On Tue, Jun 02, 2020 at 10:57:19AM +0800, Jason Wang wrote:
>
> On 2020/6/1 下午2:01, Michael S. Tsirkin wrote:
> > On Thu, May 28, 2020 at 09:06:36PM +0800, Jason Wang wrote:
> > > Hi:
> > >
> > > I found ambiguity in the virtio specification:
> > >
> > > In PCI part, it describes the queue_enable as:
> > >
> > > The driver uses this to selectively prevent the device from executing
> > > requests from this virtqueue. 1 - enabled; 0 - disabled.
> > >
> > > In MMIO part, it describes the QueueReady as:
> > >
> > > Writing one (0x1) to this register notifies the device that it can execute
> > > requests from this virtual queue. Reading from this register returns the
> > > last value written to it. Both read and write accesses apply to the queue
> > > selected by writing to QueueSel.
> > >
> > > If I understand this correctly, they have the same meaning, but the driver
> > > requirements section looks conflict:
> > >
> > > PCI said: The driver MUST NOT write a 0 to queue_enable.
> > >
> > > MMIO said:
> > >
> > > To stop using the queue the driver MUST write zero (0x0) to this QueueReady
> > > and MUST read the value back to ensure synchronization.
> > >
> > > So we can't disable a queue via queue_enable but QueueReady. Any reason for
> > > such inconsistency?
> > >
> > > Thanks
> > PCI assumed device reset is enough to stop all queues. We had tons of
> > bugs around shutdown because of this, so in hindsight, MMIO had maybe a
> > better idea.
> >
> > Ability to stop a queue and take back buffers would be nice, e.g. serial
> > is kind of messed up around port disconnect without it.
>
>
> Yes, but this inconsistency brings trouble for vDPA implementation which has
> a set_queue_ready() and we do the following in virtio_vdpa as MMIO did:
>
> /* Select and deactivate the queue */
> ops->set_vq_ready(vdpa, index, 0);
> WARN_ON(ops->get_vq_ready(vdpa, index));
>
> The codes seems to work fine for IFC (a violation of the spec probably) but
> not Qemu's virtio-net-pci.
>
> Thanks
What do you mean "not Qemu's virtio-net-pci"? Which implementation
of .set_vq_ready do you use?
According to spec, I would expect this callback to do something
other that writing into queue_enable.
BTW I noticed this:
if (cmd == VHOST_VDPA_SET_VRING_ENABLE) {
if (copy_from_user(&s, argp, sizeof(s)))
return -EFAULT;
ops->set_vq_ready(vdpa, idx, s.num);
return 0;
}
I'm guessing s.num should be 1, right?
--
MST
---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
next prev parent reply other threads:[~2020-06-02 4:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 13:06 [virtio-dev] queue_enable vs QueueReady Jason Wang
2020-05-28 14:00 ` Stefan Hajnoczi
2020-05-29 2:57 ` Jason Wang
2020-06-01 6:01 ` [virtio-dev] " Michael S. Tsirkin
2020-06-02 2:57 ` Jason Wang
2020-06-02 4:20 ` Michael S. Tsirkin [this message]
2020-06-02 6:46 ` 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=20200602001440-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=jasowang@redhat.com \
--cc=virtio-dev@lists.oasis-open.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox