Displaying 20 results from an estimated 107 matches for "vhost_set_memory".
2013 Apr 03
1
[PATCH] vhost: Add vhost_commit callback for SeaBIOS ROM region re-mapping
From: Nicholas Bellinger <nab at linux-iscsi.org>
This patch follows MST's recommendation to move checks for
vhost_verify_ring_mappings() -> cpu_physical_memory_map() operations
from MemoryListener->region_[add,del]() -> vhost_set_memory() into
final MemoryListener->commit() -> vhost_commit() callback.
It addresses the case where virtio-scsi vq ioport RAM re-mapping
to read-only SeaBIOS ROM triggers a cpu_physical_memory_map()
NIL MemoryRegionSection pointer failure.
Also save vhost_dev->mem_changed_[start,end]_addr valu...
2013 Apr 03
1
[PATCH] vhost: Add vhost_commit callback for SeaBIOS ROM region re-mapping
From: Nicholas Bellinger <nab at linux-iscsi.org>
This patch follows MST's recommendation to move checks for
vhost_verify_ring_mappings() -> cpu_physical_memory_map() operations
from MemoryListener->region_[add,del]() -> vhost_set_memory() into
final MemoryListener->commit() -> vhost_commit() callback.
It addresses the case where virtio-scsi vq ioport RAM re-mapping
to read-only SeaBIOS ROM triggers a cpu_physical_memory_map()
NIL MemoryRegionSection pointer failure.
Also save vhost_dev->mem_changed_[start,end]_addr valu...
2014 Jun 03
1
[PULL 2/2] vhost: replace rcu with mutex
On 06/03/2014 08:48 AM, Paolo Bonzini wrote:
> Il 02/06/2014 23:58, Eric Dumazet ha scritto:
>> This looks dubious
>>
>> What about using kfree_rcu() instead ?
>
> It would lead to unbound allocation from userspace.
>
>> translate_desc() still uses rcu_read_lock(), its not clear if the mutex
>> is really held.
>
> Yes, vhost_get_vq_desc must be
2014 Jun 03
1
[PULL 2/2] vhost: replace rcu with mutex
On 06/03/2014 08:48 AM, Paolo Bonzini wrote:
> Il 02/06/2014 23:58, Eric Dumazet ha scritto:
>> This looks dubious
>>
>> What about using kfree_rcu() instead ?
>
> It would lead to unbound allocation from userspace.
>
>> translate_desc() still uses rcu_read_lock(), its not clear if the mutex
>> is really held.
>
> Yes, vhost_get_vq_desc must be
2014 Jun 02
4
[PULL 2/2] vhost: replace rcu with mutex
...drivers/vhost/vhost.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 78987e4..1c05e60 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -593,6 +593,7 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
> {
> struct vhost_memory mem, *newmem, *oldmem;
> unsigned long size = offsetof(struct vhost_memory, regions);
> + int i;
>
> if (copy_from_user(&mem, m, size))
> return -EFAULT;
> @@ -619,7 +620,14 @@ stat...
2014 Jun 02
4
[PULL 2/2] vhost: replace rcu with mutex
...drivers/vhost/vhost.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 78987e4..1c05e60 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -593,6 +593,7 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
> {
> struct vhost_memory mem, *newmem, *oldmem;
> unsigned long size = offsetof(struct vhost_memory, regions);
> + int i;
>
> if (copy_from_user(&mem, m, size))
> return -EFAULT;
> @@ -619,7 +620,14 @@ stat...
2014 Jun 02
3
[PULL 0/2] vhost enhancements for 3.16
Reposting with actual patches included.
The following changes since commit 96b2e73c5471542cb9c622c4360716684f8797ed:
Revert "net/mlx4_en: Use affinity hint" (2014-06-02 00:18:48 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git vhost-next
for you to fetch changes up to 2ae76693b8bcabf370b981cd00c36cd41d33fabc:
vhost:
2014 Jun 02
3
[PULL 0/2] vhost enhancements for 3.16
Reposting with actual patches included.
The following changes since commit 96b2e73c5471542cb9c622c4360716684f8797ed:
Revert "net/mlx4_en: Use affinity hint" (2014-06-02 00:18:48 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git vhost-next
for you to fetch changes up to 2ae76693b8bcabf370b981cd00c36cd41d33fabc:
vhost:
2014 Jun 02
0
[PULL 2/2] vhost: replace rcu with mutex
...rkin <mst at redhat.com>
---
drivers/vhost/vhost.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 78987e4..1c05e60 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -593,6 +593,7 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
{
struct vhost_memory mem, *newmem, *oldmem;
unsigned long size = offsetof(struct vhost_memory, regions);
+ int i;
if (copy_from_user(&mem, m, size))
return -EFAULT;
@@ -619,7 +620,14 @@ static long vhost_set_memory(struct vhost_de...
2011 Jun 21
1
[PATCH 1/2] vhost: init used ring after backend was set
...e_vq(n, vq);
}
+ r = init_used(vq);
+ if (r)
+ goto err_vq;
+
mutex_unlock(&vq->mutex);
if (oldsock) {
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 2a10786..43a3fc6 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -578,15 +578,14 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
return 0;
}
-static int init_used(struct vhost_virtqueue *vq,
- struct vring_used __user *used)
+int init_used(struct vhost_virtqueue *vq)
{
- int r = put_user(vq->used_flags, &used->flags);
+ int r = put_user(vq->used_fla...
2011 Jun 21
1
[PATCH 1/2] vhost: init used ring after backend was set
...e_vq(n, vq);
}
+ r = init_used(vq);
+ if (r)
+ goto err_vq;
+
mutex_unlock(&vq->mutex);
if (oldsock) {
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 2a10786..43a3fc6 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -578,15 +578,14 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
return 0;
}
-static int init_used(struct vhost_virtqueue *vq,
- struct vring_used __user *used)
+int init_used(struct vhost_virtqueue *vq)
{
- int r = put_user(vq->used_flags, &used->flags);
+ int r = put_user(vq->used_fla...
2015 Apr 21
2
[PATCH v4 7/8] vhost: feature to set the vring endianness
...LEGACY
> > > + vq->user_be = !vq->is_le;
> > > +#endif
> >
> > add a wrapper for this too?
> >
>
> Will do.
>
> > > }
> > >
> > > static int vhost_worker(void *data)
> > > @@ -630,6 +634,53 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
> > > return 0;
> > > }
> > >
> > > +#ifdef CONFIG_VHOST_SET_ENDIAN_LEGACY
> > > +static long vhost_set_vring_big_endian(struct vhost_virtqueue *vq,
> > > + int __user *argp)
>...
2015 Apr 21
2
[PATCH v4 7/8] vhost: feature to set the vring endianness
...LEGACY
> > > + vq->user_be = !vq->is_le;
> > > +#endif
> >
> > add a wrapper for this too?
> >
>
> Will do.
>
> > > }
> > >
> > > static int vhost_worker(void *data)
> > > @@ -630,6 +634,53 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
> > > return 0;
> > > }
> > >
> > > +#ifdef CONFIG_VHOST_SET_ENDIAN_LEGACY
> > > +static long vhost_set_vring_big_endian(struct vhost_virtqueue *vq,
> > > + int __user *argp)
>...
2009 Dec 20
0
[PATCH 2/3] vhost: add access_ok checks
...d) &&
+ vq_memory_access_ok(vq, vq->dev->memory,
+ vhost_has_feature(vq->dev, VHOST_F_LOG_ALL)) &&
+ (!vq->log_used || log_access_ok(vq->log_base, vq->log_addr,
+ sizeof *vq->used +
+ vq->num * sizeof *vq->used->ring));
+}
+
static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
{
struct vhost_memory mem, *newmem, *oldmem;
@@ -247,6 +332,9 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
kfree(newmem);
return r;
}
+
+ if (!memory_access_ok(d, newmem, vhost_has_feature(d, VHOST...
2009 Dec 20
0
[PATCH 2/3] vhost: add access_ok checks
...d) &&
+ vq_memory_access_ok(vq, vq->dev->memory,
+ vhost_has_feature(vq->dev, VHOST_F_LOG_ALL)) &&
+ (!vq->log_used || log_access_ok(vq->log_base, vq->log_addr,
+ sizeof *vq->used +
+ vq->num * sizeof *vq->used->ring));
+}
+
static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
{
struct vhost_memory mem, *newmem, *oldmem;
@@ -247,6 +332,9 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
kfree(newmem);
return r;
}
+
+ if (!memory_access_ok(d, newmem, vhost_has_feature(d, VHOST...
2011 Jun 16
1
[PATCH] vhost: set dirty log when updating flags of used ring
....c | 26 ++++++++++++++++++++++----
drivers/vhost/vhost.h | 2 ++
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 2ab2912..7c46aed 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -573,8 +573,10 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
static int init_used(struct vhost_virtqueue *vq,
struct vring_used __user *used)
{
- int r = put_user(vq->used_flags, &used->flags);
+ int r;
+ vq->used = used;
+ r = vhost_update_used_flags(vq);
if (r)
return r;
re...
2011 Jun 16
1
[PATCH] vhost: set dirty log when updating flags of used ring
....c | 26 ++++++++++++++++++++++----
drivers/vhost/vhost.h | 2 ++
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 2ab2912..7c46aed 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -573,8 +573,10 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
static int init_used(struct vhost_virtqueue *vq,
struct vring_used __user *used)
{
- int r = put_user(vq->used_flags, &used->flags);
+ int r;
+ vq->used = used;
+ r = vhost_update_used_flags(vq);
if (r)
return r;
re...
2019 Oct 03
1
[PATCH 07/11] vhost: convert vhost_umem_interval_tree to half closed intervals
...;
while (len > s) {
node = vhost_umem_interval_tree_iter_first(&umem->umem_tree,
- addr,
- last);
+ addr, last);
if (node == NULL || node->start > addr) {
vhost_iotlb_miss(vq, addr, access);
return false;
@@ -1455,7 +1454,7 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
region->guest_phys_addr,
region->memory_size,
region->guest_phys_addr +
- region->memory_size - 1,
+ region->memory_size,
region->userspace_addr,
VHOST_ACCESS_RW))
goto err;
@@ -20...
2020 Feb 20
0
[PATCH V3 1/5] vhost: factor out IOTLB
...ss_ok);
-static struct vhost_umem *vhost_umem_alloc(void)
-{
- struct vhost_umem *umem = kvzalloc(sizeof(*umem), GFP_KERNEL);
-
- if (!umem)
- return NULL;
-
- umem->umem_tree = RB_ROOT_CACHED;
- umem->numem = 0;
- INIT_LIST_HEAD(&umem->umem_list);
-
- return umem;
-}
-
static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
{
struct vhost_memory mem, *newmem;
struct vhost_memory_region *region;
- struct vhost_umem *newumem, *oldumem;
+ struct vhost_iotlb *newumem, *oldumem;
unsigned long size = offsetof(struct vhost_memory, regions);
int i;
@@ -1448,7 +136...
2016 Jan 18
2
[PATCH RFC] vhost: convert pre sorted vhost memory array to interval tree
...t_phys_addr)
- return 1;
- if (r1->guest_phys_addr > r2->guest_phys_addr)
- return -1;
- return 0;
-}
-
-static void *vhost_kvzalloc(unsigned long size)
-{
- void *n = kzalloc(size, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT);
-
- if (!n)
- n = vzalloc(size);
- return n;
-}
-
static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
{
- struct vhost_memory mem, *newmem, *oldmem;
+ struct vhost_memory mem, *newmem;
+ struct vhost_memory_region *region;
+ struct vhost_umem_node *node;
+ struct vhost_umem *newumem, *oldumem;
unsigned long size = offsetof(struct vhost_memory,...