search for: sg_set_page

Displaying 20 results from an estimated 135 matches for "sg_set_page".

2013 Jun 24
3
[konrad.wilk@oracle.com: [PATCH] drm/i915: make compact dma scatter lists creation work with SWIOTLB backend.]
.../drivers/gpu/drm/i915/i915_gem.c @@ -1801,7 +1801,14 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) gfp |= __GFP_NORETRY | __GFP_NOWARN | __GFP_NO_KSWAPD; gfp &= ~(__GFP_IO | __GFP_WAIT); } - +#ifdef CONFIG_SWIOTLB + if (swiotlb_nr_tbl()) { + st->nents++; + sg_set_page(sg, page, PAGE_SIZE, 0); + sg = sg_next(sg); + continue; + } +#endif if (!i || page_to_pfn(page) != last_pfn + 1) { if (i) sg = sg_next(sg); @@ -1812,8 +1819,10 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) } last_pfn = page_to_pfn(page); } - - sg_mark_e...
2014 Sep 05
2
[PATCH 1/3] virtio_net: pass well-formed sgs to virtqueue_add_*()
...patch can be accepted to net/core/skbuff.c, the sg_init_table in virtnet_alloc_queues will suffice. Paolo -------------------- 8< ------------------- From: Paolo Bonzini <pbonzini at redhat.com> Subject: [PATCH] net: skb_to_sgvec: do not leave intermediate marks in the sgvec sg_set_buf/sg_set_page will leave the end mark in place in their argument, which may be in the middle of a scatterlist. If we remove the mark before calling them, we can avoid calls to sg_init_table before skb_to_sgvec. However, users of skb_to_sgvec_nomark now need to be careful and possibly restore the mark. Signed-...
2014 Sep 05
2
[PATCH 1/3] virtio_net: pass well-formed sgs to virtqueue_add_*()
...patch can be accepted to net/core/skbuff.c, the sg_init_table in virtnet_alloc_queues will suffice. Paolo -------------------- 8< ------------------- From: Paolo Bonzini <pbonzini at redhat.com> Subject: [PATCH] net: skb_to_sgvec: do not leave intermediate marks in the sgvec sg_set_buf/sg_set_page will leave the end mark in place in their argument, which may be in the middle of a scatterlist. If we remove the mark before calling them, we can avoid calls to sg_init_table before skb_to_sgvec. However, users of skb_to_sgvec_nomark now need to be careful and possibly restore the mark. Signed-...
2018 Apr 20
2
[PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM
...offset_in_page(sg_addr); else sg_addr = __pa(sg_addr); and videobuf: pg = vmalloc_to_page(virt); if (NULL == pg) goto err; BUG_ON(page_to_pfn(pg) >= (1 << (32 - PAGE_SHIFT))); sg_set_page(&sglist[i], pg, PAGE_SIZE, 0); Yes, there's the potential that we have to produce two SG entries for a virtually contiguous region if it crosses a page boundary, and our APIs aren't set up right to make it happen. But this is something we should consider fixing ... otherwise we'll...
2018 Apr 20
2
[PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM
...offset_in_page(sg_addr); else sg_addr = __pa(sg_addr); and videobuf: pg = vmalloc_to_page(virt); if (NULL == pg) goto err; BUG_ON(page_to_pfn(pg) >= (1 << (32 - PAGE_SHIFT))); sg_set_page(&sglist[i], pg, PAGE_SIZE, 0); Yes, there's the potential that we have to produce two SG entries for a virtually contiguous region if it crosses a page boundary, and our APIs aren't set up right to make it happen. But this is something we should consider fixing ... otherwise we'll...
2014 Sep 07
0
[PATCH 1/3] virtio_net: pass well-formed sgs to virtqueue_add_*()
...ve to post it to netdev as a new topic and Cc Dave Miller for it to be considered. > -------------------- 8< ------------------- > From: Paolo Bonzini <pbonzini at redhat.com> > Subject: [PATCH] net: skb_to_sgvec: do not leave intermediate marks in the sgvec > > sg_set_buf/sg_set_page will leave the end mark in place in their > argument, which may be in the middle of a scatterlist. If we > remove the mark before calling them, we can avoid calls to > sg_init_table before skb_to_sgvec. > > However, users of skb_to_sgvec_nomark now need to be careful and > possi...
2019 Sep 05
2
[PATCH v2] drm/virtio: Use vmalloc for command buffer allocations.
..._table(sgt, nents, GFP_KERNEL); + if (ret) { + kfree(sgt); + return NULL; + } + + for_each_sg(sgt->sgl, sg, nents, i) { + pg = vmalloc_to_page(data); + if (!pg) { + sg_free_table(sgt); + kfree(sgt); + return NULL; + } + + s = rest_of_page(data); + if (s > size) + s = size; + + sg_set_page(sg, pg, s, offset_in_page(data)); + + size -= s; + data += s; + *sg_ents += 1; + + if (size) { + sg_unmark_end(sg); + } else { + sg_mark_end(sg); + break; + } + } + + return sgt; +} + static int virtio_gpu_queue_ctrl_buffer_locked(struct virtio_gpu_device *vgdev, - struct vi...
2019 Sep 05
2
[PATCH v2] drm/virtio: Use vmalloc for command buffer allocations.
..._table(sgt, nents, GFP_KERNEL); + if (ret) { + kfree(sgt); + return NULL; + } + + for_each_sg(sgt->sgl, sg, nents, i) { + pg = vmalloc_to_page(data); + if (!pg) { + sg_free_table(sgt); + kfree(sgt); + return NULL; + } + + s = rest_of_page(data); + if (s > size) + s = size; + + sg_set_page(sg, pg, s, offset_in_page(data)); + + size -= s; + data += s; + *sg_ents += 1; + + if (size) { + sg_unmark_end(sg); + } else { + sg_mark_end(sg); + break; + } + } + + return sgt; +} + static int virtio_gpu_queue_ctrl_buffer_locked(struct virtio_gpu_device *vgdev, - struct vi...
2017 Nov 30
1
[PATCH v18 06/10] virtio_ring: add a new API, virtqueue_add_one_desc
...gt; > Signed-off-by: Wei Wang <wei.w.wang at intel.com> > Cc: Michael S. Tsirkin <mst at redhat.com> You previously managed without this patch, and it's preferable IMHO since this patchset is already too big. I don't really understand what is wrong with virtio_add_sgs + sg_set_page. I don't think is assumes a kaddr. > --- > drivers/virtio/virtio_ring.c | 94 +++++++++++++++++++++++++++++++++++--------- > include/linux/virtio.h | 6 +++ > 2 files changed, 81 insertions(+), 19 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/v...
2017 Nov 30
1
[PATCH v18 06/10] virtio_ring: add a new API, virtqueue_add_one_desc
...gt; > Signed-off-by: Wei Wang <wei.w.wang at intel.com> > Cc: Michael S. Tsirkin <mst at redhat.com> You previously managed without this patch, and it's preferable IMHO since this patchset is already too big. I don't really understand what is wrong with virtio_add_sgs + sg_set_page. I don't think is assumes a kaddr. > --- > drivers/virtio/virtio_ring.c | 94 +++++++++++++++++++++++++++++++++++--------- > include/linux/virtio.h | 6 +++ > 2 files changed, 81 insertions(+), 19 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/v...
2018 Apr 04
2
[PATCH v30 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...2:10:03AM +0800, Wei Wang wrote: > > > +static int add_one_sg(struct virtqueue *vq, unsigned long pfn, uint32_t len) > > > +{ > > > + struct scatterlist sg; > > > + unsigned int unused; > > > + > > > + sg_init_table(&sg, 1); > > > + sg_set_page(&sg, pfn_to_page(pfn), len, 0); > > > + > > > + /* Detach all the used buffers from the vq */ > > > + while (virtqueue_get_buf(vq, &unused)) > > > + ; > > > + > > > + /* > > > + * Since this is an optimization feature, losing...
2018 Apr 04
2
[PATCH v30 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...2:10:03AM +0800, Wei Wang wrote: > > > +static int add_one_sg(struct virtqueue *vq, unsigned long pfn, uint32_t len) > > > +{ > > > + struct scatterlist sg; > > > + unsigned int unused; > > > + > > > + sg_init_table(&sg, 1); > > > + sg_set_page(&sg, pfn_to_page(pfn), len, 0); > > > + > > > + /* Detach all the used buffers from the vq */ > > > + while (virtqueue_get_buf(vq, &unused)) > > > + ; > > > + > > > + /* > > > + * Since this is an optimization feature, losing...
2013 Mar 27
0
[PATCH 04/22] block: Convert bio_for_each_segment() to bvec_iter
...ent; - if (!BIOVEC_PHYS_MERGEABLE(*bvprv, bvec)) + if (!BIOVEC_PHYS_MERGEABLE(bvprv, bvec)) goto new_segment; - if (!BIOVEC_SEG_BOUNDARY(q, *bvprv, bvec)) + if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bvec)) goto new_segment; (*sg)->length += nbytes; @@ -150,7 +151,7 @@ new_segment: sg_set_page(*sg, bvec->bv_page, nbytes, bvec->bv_offset); (*nsegs)++; } - *bvprv = bvec; + *bvprv = *bvec; } /* @@ -160,7 +161,7 @@ new_segment: int blk_rq_map_sg(struct request_queue *q, struct request *rq, struct scatterlist *sglist) { - struct bio_vec *bvec, *bvprv; + struct bio_vec bv...
2013 Mar 27
0
[PATCH 04/22] block: Convert bio_for_each_segment() to bvec_iter
...ent; - if (!BIOVEC_PHYS_MERGEABLE(*bvprv, bvec)) + if (!BIOVEC_PHYS_MERGEABLE(bvprv, bvec)) goto new_segment; - if (!BIOVEC_SEG_BOUNDARY(q, *bvprv, bvec)) + if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bvec)) goto new_segment; (*sg)->length += nbytes; @@ -150,7 +151,7 @@ new_segment: sg_set_page(*sg, bvec->bv_page, nbytes, bvec->bv_offset); (*nsegs)++; } - *bvprv = bvec; + *bvprv = *bvec; } /* @@ -160,7 +161,7 @@ new_segment: int blk_rq_map_sg(struct request_queue *q, struct request *rq, struct scatterlist *sglist) { - struct bio_vec *bvec, *bvprv; + struct bio_vec bv...
2018 Apr 03
2
[PATCH v30 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...> + vb->free_page_vq = vqs[VIRTIO_BALLOON_VQ_FREE_PAGE]; > + > return 0; > } > > +static int add_one_sg(struct virtqueue *vq, unsigned long pfn, uint32_t len) > +{ > + struct scatterlist sg; > + unsigned int unused; > + > + sg_init_table(&sg, 1); > + sg_set_page(&sg, pfn_to_page(pfn), len, 0); > + > + /* Detach all the used buffers from the vq */ > + while (virtqueue_get_buf(vq, &unused)) > + ; > + > + /* > + * Since this is an optimization feature, losing a couple of free > + * pages to report isn't important. We sim...
2018 Apr 03
2
[PATCH v30 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...> + vb->free_page_vq = vqs[VIRTIO_BALLOON_VQ_FREE_PAGE]; > + > return 0; > } > > +static int add_one_sg(struct virtqueue *vq, unsigned long pfn, uint32_t len) > +{ > + struct scatterlist sg; > + unsigned int unused; > + > + sg_init_table(&sg, 1); > + sg_set_page(&sg, pfn_to_page(pfn), len, 0); > + > + /* Detach all the used buffers from the vq */ > + while (virtqueue_get_buf(vq, &unused)) > + ; > + > + /* > + * Since this is an optimization feature, losing a couple of free > + * pages to report isn't important. We sim...
2013 Jun 09
0
[PATCH 06/26] block: Convert bio_for_each_segment() to bvec_iter
...ent; - if (!BIOVEC_PHYS_MERGEABLE(*bvprv, bvec)) + if (!BIOVEC_PHYS_MERGEABLE(bvprv, bvec)) goto new_segment; - if (!BIOVEC_SEG_BOUNDARY(q, *bvprv, bvec)) + if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bvec)) goto new_segment; (*sg)->length += nbytes; @@ -150,7 +151,7 @@ new_segment: sg_set_page(*sg, bvec->bv_page, nbytes, bvec->bv_offset); (*nsegs)++; } - *bvprv = bvec; + *bvprv = *bvec; } /* @@ -160,7 +161,7 @@ new_segment: int blk_rq_map_sg(struct request_queue *q, struct request *rq, struct scatterlist *sglist) { - struct bio_vec *bvec, *bvprv; + struct bio_vec bv...
2013 Jun 09
0
[PATCH 06/26] block: Convert bio_for_each_segment() to bvec_iter
...ent; - if (!BIOVEC_PHYS_MERGEABLE(*bvprv, bvec)) + if (!BIOVEC_PHYS_MERGEABLE(bvprv, bvec)) goto new_segment; - if (!BIOVEC_SEG_BOUNDARY(q, *bvprv, bvec)) + if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bvec)) goto new_segment; (*sg)->length += nbytes; @@ -150,7 +151,7 @@ new_segment: sg_set_page(*sg, bvec->bv_page, nbytes, bvec->bv_offset); (*nsegs)++; } - *bvprv = bvec; + *bvprv = *bvec; } /* @@ -160,7 +161,7 @@ new_segment: int blk_rq_map_sg(struct request_queue *q, struct request *rq, struct scatterlist *sglist) { - struct bio_vec *bvec, *bvprv; + struct bio_vec bv...
2013 Jun 09
0
[PATCH 06/26] block: Convert bio_for_each_segment() to bvec_iter
...ent; - if (!BIOVEC_PHYS_MERGEABLE(*bvprv, bvec)) + if (!BIOVEC_PHYS_MERGEABLE(bvprv, bvec)) goto new_segment; - if (!BIOVEC_SEG_BOUNDARY(q, *bvprv, bvec)) + if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bvec)) goto new_segment; (*sg)->length += nbytes; @@ -150,7 +151,7 @@ new_segment: sg_set_page(*sg, bvec->bv_page, nbytes, bvec->bv_offset); (*nsegs)++; } - *bvprv = bvec; + *bvprv = *bvec; } /* @@ -160,7 +161,7 @@ new_segment: int blk_rq_map_sg(struct request_queue *q, struct request *rq, struct scatterlist *sglist) { - struct bio_vec *bvec, *bvprv; + struct bio_vec bv...
2023 Jul 09
4
[PATCH v2 0/2] vhost-scsi: Fix IO hangs when using windows
The following patches were made over Linus's tree and fix an issue where windows guests will send iovecs with offset/lengths that result in IOs that are not aligned to 512. The LIO layer will then send them to Linux's FS/block layer but it requires 512 byte alignment, so depending on the FS/block driver being used we will get IO errors or hung IO. The following patches have vhost-scsi