aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-12-06 07:03:34 -0500
committerMichael S. Tsirkin <mst@redhat.com>2012-12-06 10:09:18 -0500
commit935cdee7ee159569b0aaa10bd9244660f6672b08 (patch)
tree366e06bee572c2578fcce51926a8ae25e04ce66d /drivers/vhost
parent4a7d6455b07845d92e025da222f11de519f90def (diff)
vhost: avoid backend flush on vring ops
vring changes already do a flush internally where appropriate, so we do not need a second flush. It's currently not very expensive but a follow-up patch makes flush more heavy-weight, so remove the extra flush here to avoid regressing performance if call or kick fds are changed on data path. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/net.c7
-rw-r--r--drivers/vhost/tcm_vhost.c5
-rw-r--r--drivers/vhost/vhost.c7
-rw-r--r--drivers/vhost/vhost.h3
4 files changed, 14 insertions, 8 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index ff6c91995c96..1802ab662082 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -942,8 +942,11 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
942 return vhost_net_reset_owner(n); 942 return vhost_net_reset_owner(n);
943 default: 943 default:
944 mutex_lock(&n->dev.mutex); 944 mutex_lock(&n->dev.mutex);
945 r = vhost_dev_ioctl(&n->dev, ioctl, arg); 945 r = vhost_dev_ioctl(&n->dev, ioctl, argp);
946 vhost_net_flush(n); 946 if (r == -ENOIOCTLCMD)
947 r = vhost_vring_ioctl(&n->dev, ioctl, argp);
948 else
949 vhost_net_flush(n);
947 mutex_unlock(&n->dev.mutex); 950 mutex_unlock(&n->dev.mutex);
948 return r; 951 return r;
949 } 952 }
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
index ef8884482439..33e5f90dfcf5 100644
--- a/drivers/vhost/tcm_vhost.c
+++ b/drivers/vhost/tcm_vhost.c
@@ -970,7 +970,10 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl,
970 return vhost_scsi_set_features(vs, features); 970 return vhost_scsi_set_features(vs, features);
971 default: 971 default:
972 mutex_lock(&vs->dev.mutex); 972 mutex_lock(&vs->dev.mutex);
973 r = vhost_dev_ioctl(&vs->dev, ioctl, arg); 973 r = vhost_dev_ioctl(&vs->dev, ioctl, argp);
974 /* TODO: flush backend after dev ioctl. */
975 if (r == -ENOIOCTLCMD)
976 r = vhost_vring_ioctl(&vs->dev, ioctl, argp);
974 mutex_unlock(&vs->dev.mutex); 977 mutex_unlock(&vs->dev.mutex);
975 return r; 978 return r;
976 } 979 }
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 5a3d0f1eaf94..34389f75fe65 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -607,7 +607,7 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
607 return 0; 607 return 0;
608} 608}
609 609
610static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) 610long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp)
611{ 611{
612 struct file *eventfp, *filep = NULL; 612 struct file *eventfp, *filep = NULL;
613 bool pollstart = false, pollstop = false; 613 bool pollstart = false, pollstop = false;
@@ -802,9 +802,8 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
802} 802}
803 803
804/* Caller must have device mutex */ 804/* Caller must have device mutex */
805long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, unsigned long arg) 805long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp)
806{ 806{
807 void __user *argp = (void __user *)arg;
808 struct file *eventfp, *filep = NULL; 807 struct file *eventfp, *filep = NULL;
809 struct eventfd_ctx *ctx = NULL; 808 struct eventfd_ctx *ctx = NULL;
810 u64 p; 809 u64 p;
@@ -875,7 +874,7 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, unsigned long arg)
875 fput(filep); 874 fput(filep);
876 break; 875 break;
877 default: 876 default:
878 r = vhost_set_vring(d, ioctl, argp); 877 r = -ENOIOCTLCMD;
879 break; 878 break;
880 } 879 }
881done: 880done:
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 5e19e3d5db8c..2639c58b23ab 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -164,7 +164,8 @@ long vhost_dev_check_owner(struct vhost_dev *);
164long vhost_dev_reset_owner(struct vhost_dev *); 164long vhost_dev_reset_owner(struct vhost_dev *);
165void vhost_dev_cleanup(struct vhost_dev *, bool locked); 165void vhost_dev_cleanup(struct vhost_dev *, bool locked);
166void vhost_dev_stop(struct vhost_dev *); 166void vhost_dev_stop(struct vhost_dev *);
167long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, unsigned long arg); 167long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, void __user *argp);
168long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp);
168int vhost_vq_access_ok(struct vhost_virtqueue *vq); 169int vhost_vq_access_ok(struct vhost_virtqueue *vq);
169int vhost_log_access_ok(struct vhost_dev *); 170int vhost_log_access_ok(struct vhost_dev *);
170 171