search for: send_cmd_id

Displaying 20 results from an estimated 49 matches for "send_cmd_id".

2018 Jan 25
2
[PATCH v25 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...ceived from host, stop > + * the reporting, and return 1 to indicate an active stop. > + */ > + if (virtio32_to_cpu(vb->vdev, vb->cmd_id_use) != vb->cmd_id_received) > + return 1; > + > + return add_one_sg(vb->free_page_vq, pfn, len); > +} > + > +static int send_cmd_id(struct virtio_balloon *vb, uint32_t cmd_id) > +{ > + struct scatterlist sg; > + struct virtqueue *vq = vb->free_page_vq; > + int ret; > + > + vb->cmd_id_use = cpu_to_virtio32(vb->vdev, cmd_id); > + sg_init_one(&sg, &vb->cmd_id_use, sizeof(vb->cmd_id_use))...
2018 Jan 25
2
[PATCH v24 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...*work) >> +{ >> + struct virtio_balloon *vb; >> + unsigned long flags; >> + >> + vb = container_of(work, struct virtio_balloon, report_free_page_work); >> + >> + /* Start by sending the obtained cmd id to the host with an outbuf */ >> + send_cmd_id(vb, &vb->start_cmd_id); >> + >> + /* >> + * Set start_cmd_id to VIRTIO_BALLOON_FREE_PAGE_REPORT_STOP_ID to >> + * indicate a new request can be queued. >> + */ >> + spin_lock_irqsave(&vb->stop_update_lock, flags); >> + vb-...
2018 Jan 26
0
[virtio-dev] Re: [PATCH v25 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
..._func(struct work_struct *work) >> +{ >> + struct virtio_balloon *vb; >> + int ret; >> + >> + vb = container_of(work, struct virtio_balloon, report_free_page_work); >> + >> + /* Start by sending the received cmd id to host with an outbuf */ >> + ret = send_cmd_id(vb, vb->cmd_id_received); >> + if (unlikely(ret)) >> + goto err; >> + >> + ret = walk_free_mem_block(vb, 0, &virtio_balloon_send_free_pages); >> + if (unlikely(ret < 0)) >> + goto err; >> + >> + /* End by sending a stop id to host with an...
2018 Jan 24
3
[PATCH v24 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...ved for the cmd id to use. > + */ > + if (vq->num_free > 1) > + ret = virtqueue_add_inbuf(vq, &sg, 1, vq, GFP_KERNEL); > + > + if (vq->num_free < virtqueue_get_vring_size(vq) / 2) > + virtqueue_kick(vq); > + > + return ret; > +} > + > +static void send_cmd_id(struct virtio_balloon *vb, __virtio32 *cmd_id) > +{ > + struct scatterlist sg; > + struct virtqueue *vq = vb->free_page_vq; > + > + if (unlikely(!virtio_has_feature(vb->vdev, > + VIRTIO_BALLOON_F_FREE_PAGE_HINT))) > + return; > + > + sg_init_one(&sg...
2018 Jan 24
3
[PATCH v24 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...ved for the cmd id to use. > + */ > + if (vq->num_free > 1) > + ret = virtqueue_add_inbuf(vq, &sg, 1, vq, GFP_KERNEL); > + > + if (vq->num_free < virtqueue_get_vring_size(vq) / 2) > + virtqueue_kick(vq); > + > + return ret; > +} > + > +static void send_cmd_id(struct virtio_balloon *vb, __virtio32 *cmd_id) > +{ > + struct scatterlist sg; > + struct virtqueue *vq = vb->free_page_vq; > + > + if (unlikely(!virtio_has_feature(vb->vdev, > + VIRTIO_BALLOON_F_FREE_PAGE_HINT))) > + return; > + > + sg_init_one(&sg...
2018 Jan 24
3
[PATCH v23 0/2] Virtio-balloon: support free page reporting
...purpose for now, will have a separate patch to discuss this flag check later; - init_vqs: change to put some variables on stack to have simpler implementation; - add destroy_workqueue(vb->balloon_wq); v21->v22: - add_one_sg: some code and comment re-arrangement - send_cmd_id: handle a cornercase For previous ChangeLog, please reference https://lwn.net/Articles/743660/ Wei Wang (2): mm: support reporting free page blocks virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ drivers/virtio/virtio_balloon.c | 228 ++++++++++++++++++++++++++++++------ include/linux/mm....
2018 Jan 17
8
[PATCH v22 0/3] Virtio-balloon: support free page reporting
...ncerned that the memory pages are used after they are given to the hypervisor as a hint of the free pages, because they will be tracked by the hypervisor and transferred in the next round if they are used and written. ChangeLog: v21-v22: - add_one_sg: some code and comment re-arrangement - send_cmd_id: handle a cornercase For precious ChangeLog, please reference https://lwn.net/Articles/743660/ Wei Wang (3): mm: support reporting free page blocks virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ virtio-balloon: don't report free pages when page poisoning is enabled drivers/virtio/virti...
2018 Jan 17
8
[PATCH v22 0/3] Virtio-balloon: support free page reporting
...ncerned that the memory pages are used after they are given to the hypervisor as a hint of the free pages, because they will be tracked by the hypervisor and transferred in the next round if they are used and written. ChangeLog: v21-v22: - add_one_sg: some code and comment re-arrangement - send_cmd_id: handle a cornercase For precious ChangeLog, please reference https://lwn.net/Articles/743660/ Wei Wang (3): mm: support reporting free page blocks virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ virtio-balloon: don't report free pages when page poisoning is enabled drivers/virtio/virti...
2018 Jan 17
0
[PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ
...entry available on the vq. + */ + BUG_ON(err); + } +} + +static void batch_free_page_sg(struct virtqueue *vq, + unsigned long pfn, + uint32_t len) +{ + add_one_sg(vq, pfn, len); + + /* Batch till the vq is full */ + if (!vq->num_free) + virtqueue_kick(vq); +} + +static void send_cmd_id(struct virtqueue *vq, void *addr) +{ + struct scatterlist sg; + unsigned int unused; + int err; + + sg_init_one(&sg, addr, sizeof(uint32_t)); + + /* + * This handles the cornercase that the vq happens to be full when + * adding a cmd id. Rarely happen in practice. + */ + while (!vq->num_f...
2018 Feb 07
2
[PATCH v26 2/2 RESEND] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...+ * If a stop id or a new cmd id was just received from host, stop + * the reporting, and return 1 to indicate an active stop. + */ + if (virtio32_to_cpu(vb->vdev, vb->cmd_id_use) != vb->cmd_id_received) + return 1; + + return add_one_sg(vb->free_page_vq, pfn, len); +} + +static int send_cmd_id(struct virtio_balloon *vb, uint32_t cmd_id) +{ + struct scatterlist sg; + struct virtqueue *vq = vb->free_page_vq; + + vb->cmd_id_use = cpu_to_virtio32(vb->vdev, cmd_id); + sg_init_one(&sg, &vb->cmd_id_use, sizeof(vb->cmd_id_use)); + + return virtqueue_add_outbuf(vq, &sg,...
2018 Feb 07
2
[PATCH v26 2/2 RESEND] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...+ * If a stop id or a new cmd id was just received from host, stop + * the reporting, and return 1 to indicate an active stop. + */ + if (virtio32_to_cpu(vb->vdev, vb->cmd_id_use) != vb->cmd_id_received) + return 1; + + return add_one_sg(vb->free_page_vq, pfn, len); +} + +static int send_cmd_id(struct virtio_balloon *vb, uint32_t cmd_id) +{ + struct scatterlist sg; + struct virtqueue *vq = vb->free_page_vq; + + vb->cmd_id_use = cpu_to_virtio32(vb->vdev, cmd_id); + sg_init_one(&sg, &vb->cmd_id_use, sizeof(vb->cmd_id_use)); + + return virtqueue_add_outbuf(vq, &sg,...
2018 Jan 24
0
[PATCH v23 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ
...1) { + err = virtqueue_add_inbuf(vq, &sg, 1, vq, GFP_KERNEL); + /* + * This is expected to never fail, because there is always an + * entry available on the vq. + */ + BUG_ON(err); + } + + if (vq->num_free == virtqueue_get_vring_size(vq) / 2) + virtqueue_kick(vq); +} + +static void send_cmd_id(struct virtqueue *vq, __virtio32 *cmd_id) +{ + struct scatterlist sg; + int err; + + sg_init_one(&sg, cmd_id, sizeof(*cmd_id)); + + err = virtqueue_add_outbuf(vq, &sg, 1, vq, GFP_KERNEL); + /* + * This is expected to never fail, because there is always an + * entry reserved for the cmd id...
2018 Jan 25
0
[PATCH v25 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...+ * If a stop id or a new cmd id was just received from host, stop + * the reporting, and return 1 to indicate an active stop. + */ + if (virtio32_to_cpu(vb->vdev, vb->cmd_id_use) != vb->cmd_id_received) + return 1; + + return add_one_sg(vb->free_page_vq, pfn, len); +} + +static int send_cmd_id(struct virtio_balloon *vb, uint32_t cmd_id) +{ + struct scatterlist sg; + struct virtqueue *vq = vb->free_page_vq; + int ret; + + vb->cmd_id_use = cpu_to_virtio32(vb->vdev, cmd_id); + sg_init_one(&sg, &vb->cmd_id_use, sizeof(vb->cmd_id_use)); + + ret = virtqueue_add_outbuf(vq...
2018 Jan 25
6
[PATCH v25 0/2] Virtio-balloon: support free page reporting
...purpose for now, will have a separate patch to discuss this flag check later; - init_vqs: change to put some variables on stack to have simpler implementation; - add destroy_workqueue(vb->balloon_wq); v21->v22: - add_one_sg: some code and comment re-arrangement - send_cmd_id: handle a cornercase For previous ChangeLog, please reference https://lwn.net/Articles/743660/ Wei Wang (2): mm: support reporting free page blocks virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT drivers/virtio/virtio_balloon.c | 251 ++++++++++++++++++++++++++++++------ include/linux/m...
2018 Jan 25
6
[PATCH v25 0/2] Virtio-balloon: support free page reporting
...purpose for now, will have a separate patch to discuss this flag check later; - init_vqs: change to put some variables on stack to have simpler implementation; - add destroy_workqueue(vb->balloon_wq); v21->v22: - add_one_sg: some code and comment re-arrangement - send_cmd_id: handle a cornercase For previous ChangeLog, please reference https://lwn.net/Articles/743660/ Wei Wang (2): mm: support reporting free page blocks virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT drivers/virtio/virtio_balloon.c | 251 ++++++++++++++++++++++++++++++------ include/linux/m...
2018 Jan 24
0
[PATCH v24 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...ow can be ignored. + * There is always one entry reserved for the cmd id to use. + */ + if (vq->num_free > 1) + ret = virtqueue_add_inbuf(vq, &sg, 1, vq, GFP_KERNEL); + + if (vq->num_free < virtqueue_get_vring_size(vq) / 2) + virtqueue_kick(vq); + + return ret; +} + +static void send_cmd_id(struct virtio_balloon *vb, __virtio32 *cmd_id) +{ + struct scatterlist sg; + struct virtqueue *vq = vb->free_page_vq; + + if (unlikely(!virtio_has_feature(vb->vdev, + VIRTIO_BALLOON_F_FREE_PAGE_HINT))) + return; + + sg_init_one(&sg, cmd_id, sizeof(*cmd_id)); + + if (virtqueue...
2018 Jan 24
2
[PATCH v23 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ
...ck when ring is half full but does need it later when ring is full. You can kick at ring half full as optimization but you absolutely still must kick on ring full. Something like: if (vq->num_free == virtqueue_get_vring_size(vq) / 2 || vq->num_free <= 2) > +} > + > +static void send_cmd_id(struct virtqueue *vq, __virtio32 *cmd_id) > +{ > + struct scatterlist sg; > + int err; > + > + sg_init_one(&sg, cmd_id, sizeof(*cmd_id)); > + > + err = virtqueue_add_outbuf(vq, &sg, 1, vq, GFP_KERNEL); > + /* > + * This is expected to never fail, because there is...
2018 Jan 24
2
[PATCH v23 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ
...ck when ring is half full but does need it later when ring is full. You can kick at ring half full as optimization but you absolutely still must kick on ring full. Something like: if (vq->num_free == virtqueue_get_vring_size(vq) / 2 || vq->num_free <= 2) > +} > + > +static void send_cmd_id(struct virtqueue *vq, __virtio32 *cmd_id) > +{ > + struct scatterlist sg; > + int err; > + > + sg_init_one(&sg, cmd_id, sizeof(*cmd_id)); > + > + err = virtqueue_add_outbuf(vq, &sg, 1, vq, GFP_KERNEL); > + /* > + * This is expected to never fail, because there is...
2018 Feb 07
0
[PATCH v26 2/2 RESEND] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
...ceived from host, stop > + * the reporting, and return 1 to indicate an active stop. > + */ > + if (virtio32_to_cpu(vb->vdev, vb->cmd_id_use) != vb->cmd_id_received) > + return 1; > + > + return add_one_sg(vb->free_page_vq, pfn, len); > +} > + > +static int send_cmd_id(struct virtio_balloon *vb, uint32_t cmd_id) > +{ > + struct scatterlist sg; > + struct virtqueue *vq = vb->free_page_vq; > + > + vb->cmd_id_use = cpu_to_virtio32(vb->vdev, cmd_id); > + sg_init_one(&sg, &vb->cmd_id_use, sizeof(vb->cmd_id_use)); > + > +...
2018 Jan 17
2
[PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ
...gt; +static void batch_free_page_sg(struct virtqueue *vq, > + unsigned long pfn, > + uint32_t len) > +{ > + add_one_sg(vq, pfn, len); > + > + /* Batch till the vq is full */ > + if (!vq->num_free) > + virtqueue_kick(vq); > +} > + > +static void send_cmd_id(struct virtqueue *vq, void *addr) > +{ > + struct scatterlist sg; > + unsigned int unused; > + int err; > + > + sg_init_one(&sg, addr, sizeof(uint32_t)); > + > + /* > + * This handles the cornercase that the vq happens to be full when > + * adding a cmd id. Rarel...