qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/1] virtio: feature bit fixup
@ 2014-12-12  9:01 Cornelia Huck
  2014-12-12  9:01 ` [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks Cornelia Huck
  0 siblings, 1 reply; 7+ messages in thread
From: Cornelia Huck @ 2014-12-12  9:01 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Cornelia Huck, Thomas Huth, qemu-devel

When reviewing my feature bit changes for 1.0, Thomas noticed that I
accidentally fixed a bug :) There are two further places with the same
problem that Thomas noticed as well.

I wonder why we didn't see problems before...

Cornelia Huck (1):
  virtio: fix feature bit checks

 hw/scsi/virtio-scsi.c       | 2 +-
 hw/virtio/dataplane/vring.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
1.8.5.5

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks
  2014-12-12  9:01 [Qemu-devel] [PATCH 0/1] virtio: feature bit fixup Cornelia Huck
@ 2014-12-12  9:01 ` Cornelia Huck
  2014-12-12  9:08   ` Michael S. Tsirkin
  2015-01-21 12:07   ` Thomas Huth
  0 siblings, 2 replies; 7+ messages in thread
From: Cornelia Huck @ 2014-12-12  9:01 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Cornelia Huck, Thomas Huth, qemu-devel

Several places check against the feature bit number instead of against
the feature bit. Fix them.

Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 hw/scsi/virtio-scsi.c       | 2 +-
 hw/virtio/dataplane/vring.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index ef48550..a44c410 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -144,7 +144,7 @@ static int virtio_scsi_parse_req(VirtIOSCSIReq *req,
      *
      * TODO: always disable this workaround for virtio 1.0 devices.
      */
-    if ((vdev->guest_features & VIRTIO_F_ANY_LAYOUT) == 0) {
+    if ((vdev->guest_features & (1 << VIRTIO_F_ANY_LAYOUT)) == 0) {
         req_size = req->elem.out_sg[0].iov_len;
         resp_size = req->elem.in_sg[0].iov_len;
     }
diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c
index 61f6d83..78c6f45 100644
--- a/hw/virtio/dataplane/vring.c
+++ b/hw/virtio/dataplane/vring.c
@@ -133,12 +133,12 @@ bool vring_should_notify(VirtIODevice *vdev, Vring *vring)
      * interrupts. */
     smp_mb();
 
-    if ((vdev->guest_features & VIRTIO_F_NOTIFY_ON_EMPTY) &&
+    if ((vdev->guest_features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)) &&
         unlikely(vring->vr.avail->idx == vring->last_avail_idx)) {
         return true;
     }
 
-    if (!(vdev->guest_features & VIRTIO_RING_F_EVENT_IDX)) {
+    if (!(vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX))) {
         return !(vring->vr.avail->flags & VRING_AVAIL_F_NO_INTERRUPT);
     }
     old = vring->signalled_used;
-- 
1.8.5.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks
  2014-12-12  9:01 ` [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks Cornelia Huck
@ 2014-12-12  9:08   ` Michael S. Tsirkin
  2014-12-12  9:13     ` Cornelia Huck
  2015-01-21 12:07   ` Thomas Huth
  1 sibling, 1 reply; 7+ messages in thread
From: Michael S. Tsirkin @ 2014-12-12  9:08 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: Thomas Huth, qemu-devel

On Fri, Dec 12, 2014 at 10:01:46AM +0100, Cornelia Huck wrote:
> Several places check against the feature bit number instead of against
> the feature bit. Fix them.
> 
> Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>

Cc: stable?

> ---
>  hw/scsi/virtio-scsi.c       | 2 +-
>  hw/virtio/dataplane/vring.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index ef48550..a44c410 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -144,7 +144,7 @@ static int virtio_scsi_parse_req(VirtIOSCSIReq *req,
>       *
>       * TODO: always disable this workaround for virtio 1.0 devices.
>       */
> -    if ((vdev->guest_features & VIRTIO_F_ANY_LAYOUT) == 0) {
> +    if ((vdev->guest_features & (1 << VIRTIO_F_ANY_LAYOUT)) == 0) {
>          req_size = req->elem.out_sg[0].iov_len;
>          resp_size = req->elem.in_sg[0].iov_len;
>      }
> diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c
> index 61f6d83..78c6f45 100644
> --- a/hw/virtio/dataplane/vring.c
> +++ b/hw/virtio/dataplane/vring.c
> @@ -133,12 +133,12 @@ bool vring_should_notify(VirtIODevice *vdev, Vring *vring)
>       * interrupts. */
>      smp_mb();
>  
> -    if ((vdev->guest_features & VIRTIO_F_NOTIFY_ON_EMPTY) &&
> +    if ((vdev->guest_features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)) &&
>          unlikely(vring->vr.avail->idx == vring->last_avail_idx)) {
>          return true;
>      }
>  
> -    if (!(vdev->guest_features & VIRTIO_RING_F_EVENT_IDX)) {
> +    if (!(vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX))) {
>          return !(vring->vr.avail->flags & VRING_AVAIL_F_NO_INTERRUPT);
>      }
>      old = vring->signalled_used;
> -- 
> 1.8.5.5

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks
  2014-12-12  9:08   ` Michael S. Tsirkin
@ 2014-12-12  9:13     ` Cornelia Huck
  2014-12-15  4:44       ` Fam Zheng
  0 siblings, 1 reply; 7+ messages in thread
From: Cornelia Huck @ 2014-12-12  9:13 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Thomas Huth, qemu-devel

On Fri, 12 Dec 2014 11:08:21 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Fri, Dec 12, 2014 at 10:01:46AM +0100, Cornelia Huck wrote:
> > Several places check against the feature bit number instead of against
> > the feature bit. Fix them.
> > 
> > Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> > Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> 
> Cc: stable?

Hm, yeah. Can you add it?

> 
> > ---
> >  hw/scsi/virtio-scsi.c       | 2 +-
> >  hw/virtio/dataplane/vring.c | 4 ++--
> >  2 files changed, 3 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks
  2014-12-12  9:13     ` Cornelia Huck
@ 2014-12-15  4:44       ` Fam Zheng
  0 siblings, 0 replies; 7+ messages in thread
From: Fam Zheng @ 2014-12-15  4:44 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: qemu-devel, qemu-stable, Thomas Huth, Michael S. Tsirkin

On Fri, 12/12 10:13, Cornelia Huck wrote:
> On Fri, 12 Dec 2014 11:08:21 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Fri, Dec 12, 2014 at 10:01:46AM +0100, Cornelia Huck wrote:
> > > Several places check against the feature bit number instead of against
> > > the feature bit. Fix them.
> > > 
> > > Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> > > Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> > 
> > Cc: stable?
> 
> Hm, yeah. Can you add it?

Ccing qemu-stable@nongnu.org

Fam

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks
  2014-12-12  9:01 ` [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks Cornelia Huck
  2014-12-12  9:08   ` Michael S. Tsirkin
@ 2015-01-21 12:07   ` Thomas Huth
  2015-01-21 14:05     ` Michael S. Tsirkin
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Huth @ 2015-01-21 12:07 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: qemu-stable, qemu-devel, Michael S. Tsirkin

On Fri, 12 Dec 2014 10:01:46 +0100
Cornelia Huck <cornelia.huck@de.ibm.com> wrote:

> Several places check against the feature bit number instead of against
> the feature bit. Fix them.
> 
> Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> ---
>  hw/scsi/virtio-scsi.c       | 2 +-
>  hw/virtio/dataplane/vring.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index ef48550..a44c410 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -144,7 +144,7 @@ static int virtio_scsi_parse_req(VirtIOSCSIReq *req,
>       *
>       * TODO: always disable this workaround for virtio 1.0 devices.
>       */
> -    if ((vdev->guest_features & VIRTIO_F_ANY_LAYOUT) == 0) {
> +    if ((vdev->guest_features & (1 << VIRTIO_F_ANY_LAYOUT)) == 0) {
>          req_size = req->elem.out_sg[0].iov_len;
>          resp_size = req->elem.in_sg[0].iov_len;
>      }
> diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c
> index 61f6d83..78c6f45 100644
> --- a/hw/virtio/dataplane/vring.c
> +++ b/hw/virtio/dataplane/vring.c
> @@ -133,12 +133,12 @@ bool vring_should_notify(VirtIODevice *vdev, Vring *vring)
>       * interrupts. */
>      smp_mb();
> 
> -    if ((vdev->guest_features & VIRTIO_F_NOTIFY_ON_EMPTY) &&
> +    if ((vdev->guest_features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)) &&
>          unlikely(vring->vr.avail->idx == vring->last_avail_idx)) {
>          return true;
>      }
> 
> -    if (!(vdev->guest_features & VIRTIO_RING_F_EVENT_IDX)) {
> +    if (!(vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX))) {
>          return !(vring->vr.avail->flags & VRING_AVAIL_F_NO_INTERRUPT);
>      }
>      old = vring->signalled_used;

Ping ... somebody taking care of this? It's a bug fix for current
code, so IMHO this patch should not wait for the inclusion of the
other virtio-1 stuff...

 Thomas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks
  2015-01-21 12:07   ` Thomas Huth
@ 2015-01-21 14:05     ` Michael S. Tsirkin
  0 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2015-01-21 14:05 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Cornelia Huck, qemu-devel, qemu-stable

On Wed, Jan 21, 2015 at 01:07:59PM +0100, Thomas Huth wrote:
> On Fri, 12 Dec 2014 10:01:46 +0100
> Cornelia Huck <cornelia.huck@de.ibm.com> wrote:
> 
> > Several places check against the feature bit number instead of against
> > the feature bit. Fix them.
> > 
> > Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> > Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> > ---
> >  hw/scsi/virtio-scsi.c       | 2 +-
> >  hw/virtio/dataplane/vring.c | 4 ++--
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> > index ef48550..a44c410 100644
> > --- a/hw/scsi/virtio-scsi.c
> > +++ b/hw/scsi/virtio-scsi.c
> > @@ -144,7 +144,7 @@ static int virtio_scsi_parse_req(VirtIOSCSIReq *req,
> >       *
> >       * TODO: always disable this workaround for virtio 1.0 devices.
> >       */
> > -    if ((vdev->guest_features & VIRTIO_F_ANY_LAYOUT) == 0) {
> > +    if ((vdev->guest_features & (1 << VIRTIO_F_ANY_LAYOUT)) == 0) {
> >          req_size = req->elem.out_sg[0].iov_len;
> >          resp_size = req->elem.in_sg[0].iov_len;
> >      }
> > diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c
> > index 61f6d83..78c6f45 100644
> > --- a/hw/virtio/dataplane/vring.c
> > +++ b/hw/virtio/dataplane/vring.c
> > @@ -133,12 +133,12 @@ bool vring_should_notify(VirtIODevice *vdev, Vring *vring)
> >       * interrupts. */
> >      smp_mb();
> > 
> > -    if ((vdev->guest_features & VIRTIO_F_NOTIFY_ON_EMPTY) &&
> > +    if ((vdev->guest_features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)) &&
> >          unlikely(vring->vr.avail->idx == vring->last_avail_idx)) {
> >          return true;
> >      }
> > 
> > -    if (!(vdev->guest_features & VIRTIO_RING_F_EVENT_IDX)) {
> > +    if (!(vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX))) {
> >          return !(vring->vr.avail->flags & VRING_AVAIL_F_NO_INTERRUPT);
> >      }
> >      old = vring->signalled_used;
> 
> Ping ... somebody taking care of this? It's a bug fix for current
> code, so IMHO this patch should not wait for the inclusion of the
> other virtio-1 stuff...
> 
>  Thomas

It's in my queue.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-01-21 14:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-12  9:01 [Qemu-devel] [PATCH 0/1] virtio: feature bit fixup Cornelia Huck
2014-12-12  9:01 ` [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks Cornelia Huck
2014-12-12  9:08   ` Michael S. Tsirkin
2014-12-12  9:13     ` Cornelia Huck
2014-12-15  4:44       ` Fam Zheng
2015-01-21 12:07   ` Thomas Huth
2015-01-21 14:05     ` Michael S. Tsirkin

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).