search for: virtqueue_add_chain

Displaying 15 results from an estimated 15 matches for "virtqueue_add_chain".

2017 Jul 12
0
[PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG
...e_xb, sg_pfn_start, + page_xb_end, 1); + if (sg_pfn_start == page_xb_end + 1) + break; + sg_pfn_end = xb_find_next_bit(&vb->page_xb, sg_pfn_start + 1, + page_xb_end, 0); + sg_addr = sg_pfn_start << PAGE_SHIFT; + sg_size = (sg_pfn_end - sg_pfn_start) * PAGE_SIZE; + virtqueue_add_chain_desc(vq, sg_addr, sg_size, &head_id, + &prev_id, 0); + xb_zero(&vb->page_xb, sg_pfn_start, sg_pfn_end); + sg_pfn_start = sg_pfn_end + 1; + } + + if (head_id != VIRTQUEUE_DESC_ID_INIT) { + virtqueue_add_chain(vq, head_id, 0, NULL, vb, NULL); + virtqueue_kick_async(vq, vb->...
2017 Jul 12
2
[PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG
...> > @@ -57,8 +57,28 @@ int virtqueue_add_sgs(struct virtqueue *vq, > > > void *data, > > > gfp_t gfp); > > > +/* A desc with this init id is treated as an invalid desc */ > > > +#define VIRTQUEUE_DESC_ID_INIT UINT_MAX > > > +int virtqueue_add_chain_desc(struct virtqueue *_vq, > > > + uint64_t addr, > > > + uint32_t len, > > > + unsigned int *head_id, > > > + unsigned int *prev_id, > > > + bool in); > > > + > > > +int virtqueue_add_chain(struct vi...
2017 Jul 12
2
[PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG
...> > @@ -57,8 +57,28 @@ int virtqueue_add_sgs(struct virtqueue *vq, > > > void *data, > > > gfp_t gfp); > > > +/* A desc with this init id is treated as an invalid desc */ > > > +#define VIRTQUEUE_DESC_ID_INIT UINT_MAX > > > +int virtqueue_add_chain_desc(struct virtqueue *_vq, > > > + uint64_t addr, > > > + uint32_t len, > > > + unsigned int *head_id, > > > + unsigned int *prev_id, > > > + bool in); > > > + > > > +int virtqueue_add_chain(struct vi...
2017 Jul 12
19
[PATCH v12 0/8] Virtio-balloon Enhancement
This patch series enhances the existing virtio-balloon with the following new features: 1) fast ballooning: transfer ballooned pages between the guest and host in chunks using sgs, instead of one by one; and 2) cmdq: a new virtqueue to send commands between the device and driver. Currently, it supports commands to report memory stats (replace the old statq mechanism) and report guest unused pages.
2017 Jul 12
19
[PATCH v12 0/8] Virtio-balloon Enhancement
This patch series enhances the existing virtio-balloon with the following new features: 1) fast ballooning: transfer ballooned pages between the guest and host in chunks using sgs, instead of one by one; and 2) cmdq: a new virtqueue to send commands between the device and driver. Currently, it supports commands to report memory stats (replace the old statq mechanism) and report guest unused pages.
2017 Jul 12
2
[PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG
.../linux/virtio.h > +++ b/include/linux/virtio.h > @@ -57,8 +57,28 @@ int virtqueue_add_sgs(struct virtqueue *vq, > void *data, > gfp_t gfp); > > +/* A desc with this init id is treated as an invalid desc */ > +#define VIRTQUEUE_DESC_ID_INIT UINT_MAX > +int virtqueue_add_chain_desc(struct virtqueue *_vq, > + uint64_t addr, > + uint32_t len, > + unsigned int *head_id, > + unsigned int *prev_id, > + bool in); > + > +int virtqueue_add_chain(struct virtqueue *_vq, > + unsigned int head, > + bool indirect, >...
2017 Jul 12
2
[PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG
.../linux/virtio.h > +++ b/include/linux/virtio.h > @@ -57,8 +57,28 @@ int virtqueue_add_sgs(struct virtqueue *vq, > void *data, > gfp_t gfp); > > +/* A desc with this init id is treated as an invalid desc */ > +#define VIRTQUEUE_DESC_ID_INIT UINT_MAX > +int virtqueue_add_chain_desc(struct virtqueue *_vq, > + uint64_t addr, > + uint32_t len, > + unsigned int *head_id, > + unsigned int *prev_id, > + bool in); > + > +int virtqueue_add_chain(struct virtqueue *_vq, > + unsigned int head, > + bool indirect, >...
2017 Jul 13
0
[PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG
...gt; note how kick_sync can fail but your code never checks return code > - need to re-write the last descriptor - might not work > for alternative layouts which always expose descriptors > immediately Probably it wasn't clear. Please let me explain the two functions here: 1) virtqueue_add_chain_desc(vq, head_id, prev_id,..): grabs a desc from the vq and inserts it to the chain tail (which is indexed by prev_id, probably better to call it tail_id). Then, the new added desc becomes the tail (i.e. the last desc). The _F_NEXT flag is cleared for each desc when it's added to the chain,...
2017 Jul 13
2
[PATCH v12 8/8] virtio-balloon: VIRTIO_BALLOON_F_CMD_VQ
...m_freezable_wq, work); > } > > +static unsigned int cmdq_hdr_add(struct virtqueue *vq, > + struct virtio_balloon_cmdq_hdr *hdr, > + bool in) > +{ > + unsigned int id = VIRTQUEUE_DESC_ID_INIT; > + uint64_t hdr_pa = (uint64_t)virt_to_phys((void *)hdr); > + > + virtqueue_add_chain_desc(vq, hdr_pa, sizeof(*hdr), &id, &id, in); > + > + /* Deliver the hdr for the host to send commands. */ > + if (in) { > + hdr->flags = 0; > + virtqueue_add_chain(vq, id, 0, NULL, hdr, NULL); > + virtqueue_kick(vq); > + } > + > + return id; > +} > +...
2017 Jul 13
2
[PATCH v12 8/8] virtio-balloon: VIRTIO_BALLOON_F_CMD_VQ
...m_freezable_wq, work); > } > > +static unsigned int cmdq_hdr_add(struct virtqueue *vq, > + struct virtio_balloon_cmdq_hdr *hdr, > + bool in) > +{ > + unsigned int id = VIRTQUEUE_DESC_ID_INIT; > + uint64_t hdr_pa = (uint64_t)virt_to_phys((void *)hdr); > + > + virtqueue_add_chain_desc(vq, hdr_pa, sizeof(*hdr), &id, &id, in); > + > + /* Deliver the hdr for the host to send commands. */ > + if (in) { > + hdr->flags = 0; > + virtqueue_add_chain(vq, id, 0, NULL, hdr, NULL); > + virtqueue_kick(vq); > + } > + > + return id; > +} > +...
2017 Jul 12
0
[PATCH v12 8/8] virtio-balloon: VIRTIO_BALLOON_F_CMD_VQ
...func(struct work_struct *work) queue_work(system_freezable_wq, work); } +static unsigned int cmdq_hdr_add(struct virtqueue *vq, + struct virtio_balloon_cmdq_hdr *hdr, + bool in) +{ + unsigned int id = VIRTQUEUE_DESC_ID_INIT; + uint64_t hdr_pa = (uint64_t)virt_to_phys((void *)hdr); + + virtqueue_add_chain_desc(vq, hdr_pa, sizeof(*hdr), &id, &id, in); + + /* Deliver the hdr for the host to send commands. */ + if (in) { + hdr->flags = 0; + virtqueue_add_chain(vq, id, 0, NULL, hdr, NULL); + virtqueue_kick(vq); + } + + return id; +} + +static void cmdq_add_chain_desc(struct virtio_balloon...
2017 Jul 13
2
[PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG
...but your code never checks return code > > - need to re-write the last descriptor - might not work > > for alternative layouts which always expose descriptors > > immediately > > Probably it wasn't clear. Please let me explain the two functions here: > > 1) virtqueue_add_chain_desc(vq, head_id, prev_id,..): > grabs a desc from the vq and inserts it to the chain tail (which is indexed > by > prev_id, probably better to call it tail_id). Then, the new added desc > becomes > the tail (i.e. the last desc). The _F_NEXT flag is cleared for each desc > when it...
2017 Jul 13
2
[PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG
...but your code never checks return code > > - need to re-write the last descriptor - might not work > > for alternative layouts which always expose descriptors > > immediately > > Probably it wasn't clear. Please let me explain the two functions here: > > 1) virtqueue_add_chain_desc(vq, head_id, prev_id,..): > grabs a desc from the vq and inserts it to the chain tail (which is indexed > by > prev_id, probably better to call it tail_id). Then, the new added desc > becomes > the tail (i.e. the last desc). The _F_NEXT flag is cleared for each desc > when it...
2017 Jul 12
0
[PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG
...ude/linux/virtio.h >> @@ -57,8 +57,28 @@ int virtqueue_add_sgs(struct virtqueue *vq, >> void *data, >> gfp_t gfp); >> >> +/* A desc with this init id is treated as an invalid desc */ >> +#define VIRTQUEUE_DESC_ID_INIT UINT_MAX >> +int virtqueue_add_chain_desc(struct virtqueue *_vq, >> + uint64_t addr, >> + uint32_t len, >> + unsigned int *head_id, >> + unsigned int *prev_id, >> + bool in); >> + >> +int virtqueue_add_chain(struct virtqueue *_vq, >> + unsigned int he...
2017 Jul 13
0
[PATCH v12 8/8] virtio-balloon: VIRTIO_BALLOON_F_CMD_VQ
...t; >> +static unsigned int cmdq_hdr_add(struct virtqueue *vq, >> + struct virtio_balloon_cmdq_hdr *hdr, >> + bool in) >> +{ >> + unsigned int id = VIRTQUEUE_DESC_ID_INIT; >> + uint64_t hdr_pa = (uint64_t)virt_to_phys((void *)hdr); >> + >> + virtqueue_add_chain_desc(vq, hdr_pa, sizeof(*hdr), &id, &id, in); >> + >> + /* Deliver the hdr for the host to send commands. */ >> + if (in) { >> + hdr->flags = 0; >> + virtqueue_add_chain(vq, id, 0, NULL, hdr, NULL); >> + virtqueue_kick(vq); >> + } >> + &...