Re: [PATCH] virtio: acknowledge all features before access

From: Cornelia Huck
Date: Tue Jan 18 2022 - 12:25:56 EST


On Tue, Jan 18 2022, "Michael S. Tsirkin" <mst@xxxxxxxxxx> wrote:

> On Mon, Jan 17, 2022 at 01:38:42PM +0100, Cornelia Huck wrote:
>> On Mon, Jan 17 2022, "Michael S. Tsirkin" <mst@xxxxxxxxxx> 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.

Typo; I ment virtio_config.h...

>
>> >
>> >> > +
>> >> > ret = virtio_finalize_features(dev);
>> >> > if (ret)
>> >> > goto err;