search for: stats_handle_request

Displaying 20 results from an estimated 151 matches for "stats_handle_request".

2016 Jan 25
2
[PATCH v5 0/2] virtio_balloon: Conversion to workqueue + parallel stats
The previous version did not prevent updating the balloon when it was being removed. There was an idea to update the stats in a separate work and cancel it after the config reset. But this does not seem to work. The code for updating the stats communicates with the host. IMHO, it should not run after the reset (flushing buffers). Therefore I decided to use a boolean value and a spin lock (inspired
2016 Jan 25
2
[PATCH v5 0/2] virtio_balloon: Conversion to workqueue + parallel stats
The previous version did not prevent updating the balloon when it was being removed. There was an idea to update the stats in a separate work and cancel it after the config reset. But this does not seem to work. The code for updating the stats communicates with the host. IMHO, it should not run after the reset (flushing buffers). Therefore I decided to use a boolean value and a spin lock (inspired
2014 Nov 12
3
[PATCH v2] virtio_balloon: Convert "vballon" kthread into a workqueue
...vb) * with a single buffer. From that point forward, all conversations consist of * a hypervisor request (a call to this function) which directs us to refill * the virtqueue with a fresh stats buffer. Since stats collection can sleep, - * we notify our kthread which does the actual work via stats_handle_request(). + * we queue a work that will do the actual work via stats_handle_request(). */ static void stats_request(struct virtqueue *vq) { struct virtio_balloon *vb = vq->vdev->priv; vb->need_stats_update = 1; - wake_up(&vb->config_change); + queue_work(vb->wq, &vb->wq...
2014 Nov 12
3
[PATCH v2] virtio_balloon: Convert "vballon" kthread into a workqueue
...vb) * with a single buffer. From that point forward, all conversations consist of * a hypervisor request (a call to this function) which directs us to refill * the virtqueue with a fresh stats buffer. Since stats collection can sleep, - * we notify our kthread which does the actual work via stats_handle_request(). + * we queue a work that will do the actual work via stats_handle_request(). */ static void stats_request(struct virtqueue *vq) { struct virtio_balloon *vb = vq->vdev->priv; vb->need_stats_update = 1; - wake_up(&vb->config_change); + queue_work(vb->wq, &vb->wq...
2015 Dec 04
4
[PATCH v4 0/2] virtio_balloon: Fix restore and convert to workqueue
It has been long since I have sent v3 of the balloon conversion from a kthread to a workqueue. I have gained some more experience with the APIs in the meantime. I hope that you would like the outcome. I have added one more patch that fixes a separate problem with restoring the balloon after the system freeze. I have found this when testing the conversion. Changes against v3: + rebased on
2015 Dec 04
4
[PATCH v4 0/2] virtio_balloon: Fix restore and convert to workqueue
It has been long since I have sent v3 of the balloon conversion from a kthread to a workqueue. I have gained some more experience with the APIs in the meantime. I hope that you would like the outcome. I have added one more patch that fixes a separate problem with restoring the balloon after the system freeze. I have found this when testing the conversion. Changes against v3: + rebased on
2015 Dec 04
0
[PATCH v4 2/2] virtio_balloon: Use a workqueue instead of "vballoon" kthread
...vb) * with a single buffer. From that point forward, all conversations consist of * a hypervisor request (a call to this function) which directs us to refill * the virtqueue with a fresh stats buffer. Since stats collection can sleep, - * we notify our kthread which does the actual work via stats_handle_request(). + * we delegate the job to a freezable workqueue that will do the actual work via + * stats_handle_request(). */ static void stats_request(struct virtqueue *vq) { struct virtio_balloon *vb = vq->vdev->priv; vb->need_stats_update = 1; - wake_up(&vb->config_change); + que...
2014 Nov 12
0
[PATCH v2] virtio_balloon: Convert "vballon" kthread into a workqueue
...single buffer. From that point forward, all conversations consist of > * a hypervisor request (a call to this function) which directs us to refill > * the virtqueue with a fresh stats buffer. Since stats collection can sleep, > - * we notify our kthread which does the actual work via stats_handle_request(). > + * we queue a work that will do the actual work via stats_handle_request(). > */ > static void stats_request(struct virtqueue *vq) > { > struct virtio_balloon *vb = vq->vdev->priv; > > vb->need_stats_update = 1; > - wake_up(&vb->config_change)...
2016 Jan 01
2
[PATCH v4 2/2] virtio_balloon: Use a workqueue instead of "vballoon" kthread
...single buffer. From that point forward, all conversations consist of > * a hypervisor request (a call to this function) which directs us to refill > * the virtqueue with a fresh stats buffer. Since stats collection can sleep, > - * we notify our kthread which does the actual work via stats_handle_request(). > + * we delegate the job to a freezable workqueue that will do the actual work via > + * stats_handle_request(). > */ > static void stats_request(struct virtqueue *vq) > { > struct virtio_balloon *vb = vq->vdev->priv; > > vb->need_stats_update = 1; &gt...
2016 Jan 01
2
[PATCH v4 2/2] virtio_balloon: Use a workqueue instead of "vballoon" kthread
...single buffer. From that point forward, all conversations consist of > * a hypervisor request (a call to this function) which directs us to refill > * the virtqueue with a fresh stats buffer. Since stats collection can sleep, > - * we notify our kthread which does the actual work via stats_handle_request(). > + * we delegate the job to a freezable workqueue that will do the actual work via > + * stats_handle_request(). > */ > static void stats_request(struct virtqueue *vq) > { > struct virtio_balloon *vb = vq->vdev->priv; > > vb->need_stats_update = 1; &gt...
2014 Nov 20
2
[PATCH v3] virtio_balloon: Convert "vballoon" kthread into a workqueue
...vb) * with a single buffer. From that point forward, all conversations consist of * a hypervisor request (a call to this function) which directs us to refill * the virtqueue with a fresh stats buffer. Since stats collection can sleep, - * we notify our kthread which does the actual work via stats_handle_request(). + * we delegate the job to a freezable workqueue that will do the actual work via + * stats_handle_request(). */ static void stats_request(struct virtqueue *vq) { struct virtio_balloon *vb = vq->vdev->priv; vb->need_stats_update = 1; - wake_up(&vb->config_change); + que...
2014 Nov 20
2
[PATCH v3] virtio_balloon: Convert "vballoon" kthread into a workqueue
...vb) * with a single buffer. From that point forward, all conversations consist of * a hypervisor request (a call to this function) which directs us to refill * the virtqueue with a fresh stats buffer. Since stats collection can sleep, - * we notify our kthread which does the actual work via stats_handle_request(). + * we delegate the job to a freezable workqueue that will do the actual work via + * stats_handle_request(). */ static void stats_request(struct virtqueue *vq) { struct virtio_balloon *vb = vq->vdev->priv; vb->need_stats_update = 1; - wake_up(&vb->config_change); + que...
2014 Sep 25
2
[PATCH] virtio_balloon: Convert "vballon" kthread into a workqueue
...vb) * with a single buffer. From that point forward, all conversations consist of * a hypervisor request (a call to this function) which directs us to refill * the virtqueue with a fresh stats buffer. Since stats collection can sleep, - * we notify our kthread which does the actual work via stats_handle_request(). + * we queue a work that will do the actual work via stats_handle_request(). */ static void stats_request(struct virtqueue *vq) { struct virtio_balloon *vb = vq->vdev->priv; vb->need_stats_update = 1; - wake_up(&vb->config_change); + queue_work(vb->wq, &vb->wq...
2014 Sep 25
2
[PATCH] virtio_balloon: Convert "vballon" kthread into a workqueue
...vb) * with a single buffer. From that point forward, all conversations consist of * a hypervisor request (a call to this function) which directs us to refill * the virtqueue with a fresh stats buffer. Since stats collection can sleep, - * we notify our kthread which does the actual work via stats_handle_request(). + * we queue a work that will do the actual work via stats_handle_request(). */ static void stats_request(struct virtqueue *vq) { struct virtio_balloon *vb = vq->vdev->priv; vb->need_stats_update = 1; - wake_up(&vb->config_change); + queue_work(vb->wq, &vb->wq...
2023 Aug 29
2
[PATCH] virtio_balloon: Fix endless deflation and inflation on arm64
....c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 5b15936a5214..625caac35264 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -386,6 +386,17 @@ static void stats_handle_request(struct virtio_balloon *vb) virtqueue_kick(vq); } +static inline s64 align_pages_up(s64 diff) +{ + if (diff == 0) + return diff; + + if (diff > 0) + return ALIGN(diff, VIRTIO_BALLOON_PAGES_PER_PAGE); + + return -ALIGN(-diff, VIRTIO_BALLOON_PAGES_PER_PAGE); +} + static inline s64 towards_t...
2015 Mar 31
2
[PATCH v2 1/6] virtio_balloon: transitional interface
...loon { /* Memory statistics */ int need_stats_update; - struct virtio_balloon_stat stats[VIRTIO_BALLOON_S_NR]; + struct virtio_balloon_stat_modern stats[VIRTIO_BALLOON_S_NR]; /* To register callback in oom notifier call chain */ struct notifier_block nb; @@ -269,7 +269,11 @@ static void stats_handle_request(struct virtio_balloon *vb) vq = vb->stats_vq; if (!virtqueue_get_buf(vq, &len)) return; - sg_init_one(&sg, vb->stats, sizeof(vb->stats)); + if (virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) + sg_init_one(&sg, vb->stats, sizeof(vb->stats)); + else + sg_init_one(&a...
2015 Mar 31
2
[PATCH v2 1/6] virtio_balloon: transitional interface
...loon { /* Memory statistics */ int need_stats_update; - struct virtio_balloon_stat stats[VIRTIO_BALLOON_S_NR]; + struct virtio_balloon_stat_modern stats[VIRTIO_BALLOON_S_NR]; /* To register callback in oom notifier call chain */ struct notifier_block nb; @@ -269,7 +269,11 @@ static void stats_handle_request(struct virtio_balloon *vb) vq = vb->stats_vq; if (!virtqueue_get_buf(vq, &len)) return; - sg_init_one(&sg, vb->stats, sizeof(vb->stats)); + if (virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) + sg_init_one(&sg, vb->stats, sizeof(vb->stats)); + else + sg_init_one(&a...
2017 Mar 24
2
[PATCH] virtio_balloon: prevent uninitialized variable use
...; > @@ -268,6 +268,8 @@ static void update_balloon_stats(struct virtio_balloon *vb) > pages_to_bytes(i.totalram)); > update_stat(vb, idx++, VIRTIO_BALLOON_S_AVAIL, > pages_to_bytes(available)); > + > + return idx; > } > > /* > @@ -294,13 +296,14 @@ static void stats_handle_request(struct > virtio_balloon *vb) > struct virtqueue *vq; > struct scatterlist sg; > unsigned int len; > + unsigned int num_stats; > > - update_balloon_stats(vb); > + num_stats = update_balloon_stats(vb); > > vq = vb->stats_vq; > if (!virtqueue_get_buf(vq,...
2017 Mar 24
2
[PATCH] virtio_balloon: prevent uninitialized variable use
...; > @@ -268,6 +268,8 @@ static void update_balloon_stats(struct virtio_balloon *vb) > pages_to_bytes(i.totalram)); > update_stat(vb, idx++, VIRTIO_BALLOON_S_AVAIL, > pages_to_bytes(available)); > + > + return idx; > } > > /* > @@ -294,13 +296,14 @@ static void stats_handle_request(struct > virtio_balloon *vb) > struct virtqueue *vq; > struct scatterlist sg; > unsigned int len; > + unsigned int num_stats; > > - update_balloon_stats(vb); > + num_stats = update_balloon_stats(vb); > > vq = vb->stats_vq; > if (!virtqueue_get_buf(vq,...
2011 Aug 16
1
[PATCH] virtio-blk: Add stats VQ to collect information about devices
...t_stat_read(p, time_in_queue))); +} + +static void stats_request(struct virtqueue *vq) +{ + struct virtio_blk *vb; + unsigned int len; + + vb = virtqueue_get_buf(vq, &len); + if (!vb) + return; + vb->need_stats_update = 1; + queue_work(virtblk_wq, &vb->config_work); +} + +static void stats_handle_request(struct virtio_blk *vb) +{ + struct virtqueue *vq; + struct scatterlist sg; + + vb->need_stats_update = 0; + update_blk_stats(vb); + + vq = vb->stats_vq; + sg_init_one(&sg, vb->stats, sizeof(vb->stats)); + if (virtqueue_add_buf(vq, &sg, 1, 0, vb) < 0) + BUG(); + virtqueue_kic...