From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH RFC v3 09/16] virtio: set FEATURES_OK
Date: Thu, 23 Oct 2014 15:51:39 +0300 [thread overview]
Message-ID: <20141023125139.GA10033@redhat.com> (raw)
In-Reply-To: <20141023142808.377551d8.cornelia.huck@de.ibm.com>
On Thu, Oct 23, 2014 at 02:28:08PM +0200, Cornelia Huck wrote:
> On Wed, 22 Oct 2014 21:44:44 +0300
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > set FEATURES_OK as per virtio 1.0 spec
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > include/uapi/linux/virtio_config.h | 2 ++
> > drivers/virtio/virtio.c | 29 ++++++++++++++++++++++-------
> > 2 files changed, 24 insertions(+), 7 deletions(-)
> >
>
> > dev->config->finalize_features(dev);
> >
> > + if (virtio_has_feature(dev, VIRTIO_F_VERSION_1)) {
> > + add_status(dev, VIRTIO_CONFIG_S_FEATURES_OK);
> > + status = dev->config->get_status(dev);
> > + if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) {
> > + printk(KERN_ERR "virtio: device refuses features: %x\n",
> > + status);
> > + err = -ENODEV;
> > + goto err;
> > + }
> > + }
> > +
>
> Ugh, I just realize that virtio-ccw has a problem with that mechanism :(
>
> Up to now, the driver only propagated status to the device: For
> virtio-ccw, this was easily implemented via a ccw that transmitted
> "status" to the device. However, the "read back status" part now
> actually requires that the driver can get "status" from the device, or
> has a comparable way to find out that the device won't accept the
> status it tried to write.
Ugh, it actually caches the status in the transport :(
> I can think of two solutions:
>
> (1) Introduce a new ccw that actually reads the device status.
> (2) Make the WRITE_STATUS ccw fail (with a unit check) if the driver
> sets FEATURES_OK after it tried to set features the device won't
> accept.
>
> (1) is probably more generic, while (2) is more straightforward to
> implement.
>
> Good thing we actually try to finally implement this,
> I did not notice
> this problem during the review :(
Well, it's a nuisance, but the spec is out.
It seems to me a new command would be a substantive change so we can't
do this in errata.
Option (2) would require two statements for drivers and devices,
but since it's clearly the case for correct drivers/devices
that command does not fail, it follows that this
is not a substantive change so it can be fixed
in an errata.
So the new command would have to be optional, please open
two issues in the TC: one documenting that driver must check
WRITE_STATUS and device can fail WRITE_STATUS, and another
for adding READ_STATUS (which will have to wait until
the next CS).
--
MST
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH RFC v3 09/16] virtio: set FEATURES_OK
Date: Thu, 23 Oct 2014 15:51:39 +0300 [thread overview]
Message-ID: <20141023125139.GA10033@redhat.com> (raw)
In-Reply-To: <20141023142808.377551d8.cornelia.huck@de.ibm.com>
On Thu, Oct 23, 2014 at 02:28:08PM +0200, Cornelia Huck wrote:
> On Wed, 22 Oct 2014 21:44:44 +0300
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > set FEATURES_OK as per virtio 1.0 spec
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > include/uapi/linux/virtio_config.h | 2 ++
> > drivers/virtio/virtio.c | 29 ++++++++++++++++++++++-------
> > 2 files changed, 24 insertions(+), 7 deletions(-)
> >
>
> > dev->config->finalize_features(dev);
> >
> > + if (virtio_has_feature(dev, VIRTIO_F_VERSION_1)) {
> > + add_status(dev, VIRTIO_CONFIG_S_FEATURES_OK);
> > + status = dev->config->get_status(dev);
> > + if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) {
> > + printk(KERN_ERR "virtio: device refuses features: %x\n",
> > + status);
> > + err = -ENODEV;
> > + goto err;
> > + }
> > + }
> > +
>
> Ugh, I just realize that virtio-ccw has a problem with that mechanism :(
>
> Up to now, the driver only propagated status to the device: For
> virtio-ccw, this was easily implemented via a ccw that transmitted
> "status" to the device. However, the "read back status" part now
> actually requires that the driver can get "status" from the device, or
> has a comparable way to find out that the device won't accept the
> status it tried to write.
Ugh, it actually caches the status in the transport :(
> I can think of two solutions:
>
> (1) Introduce a new ccw that actually reads the device status.
> (2) Make the WRITE_STATUS ccw fail (with a unit check) if the driver
> sets FEATURES_OK after it tried to set features the device won't
> accept.
>
> (1) is probably more generic, while (2) is more straightforward to
> implement.
>
> Good thing we actually try to finally implement this,
> I did not notice
> this problem during the review :(
Well, it's a nuisance, but the spec is out.
It seems to me a new command would be a substantive change so we can't
do this in errata.
Option (2) would require two statements for drivers and devices,
but since it's clearly the case for correct drivers/devices
that command does not fail, it follows that this
is not a substantive change so it can be fixed
in an errata.
So the new command would have to be optional, please open
two issues in the TC: one documenting that driver must check
WRITE_STATUS and device can fail WRITE_STATUS, and another
for adding READ_STATUS (which will have to wait until
the next CS).
--
MST
next prev parent reply other threads:[~2014-10-23 12:51 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-22 18:44 [PATCH RFC v3 00/16] linux: towards virtio-1 guest support Michael S. Tsirkin
2014-10-22 18:44 ` [PATCH RFC v3 01/16] virtio: memory access APIs Michael S. Tsirkin
2014-10-22 18:44 ` Michael S. Tsirkin
2014-10-23 7:54 ` Cornelia Huck
2014-10-23 7:54 ` Cornelia Huck
[not found] ` <20141023095405.6bdd5a1a.cornelia.huck-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2014-10-23 9:15 ` Michael S. Tsirkin
2014-10-23 9:15 ` Michael S. Tsirkin
2014-10-23 9:15 ` Michael S. Tsirkin
2014-10-22 18:44 ` [PATCH RFC v3 02/16] virtio_ring: switch to new " Michael S. Tsirkin
2014-10-22 18:44 ` Michael S. Tsirkin
2014-10-22 18:44 ` [PATCH RFC v3 03/16] virtio: use u32, not bitmap for struct virtio_device's features Michael S. Tsirkin
2014-10-22 18:44 ` Michael S. Tsirkin
2014-10-22 18:44 ` [PATCH RFC v3 04/16] virtio: add support for 64 bit features Michael S. Tsirkin
2014-10-22 18:44 ` Michael S. Tsirkin
2014-10-22 18:44 ` [PATCH RFC v3 05/16] virtio: add virtio 1.0 feature bit Michael S. Tsirkin
2014-10-22 18:44 ` Michael S. Tsirkin
2014-10-23 11:57 ` Cornelia Huck
2014-10-23 11:57 ` Cornelia Huck
2014-10-22 18:44 ` [PATCH RFC v3 06/16] virtio: make endian-ness depend on virtio 1.0 Michael S. Tsirkin
2014-10-22 18:44 ` Michael S. Tsirkin
2014-10-23 12:06 ` Cornelia Huck
2014-10-22 18:44 ` [PATCH RFC v3 07/16] virtio_config: endian conversion for v1.0 Michael S. Tsirkin
2014-10-22 18:44 ` Michael S. Tsirkin
2014-10-22 18:44 ` [PATCH RFC v3 08/16] virtio: allow transports to get avail/used addresses Michael S. Tsirkin
2014-10-22 18:44 ` Michael S. Tsirkin
2014-10-22 18:44 ` [PATCH RFC v3 09/16] virtio: set FEATURES_OK Michael S. Tsirkin
2014-10-23 12:28 ` Cornelia Huck
[not found] ` <1414003404-505-10-git-send-email-mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-10-23 12:28 ` Cornelia Huck
2014-10-23 12:28 ` Cornelia Huck
2014-10-23 12:51 ` Michael S. Tsirkin [this message]
2014-10-23 12:51 ` Michael S. Tsirkin
2014-10-23 13:30 ` Cornelia Huck
2014-10-23 13:30 ` Cornelia Huck
2014-10-23 14:03 ` Michael S. Tsirkin
2014-10-23 14:03 ` Michael S. Tsirkin
2014-10-22 18:44 ` Michael S. Tsirkin
2014-10-22 18:44 ` [PATCH RFC v3 10/16] virtio_net: use v1.0 endian Michael S. Tsirkin
2014-10-22 18:44 ` Michael S. Tsirkin
2014-10-22 18:44 ` [PATCH RFC v3 11/16] virtio_blk: use virtio " Michael S. Tsirkin
2014-10-22 18:44 ` Michael S. Tsirkin
2014-10-22 18:44 ` [PATCH RFC v3 12/16] KVM: s390: Set virtio-ccw transport revision Michael S. Tsirkin
2014-10-22 18:44 ` [PATCH RFC v3 13/16] KVM: s390: virtio-ccw revision 1 SET_VQ Michael S. Tsirkin
2014-10-22 18:45 ` [PATCH RFC v3 14/16] KVM: s390: enable virtio-ccw revision 1 Michael S. Tsirkin
2014-10-22 18:45 ` [PATCH RFC v3 15/16] virtio_net: fix types for in memory structures Michael S. Tsirkin
2014-10-22 18:45 ` Michael S. Tsirkin
2014-10-22 18:45 ` [PATCH RFC v3 16/16] virtio_blk: " Michael S. Tsirkin
2014-10-22 18:45 ` Michael S. Tsirkin
2014-10-23 12:17 ` [PATCH RFC v3 00/16] linux: towards virtio-1 guest support Michael S. Tsirkin
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=20141023125139.GA10033@redhat.com \
--to=mst@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.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.