search for: vhost_umem_interval_tree_iter_first

Displaying 20 results from an estimated 31 matches for "vhost_umem_interval_tree_iter_first".

2019 Oct 03
1
[PATCH 07/11] vhost: convert vhost_umem_interval_tree to half closed intervals
...{ const struct vhost_umem_node *node; struct vhost_umem *umem = vq->iotlb; - u64 s = 0, size, orig_addr = addr, last = addr + len - 1; + u64 s = 0, size, orig_addr = addr, last = addr + len; if (vhost_vq_meta_fetch(vq, addr, len, type)) return true; 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)...
2020 Feb 20
0
[PATCH V3 1/5] vhost: factor out IOTLB
..._add_tail(&node->link, &umem->umem_list); - vhost_umem_interval_tree_insert(node, &umem->umem_tree); - umem->numem++; - - return 0; -} - -static void vhost_del_umem_range(struct vhost_umem *umem, - u64 start, u64 end) -{ - struct vhost_umem_node *node; - - while ((node = vhost_umem_interval_tree_iter_first(&umem->umem_tree, - start, end))) - vhost_umem_free(umem, node); -} - static void vhost_iotlb_notify_vq(struct vhost_dev *d, struct vhost_iotlb_msg *msg) { @@ -1117,9 +1053,9 @@ static int vhost_process_iotlb_msg(struct vhost_dev *dev, break; } vhost_vq_meta_rese...
2018 Dec 10
1
[PATCH net 4/4] vhost: log dirty page correctly
...c Complexity 1 drivers//vhost/vhost.c:vhost_umem_interval_tree_augment_rotate Cyclomatic Complexity 1 drivers//vhost/vhost.c:vhost_umem_interval_tree_remove Cyclomatic Complexity 7 drivers//vhost/vhost.c:vhost_umem_interval_tree_subtree_search Cyclomatic Complexity 4 drivers//vhost/vhost.c:vhost_umem_interval_tree_iter_first Cyclomatic Complexity 1 drivers//vhost/vhost.c:vhost_disable_cross_endian Cyclomatic Complexity 1 drivers//vhost/vhost.c:vhost_enable_cross_endian_big Cyclomatic Complexity 1 drivers//vhost/vhost.c:vhost_enable_cross_endian_little Cyclomatic Complexity 5 drivers//vhost/vhost.c:vhost_set...
2016 Jun 22
0
[PATCH 3/3] vhost: device IOTLB API
..._add_tail(&node->link, &umem->umem_list); + vhost_umem_interval_tree_insert(node, &umem->umem_tree); + umem->numem++; + + return 0; +} + +static void vhost_del_umem_range(struct vhost_umem *umem, + u64 start, u64 end) +{ + struct vhost_umem_node *node; + + while ((node = vhost_umem_interval_tree_iter_first(&umem->umem_tree, + start, end))) + vhost_umem_free(umem, node); +} + +static void vhost_iotlb_notify_vq(struct vhost_dev *d, + struct vhost_iotlb_msg *msg) +{ + struct vhost_msg_node *node, *n; + + spin_lock(&d->iotlb_lock); + + list_for_each_entry_safe(node, n, &d...
2016 Mar 25
4
[RFC PATCH V2 0/2] basic device IOTLB support
This patch tries to implement an device IOTLB for vhost. This could be used with for co-operation with userspace(qemu) implementation of iommu for a secure DMA environment (DMAR) in guest. The idea is simple. When vhost meets an IOTLB miss, it will request the assistance of userspace to do the translation, this is done through: - Fill the translation request in a preset userspace address (This
2016 Mar 25
4
[RFC PATCH V2 0/2] basic device IOTLB support
This patch tries to implement an device IOTLB for vhost. This could be used with for co-operation with userspace(qemu) implementation of iommu for a secure DMA environment (DMAR) in guest. The idea is simple. When vhost meets an IOTLB miss, it will request the assistance of userspace to do the translation, this is done through: - Fill the translation request in a preset userspace address (This
2016 Mar 25
0
[RFC PATCH V2 2/2] vhost: device IOTLB API
..._add_tail(&node->link, &umem->umem_list); + vhost_umem_interval_tree_insert(node, &umem->umem_tree); + umem->numem++; + + return 0; +} + +static void vhost_del_umem_range(struct vhost_umem *umem, + u64 start, u64 end) +{ + struct vhost_umem_node *node; + + while ((node = vhost_umem_interval_tree_iter_first(&umem->umem_tree, + start, end))) + vhost_umem_free(umem, node); +} + +static struct vhost_umem *vhost_umem_alloc(void) +{ + struct vhost_umem *umem = vhost_kvzalloc(sizeof(*umem)); + + if (!umem) + return NULL; + + umem->umem_tree = RB_ROOT; + umem->numem = 0; + INIT_LIST_H...
2019 Sep 11
0
[vhost:linux-next 8/9] drivers/vhost/vhost.c:2076:5: note: in expansion of macro 'array_index_nospec'
...= dev->iotlb ? dev->iotlb : dev->umem; 2046 struct iovec *_iov; 2047 u64 s = 0; 2048 int ret = 0; 2049 2050 while ((u64)len > s) { 2051 u64 size; 2052 if (unlikely(ret >= iov_size)) { 2053 ret = -ENOBUFS; 2054 break; 2055 } 2056 2057 node = vhost_umem_interval_tree_iter_first(&umem->umem_tree, 2058 addr, addr + len - 1); 2059 if (node == NULL || node->start > addr) { 2060 if (umem != dev->iotlb) { 2061 ret = -EFAULT; 2062 break; 2063 } 2064 ret = -EAGAIN; 2065 break; 2066 } else if (!(node->perm & a...
2016 Jun 23
3
[PATCH V2 0/3] basic device IOTLB support for vhost_net
This patch tries to implement an device IOTLB for vhost. This could be used with for co-operation with userspace IOMMU implementation (qemu) for a secure DMA environment (DMAR) in guest. The idea is simple. When vhost meets an IOTLB miss, it will request the assistance of userspace to do the translation, this is done through: - when there's a IOTLB miss, it will notify userspace through
2016 Jun 23
3
[PATCH V2 0/3] basic device IOTLB support for vhost_net
This patch tries to implement an device IOTLB for vhost. This could be used with for co-operation with userspace IOMMU implementation (qemu) for a secure DMA environment (DMAR) in guest. The idea is simple. When vhost meets an IOTLB miss, it will request the assistance of userspace to do the translation, this is done through: - when there's a IOTLB miss, it will notify userspace through
2016 May 24
6
[RFC PATCH V3 0/3] basic device IOTLB support
This patch tries to implement an device IOTLB for vhost. This could be used with for co-operation with userspace IOMMU implementation (qemu) for a secure DMA environment (DMAR) in guest. The idea is simple. When vhost meets an IOTLB miss, it will request the assistance of userspace to do the translation, this is done through: - when there's a IOTLB miss, it will notify userspace through
2016 May 24
6
[RFC PATCH V3 0/3] basic device IOTLB support
This patch tries to implement an device IOTLB for vhost. This could be used with for co-operation with userspace IOMMU implementation (qemu) for a secure DMA environment (DMAR) in guest. The idea is simple. When vhost meets an IOTLB miss, it will request the assistance of userspace to do the translation, this is done through: - when there's a IOTLB miss, it will notify userspace through
2016 Jun 22
4
[PATCH 0/3] basic device IOTLB support
This patch tries to implement an device IOTLB for vhost. This could be used with for co-operation with userspace IOMMU implementation (qemu) for a secure DMA environment (DMAR) in guest. The idea is simple. When vhost meets an IOTLB miss, it will request the assistance of userspace to do the translation, this is done through: - when there's a IOTLB miss, it will notify userspace through
2016 Jun 22
4
[PATCH 0/3] basic device IOTLB support
This patch tries to implement an device IOTLB for vhost. This could be used with for co-operation with userspace IOMMU implementation (qemu) for a secure DMA environment (DMAR) in guest. The idea is simple. When vhost meets an IOTLB miss, it will request the assistance of userspace to do the translation, this is done through: - when there's a IOTLB miss, it will notify userspace through
2016 Jan 18
2
[PATCH RFC] vhost: convert pre sorted vhost memory array to interval tree
...uct vhost_umem *umem = vq->umem; struct iovec *_iov; u64 s = 0; int ret = 0; - mem = vq->memory; while ((u64)len > s) { u64 size; if (unlikely(ret >= iov_size)) { ret = -ENOBUFS; break; } - reg = find_region(mem, addr, len); - if (unlikely(!reg)) { + node = vhost_umem_interval_tree_iter_first(&umem->umem_tree, + addr, addr + len - 1); + if (node == NULL || node->start > addr) { ret = -EFAULT; break; } _iov = iov + ret; - size = reg->memory_size - addr + reg->guest_phys_addr; + size = node->size - addr + node->start; _iov->iov_len = m...
2016 Jan 18
2
[PATCH RFC] vhost: convert pre sorted vhost memory array to interval tree
...uct vhost_umem *umem = vq->umem; struct iovec *_iov; u64 s = 0; int ret = 0; - mem = vq->memory; while ((u64)len > s) { u64 size; if (unlikely(ret >= iov_size)) { ret = -ENOBUFS; break; } - reg = find_region(mem, addr, len); - if (unlikely(!reg)) { + node = vhost_umem_interval_tree_iter_first(&umem->umem_tree, + addr, addr + len - 1); + if (node == NULL || node->start > addr) { ret = -EFAULT; break; } _iov = iov + ret; - size = reg->memory_size - addr + reg->guest_phys_addr; + size = node->size - addr + node->start; _iov->iov_len = m...
2016 Apr 27
2
[RFC PATCH V2 2/2] vhost: device IOTLB API
...+ vhost_umem_interval_tree_insert(node, &umem->umem_tree); > + umem->numem++; > + > + return 0; > +} > + > +static void vhost_del_umem_range(struct vhost_umem *umem, > + u64 start, u64 end) > +{ > + struct vhost_umem_node *node; > + > + while ((node = vhost_umem_interval_tree_iter_first(&umem->umem_tree, > + start, end))) > + vhost_umem_free(umem, node); > +} > + > +static struct vhost_umem *vhost_umem_alloc(void) > +{ > + struct vhost_umem *umem = vhost_kvzalloc(sizeof(*umem)); > + > + if (!umem) > + return NULL; > + > + umem-...
2016 Apr 27
2
[RFC PATCH V2 2/2] vhost: device IOTLB API
...+ vhost_umem_interval_tree_insert(node, &umem->umem_tree); > + umem->numem++; > + > + return 0; > +} > + > +static void vhost_del_umem_range(struct vhost_umem *umem, > + u64 start, u64 end) > +{ > + struct vhost_umem_node *node; > + > + while ((node = vhost_umem_interval_tree_iter_first(&umem->umem_tree, > + start, end))) > + vhost_umem_free(umem, node); > +} > + > +static struct vhost_umem *vhost_umem_alloc(void) > +{ > + struct vhost_umem *umem = vhost_kvzalloc(sizeof(*umem)); > + > + if (!umem) > + return NULL; > + > + umem-...
2016 Dec 14
1
[PATCH V2] vhost: introduce O(1) vq metadata cache
...r, u64 len) + int access, u64 addr, u64 len, int type) { const struct vhost_umem_node *node; struct vhost_umem *umem = vq->iotlb; - u64 s = 0, size; + u64 s = 0, size, orig_addr = addr; + + if (vhost_vq_meta_fetch(vq, addr, len, type)) + return true; while (len > s) { node = vhost_umem_interval_tree_iter_first(&umem->umem_tree, @@ -1124,6 +1202,10 @@ static int iotlb_access_ok(struct vhost_virtqueue *vq, } size = node->size - addr + node->start; + + if (orig_addr == addr && size >= len) + vhost_vq_meta_update(vq, node, type); + s += size; addr += size; } @@ -114...
2016 Dec 14
1
[PATCH V2] vhost: introduce O(1) vq metadata cache
...r, u64 len) + int access, u64 addr, u64 len, int type) { const struct vhost_umem_node *node; struct vhost_umem *umem = vq->iotlb; - u64 s = 0, size; + u64 s = 0, size, orig_addr = addr; + + if (vhost_vq_meta_fetch(vq, addr, len, type)) + return true; while (len > s) { node = vhost_umem_interval_tree_iter_first(&umem->umem_tree, @@ -1124,6 +1202,10 @@ static int iotlb_access_ok(struct vhost_virtqueue *vq, } size = node->size - addr + node->start; + + if (orig_addr == addr && size >= len) + vhost_vq_meta_update(vq, node, type); + s += size; addr += size; } @@ -114...