Cornelia Huck
2022-Jan-17 12:38 UTC
[PATCH] virtio: acknowledge all features before access
On Mon, Jan 17 2022, "Michael S. Tsirkin" <mst at redhat.com> wrote:> On Mon, Jan 17, 2022 at 02:31:49PM +0800, Jason Wang wrote: >> >> ? 2022/1/15 ??4:09, Michael S. Tsirkin ??: >> > @@ -495,6 +494,10 @@ int virtio_device_restore(struct virtio_device *dev) >> > /* We have a driver! */ >> > virtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER); >> > + ret = dev->config->finalize_features(dev); >> > + if (ret) >> > + goto err; >> >> >> Is this part of code related? >> >> Thanks >> > > Yes. virtio_finalize_features no longer calls dev->config->finalize_features. > > I think the dev->config->finalize_features callback is actually > a misnomer now, it just sends the features to device, > finalize is FEATURES_OK. Renaming that is a bigger > patch though, and I'd like this one to be cherry-pickable > to stable.Do we want to add a comment before the calls to ->finalize_features() (/* write features to device */) and adapt the comment in virtio_ring.h? Should still be stable-friendly, and giving the callback a better name can be a follow-up patch.> >> > + >> > ret = virtio_finalize_features(dev); >> > if (ret) >> > goto err;
Michael S. Tsirkin
2022-Jan-17 23:13 UTC
[PATCH] virtio: acknowledge all features before access
On Mon, Jan 17, 2022 at 01:38:42PM +0100, Cornelia Huck wrote:> On Mon, Jan 17 2022, "Michael S. Tsirkin" <mst at redhat.com> wrote: > > > On Mon, Jan 17, 2022 at 02:31:49PM +0800, Jason Wang wrote: > >> > >> ? 2022/1/15 ??4:09, Michael S. Tsirkin ??: > >> > @@ -495,6 +494,10 @@ int virtio_device_restore(struct virtio_device *dev) > >> > /* We have a driver! */ > >> > virtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER); > >> > + ret = dev->config->finalize_features(dev); > >> > + if (ret) > >> > + goto err; > >> > >> > >> Is this part of code related? > >> > >> Thanks > >> > > > > Yes. virtio_finalize_features no longer calls dev->config->finalize_features. > > > > I think the dev->config->finalize_features callback is actually > > a misnomer now, it just sends the features to device, > > finalize is FEATURES_OK. Renaming that is a bigger > > patch though, and I'd like this one to be cherry-pickable > > to stable. > > Do we want to add a comment before the calls to ->finalize_features() > (/* write features to device */) and adapt the comment in virtio_ring.h? > Should still be stable-friendly, and giving the callback a better name > can be a follow-up patch.Sounds like a good idea. I can also document that near virtio_finalize_features.> > > >> > + > >> > ret = virtio_finalize_features(dev); > >> > if (ret) > >> > goto err;
Michael S. Tsirkin
2022-Jan-18 15:43 UTC
[PATCH] virtio: acknowledge all features before access
On Mon, Jan 17, 2022 at 01:38:42PM +0100, Cornelia Huck wrote:> On Mon, Jan 17 2022, "Michael S. Tsirkin" <mst at redhat.com> wrote: > > > On Mon, Jan 17, 2022 at 02:31:49PM +0800, Jason Wang wrote: > >> > >> ? 2022/1/15 ??4:09, Michael S. Tsirkin ??: > >> > @@ -495,6 +494,10 @@ int virtio_device_restore(struct virtio_device *dev) > >> > /* We have a driver! */ > >> > virtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER); > >> > + ret = dev->config->finalize_features(dev); > >> > + if (ret) > >> > + goto err; > >> > >> > >> Is this part of code related? > >> > >> Thanks > >> > > > > Yes. virtio_finalize_features no longer calls dev->config->finalize_features. > > > > I think the dev->config->finalize_features callback is actually > > a misnomer now, it just sends the features to device, > > finalize is FEATURES_OK. Renaming that is a bigger > > patch though, and I'd like this one to be cherry-pickable > > to stable. > > Do we want to add a comment before the calls to ->finalize_features() > (/* write features to device */) and adapt the comment in virtio_ring.h? > Should still be stable-friendly, and giving the callback a better name > can be a follow-up patch.Sorry which comment in virtio_ring.h? Could not find anything.> > > >> > + > >> > ret = virtio_finalize_features(dev); > >> > if (ret) > >> > goto err;