search for: vhost_dev_ioctl

Displaying 20 results from an estimated 282 matches for "vhost_dev_ioctl".

2009 Dec 20
0
[PATCH 1/3] vhost: prevent modification of an active ring
...lock(&n->dev.mutex); } static long vhost_net_ioctl(struct file *f, unsigned int ioctl, @@ -587,8 +585,10 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl, case VHOST_RESET_OWNER: return vhost_net_reset_owner(n); default: + mutex_lock(&n->dev.mutex); r = vhost_dev_ioctl(&n->dev, ioctl, arg); vhost_net_flush(n); + mutex_unlock(&n->dev.mutex); return r; } } diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index e7b4dea..29f1675 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -288,6 +288,12 @@ static long vhost_set_...
2009 Dec 20
0
[PATCH 1/3] vhost: prevent modification of an active ring
...lock(&n->dev.mutex); } static long vhost_net_ioctl(struct file *f, unsigned int ioctl, @@ -587,8 +585,10 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl, case VHOST_RESET_OWNER: return vhost_net_reset_owner(n); default: + mutex_lock(&n->dev.mutex); r = vhost_dev_ioctl(&n->dev, ioctl, arg); vhost_net_flush(n); + mutex_unlock(&n->dev.mutex); return r; } } diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index e7b4dea..29f1675 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -288,6 +288,12 @@ static long vhost_set_...
2019 May 09
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...e5a004 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -31,6 +31,7 @@ #include <linux/sched/signal.h> #include <linux/interval_tree_generic.h> #include <linux/nospec.h> +#include <asm/futex.h> #include "vhost.h" @@ -1652,6 +1653,10 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) r = -EFAULT; break; } + if (p & 0x3) { + r = -EINVAL; + break; + } for (i = 0; i < d->nvqs; ++i) { struct vhost_virtqueue *vq; void __user *base = (void __user *)(unsigned long)p; @@ -1692,31 +1697,27...
2019 May 09
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...e5a004 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -31,6 +31,7 @@ #include <linux/sched/signal.h> #include <linux/interval_tree_generic.h> #include <linux/nospec.h> +#include <asm/futex.h> #include "vhost.h" @@ -1652,6 +1653,10 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) r = -EFAULT; break; } + if (p & 0x3) { + r = -EINVAL; + break; + } for (i = 0; i < d->nvqs; ++i) { struct vhost_virtqueue *vq; void __user *base = (void __user *)(unsigned long)p; @@ -1692,31 +1697,27...
2023 Mar 23
1
[PATCH v3 2/8] vhost-vdpa: use bind_mm/unbind_mm device callbacks
..._unlocked_ioctl(struct file *filep, > case VHOST_VDPA_RESUME: > r = vhost_vdpa_resume(v); > break; > + case VHOST_SET_OWNER: > + r = vhost_dev_set_owner(d); Nit: I'd stick to the current way of passing the cmd, argp to vhost_dev_ioctl() and introduce a new switch after the vhost_dev_ioctl(). In this way, we are immune to any possible changes of dealing with VHOST_SET_OWNER in vhost core. Others look good. Thanks > + if (r) > + break; > + r = vhost_vdpa_bind_mm(v); &g...
2019 Nov 07
1
[PATCH v5] vhost: introduce mdev based hardware backend
...;>> + /* >>>>>> + * VHOST_SET_MEM_TABLE, VHOST_SET_LOG_BASE, and >>>>>> + * VHOST_SET_LOG_FD are not used yet. >>>>>> + */ >>>>> If we don't even use them, there's probably no need to call >>>>> vhost_dev_ioctl(). This may help to avoid confusion when we want to develop >>>>> new API for e.g dirty page tracking. >>>> Good point. It's better to reject these ioctls for now. >>>> >>>> PS. One thing I may need to clarify is that, we need the >>>&...
2023 Mar 21
1
[PATCH v3 2/8] vhost-vdpa: use bind_mm/unbind_mm device callbacks
...tic long vhost_vdpa_unlocked_ioctl(struct file *filep, case VHOST_VDPA_RESUME: r = vhost_vdpa_resume(v); break; + case VHOST_SET_OWNER: + r = vhost_dev_set_owner(d); + if (r) + break; + r = vhost_vdpa_bind_mm(v); + if (r) + vhost_dev_reset_owner(d, NULL); + break; default: r = vhost_dev_ioctl(&v->vdev, cmd, argp); if (r == -ENOIOCTLCMD) @@ -1287,6 +1317,7 @@ static int vhost_vdpa_release(struct inode *inode, struct file *filep) vhost_vdpa_clean_irq(v); vhost_vdpa_reset(v); vhost_dev_stop(&v->vdev); + vhost_vdpa_unbind_mm(v); vhost_vdpa_config_put(v); vhost_vdp...
2019 May 07
4
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...94c41 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -31,6 +31,7 @@ #include <linux/sched/signal.h> #include <linux/interval_tree_generic.h> #include <linux/nospec.h> +#include <asm/futex.h> #include "vhost.h" @@ -1692,25 +1693,27 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) } EXPORT_SYMBOL_GPL(vhost_dev_ioctl); -/* TODO: This is really inefficient. We need something like get_user() - * (instruction directly accesses the data, with an exception table entry - * returning -EFAULT). See Documentation/x86/exc...
2019 May 07
4
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...94c41 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -31,6 +31,7 @@ #include <linux/sched/signal.h> #include <linux/interval_tree_generic.h> #include <linux/nospec.h> +#include <asm/futex.h> #include "vhost.h" @@ -1692,25 +1693,27 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) } EXPORT_SYMBOL_GPL(vhost_dev_ioctl); -/* TODO: This is really inefficient. We need something like get_user() - * (instruction directly accesses the data, with an exception table entry - * returning -EFAULT). See Documentation/x86/exc...
2019 May 09
0
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...b/drivers/vhost/vhost.c > @@ -31,6 +31,7 @@ > #include <linux/sched/signal.h> > #include <linux/interval_tree_generic.h> > #include <linux/nospec.h> > +#include <asm/futex.h> > > #include "vhost.h" > > @@ -1652,6 +1653,10 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) > r = -EFAULT; > break; > } > + if (p & 0x3) { > + r = -EINVAL; > + break; > + } > for (i = 0; i < d->nvqs; ++i) { > struct vhost_virtqueue *vq; > void __user *base = (voi...
2019 May 13
5
[PATCH net] vhost: don't use kmap() to log dirty pages
...> +#include <asm/futex.h> #include "vhost.h" @@ -43,6 +44,8 @@ MODULE_PARM_DESC(max_iotlb_entries, "Maximum number of iotlb entries. (default: 2048)"); +static DEFINE_MUTEX(vhost_log_lock); + enum { VHOST_MEMORY_F_LOG = 0x1, }; @@ -1692,28 +1695,31 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) } EXPORT_SYMBOL_GPL(vhost_dev_ioctl); -/* TODO: This is really inefficient. We need something like get_user() - * (instruction directly accesses the data, with an exception table entry - * returning -EFAULT). See Documentation/x86/exc...
2019 May 13
5
[PATCH net] vhost: don't use kmap() to log dirty pages
...> +#include <asm/futex.h> #include "vhost.h" @@ -43,6 +44,8 @@ MODULE_PARM_DESC(max_iotlb_entries, "Maximum number of iotlb entries. (default: 2048)"); +static DEFINE_MUTEX(vhost_log_lock); + enum { VHOST_MEMORY_F_LOG = 0x1, }; @@ -1692,28 +1695,31 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) } EXPORT_SYMBOL_GPL(vhost_dev_ioctl); -/* TODO: This is really inefficient. We need something like get_user() - * (instruction directly accesses the data, with an exception table entry - * returning -EFAULT). See Documentation/x86/exc...
2019 May 10
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...+31,7 @@ >> #include <linux/sched/signal.h> >> #include <linux/interval_tree_generic.h> >> #include <linux/nospec.h> >> +#include <asm/futex.h> >> >> #include "vhost.h" >> >> @@ -1652,6 +1653,10 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) >> r = -EFAULT; >> break; >> } >> + if (p & 0x3) { >> + r = -EINVAL; >> + break; >> + } >> for (i = 0; i < d->nvqs; ++i) { >> struct vhost_virtque...
2019 May 10
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...+31,7 @@ >> #include <linux/sched/signal.h> >> #include <linux/interval_tree_generic.h> >> #include <linux/nospec.h> >> +#include <asm/futex.h> >> >> #include "vhost.h" >> >> @@ -1652,6 +1653,10 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) >> r = -EFAULT; >> break; >> } >> + if (p & 0x3) { >> + r = -EINVAL; >> + break; >> + } >> for (i = 0; i < d->nvqs; ++i) { >> struct vhost_virtque...
2013 Jul 07
2
[PATCH v2 03/11] vhost: Make vhost a separate module
...ioctl(struct vhost_dev *d, int ioctl, void __user *argp) > > > vhost_poll_flush(&vq->poll); > > > return r; > > > } > > > +EXPORT_SYMBOL_GPL(vhost_vring_ioctl); > > > > > > /* Caller must have device mutex */ > > > long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) > > > @@ -871,6 +890,7 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) > > > done: > > > return r; > > > } > > > +EXPORT_SYMBOL_GPL(vhost_dev_ioctl); >...
2013 Jul 07
2
[PATCH v2 03/11] vhost: Make vhost a separate module
...ioctl(struct vhost_dev *d, int ioctl, void __user *argp) > > > vhost_poll_flush(&vq->poll); > > > return r; > > > } > > > +EXPORT_SYMBOL_GPL(vhost_vring_ioctl); > > > > > > /* Caller must have device mutex */ > > > long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) > > > @@ -871,6 +890,7 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) > > > done: > > > return r; > > > } > > > +EXPORT_SYMBOL_GPL(vhost_dev_ioctl); >...
2015 Dec 31
4
[PATCH RFC] vhost: basic device IOTLB support
....h | 26 +++++++ 4 files changed, 229 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 9eda69e..a172be9 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1083,7 +1083,7 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl, r = vhost_dev_ioctl(&n->dev, ioctl, argp); if (r == -ENOIOCTLCMD) r = vhost_vring_ioctl(&n->dev, ioctl, argp); - else + else if (ioctl != VHOST_UPDATE_IOTLB) vhost_net_flush(n); mutex_unlock(&n->dev.mutex); return r; diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c ind...
2015 Dec 31
4
[PATCH RFC] vhost: basic device IOTLB support
....h | 26 +++++++ 4 files changed, 229 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 9eda69e..a172be9 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1083,7 +1083,7 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl, r = vhost_dev_ioctl(&n->dev, ioctl, argp); if (r == -ENOIOCTLCMD) r = vhost_vring_ioctl(&n->dev, ioctl, argp); - else + else if (ioctl != VHOST_UPDATE_IOTLB) vhost_net_flush(n); mutex_unlock(&n->dev.mutex); return r; diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c ind...
2019 May 08
0
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...b/drivers/vhost/vhost.c > @@ -31,6 +31,7 @@ > #include <linux/sched/signal.h> > #include <linux/interval_tree_generic.h> > #include <linux/nospec.h> > +#include <asm/futex.h> > > #include "vhost.h" > > @@ -1692,25 +1693,27 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) > } > EXPORT_SYMBOL_GPL(vhost_dev_ioctl); > > -/* TODO: This is really inefficient. We need something like get_user() > - * (instruction directly accesses the data, with an exception table entry > - * returning -EFAU...
2020 Aug 05
2
[PATCH 4/4] vhost: vdpa: report iova range
...66,9 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep, > case VHOST_VDPA_SET_CONFIG_CALL: > r = vhost_vdpa_set_config_call(v, argp); > break; > + case VHOST_VDPA_GET_IOVA_RANGE: > + r = vhost_vdpa_get_iova_range(v, argp); > + break; > default: > r = vhost_dev_ioctl(&v->vdev, cmd, argp); > if (r == -ENOIOCTLCMD) > diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h > index 0c2349612e77..850956980e27 100644 > --- a/include/uapi/linux/vhost.h > +++ b/include/uapi/linux/vhost.h > @@ -144,4 +144,8 @@ > > /* Set...