tcm_vhost: Avoid VIRTIO_RING_F_EVENT_IDX feature bit
Subsystems (3)
PATCH 1/1 tcm_vhost: Avoid VIRTIO_RING_F_EVENT_IDX feature bit
From: Nicholas Bellinger <[email protected]>
This patch adds a VHOST_TCM_FEATURES mask minus VIRTIO_RING_F_EVENT_IDX so that vhost-scsi-pci userspace will strip this feature bit once GET_FEATURES reports it as being unsupported on the host.
This is to avoid a bug where ->handle_kicks() are missed when EVENT_IDX is enabled by default in userspace code.
--- drivers/vhost/tcm_vhost.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
drivers/vhost/tcm_vhost.c +8 -2
@@ -60,6 +60,12 @@ enum { VHOST_SCSI_VQ_IO = 2, }; +enum { +VHOST_TCM_FEATURES = (1ULL <<VIRTIO_F_NOTIFY_ON_EMPTY ) | + (1ULL <<VIRTIO_RING_F_INDIRECT_DESC ) | + (1ULL <<VHOST_F_LOG_ALL ) +}; +#define VHOST_SCSI_MAX_TARGET 256#define VHOST_SCSI_MAX_VQ 128
@@ -981,7 +987,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs)static int vhost_scsi_set_features (struct vhost_scsi *vs,u64 features) { -if (features & ~VHOST_FEATURES ) +if (features & ~VHOST_TCM_FEATURES )return -EOPNOTSUPP ;mutex_lock (&vs->dev.mutex);
@@ -1027,7 +1033,7 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl,return -EFAULT ;return 0 ;case VHOST_GET_FEATURES : - features =VHOST_FEATURES ; + features =VHOST_TCM_FEATURES ;if (copy_to_user (featurep, &features,sizeof features))return -EFAULT ;return 0 ;
Signature · 1 line
1.7.2.5
Michael S. Tsirkin
maintainerQuoted 6 lines · Nicholas A. Bellinger
From: Nicholas Bellinger <[email protected]>
This patch adds a
VHOST_TCM_FEATURESmask minusVIRTIO_RING_F_EVENT_IDXso that vhost-scsi-pci userspace will strip this feature bit onceGET_FEATURESreports it as being unsupported on the host.
Quoted 7 lines
This is to avoid a bug where ->handle_kicks() are missed when
EVENT_IDXis enabled by default in userspace code.Cc Michael S. Tsirkin <[email protected]>Cc Asias He <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Nicholas Bellinger <[email protected]>
No chance we can debug this properly?
Quoted 9 lines
--- drivers/vhost/tcm_vhost.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)drivers/vhost/tcm_vhost.c +0
-0
drivers/vhost/tcm_vhost.c enum { · line 66
Quoted 7 lines
drivers/vhost/tcm_vhost.c +4
-0@@ -60,6 +60,12 @@ enum { VHOST_SCSI_VQ_IO = 2, }; +enum { +VHOST_TCM_FEATURES = (1ULL <<VIRTIO_F_NOTIFY_ON_EMPTY ) | + (1ULL <<VIRTIO_RING_F_INDIRECT_DESC ) | + (1ULL <<VHOST_F_LOG_ALL )
All the rest of the code uses VHOST_SCSI so rename this too?
drivers/vhost/tcm_vhost.c enum { · line 68
Quoted 2 lines
drivers/vhost/tcm_vhost.c +2
-0+}; +
Please do something like
+/*
+* VIRTIO_RING_F_EVENT_IDX seems broken. Not sure the bug is in +* kernel but disabling it helps.
+* TODO: debug and remove the workaround.
+*/
+enum {
+ VHOST_SCSI_FEATURES = VHOST_FEATURES & (~VIRTIO_RING_F_EVENT_IDX)
+}
Quoted 23 lines
drivers/vhost/tcm_vhost.c +2
-2#define VHOST_SCSI_MAX_TARGET 256#define VHOST_SCSI_MAX_VQ 128@@ -981,7 +987,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs)static int vhost_scsi_set_features (struct vhost_scsi *vs,u64 features) { -if (features & ~VHOST_FEATURES ) +if (features & ~VHOST_TCM_FEATURES )return -EOPNOTSUPP ;mutex_lock (&vs->dev.mutex);@@ -1027,7 +1033,7 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl,return -EFAULT ;return 0 ;case VHOST_GET_FEATURES : - features =VHOST_FEATURES ; + features =VHOST_TCM_FEATURES ;if (copy_to_user (featurep, &features,sizeof features))return -EFAULT ;return 0 ;Signature · 1 line
1.7.2.5
Michael S. Tsirkin
maintainerQuoted 6 lines · Nicholas A. Bellinger
From: Nicholas Bellinger <[email protected]>
This patch adds a
VHOST_TCM_FEATURESmask minusVIRTIO_RING_F_EVENT_IDXso that vhost-scsi-pci userspace will strip this feature bit onceGET_FEATURESreports it as being unsupported on the host.
Quoted 7 lines
This is to avoid a bug where ->handle_kicks() are missed when
EVENT_IDXis enabled by default in userspace code.Cc Michael S. Tsirkin <[email protected]>Cc Asias He <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Nicholas Bellinger <[email protected]>
No chance we can debug this properly?
Quoted 9 lines
--- drivers/vhost/tcm_vhost.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)drivers/vhost/tcm_vhost.c +0
-0
drivers/vhost/tcm_vhost.c enum { · line 66
Quoted 7 lines
drivers/vhost/tcm_vhost.c +4
-0@@ -60,6 +60,12 @@ enum { VHOST_SCSI_VQ_IO = 2, }; +enum { +VHOST_TCM_FEATURES = (1ULL <<VIRTIO_F_NOTIFY_ON_EMPTY ) | + (1ULL <<VIRTIO_RING_F_INDIRECT_DESC ) | + (1ULL <<VHOST_F_LOG_ALL )
All the rest of the code uses VHOST_SCSI so rename this too?
drivers/vhost/tcm_vhost.c enum { · line 68
Quoted 2 lines
drivers/vhost/tcm_vhost.c +2
-0+}; +
Please do something like
+/*
+* VIRTIO_RING_F_EVENT_IDX seems broken. Not sure the bug is in +* kernel but disabling it helps.
+* TODO: debug and remove the workaround.
+*/
+enum {
+ VHOST_SCSI_FEATURES = VHOST_FEATURES & (~VIRTIO_RING_F_EVENT_IDX)
+}
Quoted 23 lines
drivers/vhost/tcm_vhost.c +2
-2#define VHOST_SCSI_MAX_TARGET 256#define VHOST_SCSI_MAX_VQ 128@@ -981,7 +987,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs)static int vhost_scsi_set_features (struct vhost_scsi *vs,u64 features) { -if (features & ~VHOST_FEATURES ) +if (features & ~VHOST_TCM_FEATURES )return -EOPNOTSUPP ;mutex_lock (&vs->dev.mutex);@@ -1027,7 +1033,7 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl,return -EFAULT ;return 0 ;case VHOST_GET_FEATURES : - features =VHOST_FEATURES ; + features =VHOST_TCM_FEATURES ;if (copy_to_user (featurep, &features,sizeof features))return -EFAULT ;return 0 ;Signature · 1 line
1.7.2.5
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Nicholas A. Bellinger
From: Nicholas Bellinger <[email protected]>
This patch adds a
VHOST_TCM_FEATURESmask minusVIRTIO_RING_F_EVENT_IDXso that vhost-scsi-pci userspace will strip this feature bit onceGET_FEATURESreports it as being unsupported on the host.This is to avoid a bug where ->handle_kicks() are missed when
EVENT_IDXis enabled by default in userspace code.
Quoted 7 lines
Quoted 4 lines
Cc Michael S. Tsirkin <[email protected]>Cc Asias He <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Nicholas Bellinger <[email protected]>No chance we can debug this properly?
Well, I assumed this was a low priority item ahead of tracking down the other blocking seabios related issue.
I'm fine with dropping this patch and requiring the event_idx=off option for now for an initial QEMU merge, but thought this made things a little easier for CLI users to avoid confusion.
Quoted 25 lines
Quoted 9 lines
--- drivers/vhost/tcm_vhost.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)drivers/vhost/tcm_vhost.c +0
-0drivers/vhost/tcm_vhost.c enum { · line 66
Quoted 7 lines
drivers/vhost/tcm_vhost.c +4
-0@@ -60,6 +60,12 @@ enum { VHOST_SCSI_VQ_IO = 2, }; +enum { +VHOST_TCM_FEATURES = (1ULL <<VIRTIO_F_NOTIFY_ON_EMPTY ) | + (1ULL <<VIRTIO_RING_F_INDIRECT_DESC ) | + (1ULL <<VHOST_F_LOG_ALL )All the rest of the code uses
VHOST_SCSIso rename this too?drivers/vhost/tcm_vhost.c enum { · line 68
Quoted 2 lines
drivers/vhost/tcm_vhost.c +2
-0+}; +Please do something like
Review
Quoted 8 lines
(quoted diff) +8
-0+/* +* VIRTIO_RING_F_EVENT_IDX seems broken. Not sure the bug is in +* kernel but disabling it helps. +* TODO: debug and remove the workaround. +*/ +enum { + VHOST_SCSI_FEATURES = VHOST_FEATURES & (~VIRTIO_RING_F_EVENT_IDX) +}
Patch updated.
Thanks,
--nab
Quoted 23 lines
Quoted 23 lines
drivers/vhost/tcm_vhost.c +2
-2#define VHOST_SCSI_MAX_TARGET 256#define VHOST_SCSI_MAX_VQ 128@@ -981,7 +987,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs)static int vhost_scsi_set_features (struct vhost_scsi *vs,u64 features) { -if (features & ~VHOST_FEATURES ) +if (features & ~VHOST_TCM_FEATURES )return -EOPNOTSUPP ;mutex_lock (&vs->dev.mutex);@@ -1027,7 +1033,7 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl,return -EFAULT ;return 0 ;case VHOST_GET_FEATURES : - features =VHOST_FEATURES ; + features =VHOST_TCM_FEATURES ;if (copy_to_user (featurep, &features,sizeof features))return -EFAULT ;return 0 ;Signature · 1 line
1.7.2.5
Michael S. Tsirkin
maintainerQuoted 19 lines · Nicholas A. Bellinger
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Nicholas A. Bellinger
From: Nicholas Bellinger <[email protected]>
This patch adds a
VHOST_TCM_FEATURESmask minusVIRTIO_RING_F_EVENT_IDXso that vhost-scsi-pci userspace will strip this feature bit onceGET_FEATURESreports it as being unsupported on the host.This is to avoid a bug where ->handle_kicks() are missed when
EVENT_IDXis enabled by default in userspace code.Quoted 7 lines
Quoted 4 lines
Cc Michael S. Tsirkin <[email protected]>Cc Asias He <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Nicholas Bellinger <[email protected]>No chance we can debug this properly?
Quoted 6 lines
Well, I assumed this was a low priority item ahead of tracking down the other blocking seabios related issue.
I'm fine with dropping this patch and requiring the event_idx=off option for now for an initial QEMU merge, but thought this made things a little easier for CLI users to avoid confusion.
Yea, we can't drink the ocean.
Quoted 64 lines
Quoted 25 lines
Quoted 9 lines
--- drivers/vhost/tcm_vhost.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)drivers/vhost/tcm_vhost.c +0
-0drivers/vhost/tcm_vhost.c enum { · line 66
Quoted 7 lines
drivers/vhost/tcm_vhost.c +4
-0@@ -60,6 +60,12 @@ enum { VHOST_SCSI_VQ_IO = 2, }; +enum { +VHOST_TCM_FEATURES = (1ULL <<VIRTIO_F_NOTIFY_ON_EMPTY ) | + (1ULL <<VIRTIO_RING_F_INDIRECT_DESC ) | + (1ULL <<VHOST_F_LOG_ALL )All the rest of the code uses
VHOST_SCSIso rename this too?drivers/vhost/tcm_vhost.c enum { · line 68
Quoted 2 lines
drivers/vhost/tcm_vhost.c +2
-0+}; +Please do something like
Review
Quoted 8 lines
(quoted diff) +8
-0+/* +* VIRTIO_RING_F_EVENT_IDX seems broken. Not sure the bug is in +* kernel but disabling it helps. +* TODO: debug and remove the workaround. +*/ +enum { + VHOST_SCSI_FEATURES = VHOST_FEATURES & (~VIRTIO_RING_F_EVENT_IDX) +}Patch updated.
Thanks,
--nab
Quoted 23 lines
Quoted 23 lines
drivers/vhost/tcm_vhost.c +2
-2#define VHOST_SCSI_MAX_TARGET 256#define VHOST_SCSI_MAX_VQ 128@@ -981,7 +987,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs)static int vhost_scsi_set_features (struct vhost_scsi *vs,u64 features) { -if (features & ~VHOST_FEATURES ) +if (features & ~VHOST_TCM_FEATURES )return -EOPNOTSUPP ;mutex_lock (&vs->dev.mutex);@@ -1027,7 +1033,7 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl,return -EFAULT ;return 0 ;case VHOST_GET_FEATURES : - features =VHOST_FEATURES ; + features =VHOST_TCM_FEATURES ;if (copy_to_user (featurep, &features,sizeof features))return -EFAULT ;return 0 ;Signature · 1 line
1.7.2.5
Quoted 62 lines · Nicholas A. Bellinger
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Nicholas A. Bellinger
From: Nicholas Bellinger <[email protected]>
This patch adds a
VHOST_TCM_FEATURESmask minusVIRTIO_RING_F_EVENT_IDXso that vhost-scsi-pci userspace will strip this feature bit onceGET_FEATURESreports it as being unsupported on the host.This is to avoid a bug where ->handle_kicks() are missed when
EVENT_IDXis enabled by default in userspace code.Quoted 7 lines
Quoted 4 lines
Cc Michael S. Tsirkin <[email protected]>Cc Asias He <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Nicholas Bellinger <[email protected]>No chance we can debug this properly?
Well, I assumed this was a low priority item ahead of tracking down the other blocking seabios related issue.
I'm fine with dropping this patch and requiring the event_idx=off option for now for an initial QEMU merge, but thought this made things a little easier for CLI users to avoid confusion.
Quoted 25 lines
Quoted 9 lines
--- drivers/vhost/tcm_vhost.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)drivers/vhost/tcm_vhost.c +0
-0drivers/vhost/tcm_vhost.c enum { · line 66
Quoted 7 lines
drivers/vhost/tcm_vhost.c +4
-0@@ -60,6 +60,12 @@ enum { VHOST_SCSI_VQ_IO = 2, }; +enum { +VHOST_TCM_FEATURES = (1ULL <<VIRTIO_F_NOTIFY_ON_EMPTY ) | + (1ULL <<VIRTIO_RING_F_INDIRECT_DESC ) | + (1ULL <<VHOST_F_LOG_ALL )All the rest of the code uses
VHOST_SCSIso rename this too?drivers/vhost/tcm_vhost.c enum { · line 68
Quoted 2 lines
drivers/vhost/tcm_vhost.c +2
-0+}; +Please do something like
Review
Quoted 8 lines
(quoted diff) +8
-0+/* +* VIRTIO_RING_F_EVENT_IDX seems broken. Not sure the bug is in +* kernel but disabling it helps. +* TODO: debug and remove the workaround. +*/ +enum { + VHOST_SCSI_FEATURES = VHOST_FEATURES & (~VIRTIO_RING_F_EVENT_IDX) +}Patch updated.
Quoted 3 lines
Thanks,
--nab
Still haven't seen it, anyway
Quoted 24 lines
Quoted 23 lines
Quoted 23 lines
drivers/vhost/tcm_vhost.c +2
-2#define VHOST_SCSI_MAX_TARGET 256#define VHOST_SCSI_MAX_VQ 128@@ -981,7 +987,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs)static int vhost_scsi_set_features (struct vhost_scsi *vs,u64 features) { -if (features & ~VHOST_FEATURES ) +if (features & ~VHOST_TCM_FEATURES )return -EOPNOTSUPP ;mutex_lock (&vs->dev.mutex);@@ -1027,7 +1033,7 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl,return -EFAULT ;return 0 ;case VHOST_GET_FEATURES : - features =VHOST_FEATURES ; + features =VHOST_TCM_FEATURES ;if (copy_to_user (featurep, &features,sizeof features))return -EFAULT ;return 0 ;Signature · 1 line
1.7.2.5
Quoted 63 lines · Michael S. Tsirkin
Quoted 62 lines · Nicholas A. Bellinger
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Nicholas A. Bellinger
From: Nicholas Bellinger <[email protected]>
This patch adds a
VHOST_TCM_FEATURESmask minusVIRTIO_RING_F_EVENT_IDXso that vhost-scsi-pci userspace will strip this feature bit onceGET_FEATURESreports it as being unsupported on the host.This is to avoid a bug where ->handle_kicks() are missed when
EVENT_IDXis enabled by default in userspace code.Quoted 7 lines
Quoted 4 lines
Cc Michael S. Tsirkin <[email protected]>Cc Asias He <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Nicholas Bellinger <[email protected]>No chance we can debug this properly?
Well, I assumed this was a low priority item ahead of tracking down the other blocking seabios related issue.
I'm fine with dropping this patch and requiring the event_idx=off option for now for an initial QEMU merge, but thought this made things a little easier for CLI users to avoid confusion.
Quoted 25 lines
Quoted 9 lines
--- drivers/vhost/tcm_vhost.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)drivers/vhost/tcm_vhost.c +0
-0drivers/vhost/tcm_vhost.c enum { · line 66
Quoted 7 lines
drivers/vhost/tcm_vhost.c +4
-0@@ -60,6 +60,12 @@ enum { VHOST_SCSI_VQ_IO = 2, }; +enum { +VHOST_TCM_FEATURES = (1ULL <<VIRTIO_F_NOTIFY_ON_EMPTY ) | + (1ULL <<VIRTIO_RING_F_INDIRECT_DESC ) | + (1ULL <<VHOST_F_LOG_ALL )All the rest of the code uses
VHOST_SCSIso rename this too?drivers/vhost/tcm_vhost.c enum { · line 68
Quoted 2 lines
drivers/vhost/tcm_vhost.c +2
-0+}; +Please do something like
Review
Quoted 8 lines
(quoted diff) +8
-0+/* +* VIRTIO_RING_F_EVENT_IDX seems broken. Not sure the bug is in +* kernel but disabling it helps. +* TODO: debug and remove the workaround. +*/ +enum { + VHOST_SCSI_FEATURES = VHOST_FEATURES & (~VIRTIO_RING_F_EVENT_IDX) +}Patch updated.
Quoted 6 lines
Quoted 3 lines
Thanks,
--nab
Still haven't seen it, anyway
Apologies, I had to attend to some other items this afternoon..
Sent this updated patch out a moment ago.
Quoted 3 lines
Thanks, including this now.
Quoted 63 lines · Michael S. Tsirkin
Quoted 62 lines · Nicholas A. Bellinger
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Nicholas A. Bellinger
From: Nicholas Bellinger <[email protected]>
This patch adds a
VHOST_TCM_FEATURESmask minusVIRTIO_RING_F_EVENT_IDXso that vhost-scsi-pci userspace will strip this feature bit onceGET_FEATURESreports it as being unsupported on the host.This is to avoid a bug where ->handle_kicks() are missed when
EVENT_IDXis enabled by default in userspace code.Quoted 7 lines
Quoted 4 lines
Cc Michael S. Tsirkin <[email protected]>Cc Asias He <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Nicholas Bellinger <[email protected]>No chance we can debug this properly?
Well, I assumed this was a low priority item ahead of tracking down the other blocking seabios related issue.
I'm fine with dropping this patch and requiring the event_idx=off option for now for an initial QEMU merge, but thought this made things a little easier for CLI users to avoid confusion.
Quoted 25 lines
Quoted 9 lines
--- drivers/vhost/tcm_vhost.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)drivers/vhost/tcm_vhost.c +0
-0drivers/vhost/tcm_vhost.c enum { · line 66
Quoted 7 lines
drivers/vhost/tcm_vhost.c +4
-0@@ -60,6 +60,12 @@ enum { VHOST_SCSI_VQ_IO = 2, }; +enum { +VHOST_TCM_FEATURES = (1ULL <<VIRTIO_F_NOTIFY_ON_EMPTY ) | + (1ULL <<VIRTIO_RING_F_INDIRECT_DESC ) | + (1ULL <<VHOST_F_LOG_ALL )All the rest of the code uses
VHOST_SCSIso rename this too?drivers/vhost/tcm_vhost.c enum { · line 68
Quoted 2 lines
drivers/vhost/tcm_vhost.c +2
-0+}; +Please do something like
Review
Quoted 8 lines
(quoted diff) +8
-0+/* +* VIRTIO_RING_F_EVENT_IDX seems broken. Not sure the bug is in +* kernel but disabling it helps. +* TODO: debug and remove the workaround. +*/ +enum { + VHOST_SCSI_FEATURES = VHOST_FEATURES & (~VIRTIO_RING_F_EVENT_IDX) +}Patch updated.
Quoted 6 lines
Quoted 3 lines
Thanks,
--nab
Still haven't seen it, anyway
Apologies, I had to attend to some other items this afternoon..
Sent this updated patch out a moment ago.
Quoted 3 lines
Thanks, including this now.