Christian Borntraeger
2018-Dec-27 12:03 UTC
[PATCH v37 1/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
On 27.08.2018 03:32, Wei Wang wrote:> static int init_vqs(struct virtio_balloon *vb) > { > - struct virtqueue *vqs[3]; > - vq_callback_t *callbacks[] = { balloon_ack, balloon_ack, stats_request }; > - static const char * const names[] = { "inflate", "deflate", "stats" }; > - int err, nvqs; > + struct virtqueue *vqs[VIRTIO_BALLOON_VQ_MAX]; > + vq_callback_t *callbacks[VIRTIO_BALLOON_VQ_MAX]; > + const char *names[VIRTIO_BALLOON_VQ_MAX]; > + int err; > > /* > - * We expect two virtqueues: inflate and deflate, and > - * optionally stat. > + * Inflateq and deflateq are used unconditionally. The names[] > + * will be NULL if the related feature is not enabled, which will > + * cause no allocation for the corresponding virtqueue in find_vqs. > */This might be true for virtio-pci, but it is not for virtio-ccw.> - nvqs = virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_STATS_VQ) ? 3 : 2; > - err = virtio_find_vqs(vb->vdev, nvqs, vqs, callbacks, names, NULL); > + callbacks[VIRTIO_BALLOON_VQ_INFLATE] = balloon_ack; > + names[VIRTIO_BALLOON_VQ_INFLATE] = "inflate"; > + callbacks[VIRTIO_BALLOON_VQ_DEFLATE] = balloon_ack; > + names[VIRTIO_BALLOON_VQ_DEFLATE] = "deflate"; > + names[VIRTIO_BALLOON_VQ_STATS] = NULL; > + names[VIRTIO_BALLOON_VQ_FREE_PAGE] = NULL; > + > + if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_STATS_VQ)) { > + names[VIRTIO_BALLOON_VQ_STATS] = "stats"; > + callbacks[VIRTIO_BALLOON_VQ_STATS] = stats_request; > + } > + > + if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) { > + names[VIRTIO_BALLOON_VQ_FREE_PAGE] = "free_page_vq"; > + callbacks[VIRTIO_BALLOON_VQ_FREE_PAGE] = NULL; > + } > + > + err = vb->vdev->config->find_vqs(vb->vdev, VIRTIO_BALLOON_VQ_MAX,[...]
Wei Wang
2018-Dec-28 03:12 UTC
[PATCH v37 1/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
On 12/27/2018 08:03 PM, Christian Borntraeger wrote:> On 27.08.2018 03:32, Wei Wang wrote: >> static int init_vqs(struct virtio_balloon *vb) >> { >> - struct virtqueue *vqs[3]; >> - vq_callback_t *callbacks[] = { balloon_ack, balloon_ack, stats_request }; >> - static const char * const names[] = { "inflate", "deflate", "stats" }; >> - int err, nvqs; >> + struct virtqueue *vqs[VIRTIO_BALLOON_VQ_MAX]; >> + vq_callback_t *callbacks[VIRTIO_BALLOON_VQ_MAX]; >> + const char *names[VIRTIO_BALLOON_VQ_MAX]; >> + int err; >> >> /* >> - * We expect two virtqueues: inflate and deflate, and >> - * optionally stat. >> + * Inflateq and deflateq are used unconditionally. The names[] >> + * will be NULL if the related feature is not enabled, which will >> + * cause no allocation for the corresponding virtqueue in find_vqs. >> */ > This might be true for virtio-pci, but it is not for virtio-ccw.Hi Christian, Please try the fix patches: https://lkml.org/lkml/2018/12/27/336 Best, Wei
Christian Borntraeger
2018-Dec-28 08:03 UTC
[PATCH v37 1/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
On 28.12.2018 04:12, Wei Wang wrote:> On 12/27/2018 08:03 PM, Christian Borntraeger wrote: >> On 27.08.2018 03:32, Wei Wang wrote: >>> ? static int init_vqs(struct virtio_balloon *vb) >>> ? { >>> -??? struct virtqueue *vqs[3]; >>> -??? vq_callback_t *callbacks[] = { balloon_ack, balloon_ack, stats_request }; >>> -??? static const char * const names[] = { "inflate", "deflate", "stats" }; >>> -??? int err, nvqs; >>> +??? struct virtqueue *vqs[VIRTIO_BALLOON_VQ_MAX]; >>> +??? vq_callback_t *callbacks[VIRTIO_BALLOON_VQ_MAX]; >>> +??? const char *names[VIRTIO_BALLOON_VQ_MAX]; >>> +??? int err; >>> >>> ????? /* >>> -???? * We expect two virtqueues: inflate and deflate, and >>> -???? * optionally stat. >>> +???? * Inflateq and deflateq are used unconditionally. The names[] >>> +???? * will be NULL if the related feature is not enabled, which will >>> +???? * cause no allocation for the corresponding virtqueue in find_vqs. >>> ?????? */ >> This might be true for virtio-pci, but it is not for virtio-ccw. > > Hi Christian, > > > Please try the fix patches: https://lkml.org/lkml/2018/12/27/336See answer to that thread. It fixes the random boot crashes. There is still the regression that ballooning does no longer work on s390 (see the call trace).
Apparently Analagous Threads
- [PATCH v37 1/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
- [PATCH] virtio-balloon: request nvqs based on features
- [PATCH] virtio-balloon: request nvqs based on features
- [PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT
- [PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT