Re: [RFC 2/2] virtio-net: use post load hook

2019-10-11 Thread Michael S. Tsirkin
On Fri, Oct 11, 2019 at 12:34:59PM +0200, Mikhail Sennikovsky wrote: > I still wonder though if this approach is really cleaner than my > original one of having an extra argument in set_features callback, > saying whether the device settings (offloads in case of virtio-net) > need to be reset. > >

Re: [RFC 2/2] virtio-net: use post load hook

2019-10-11 Thread Michael S. Tsirkin
On Fri, Oct 11, 2019 at 12:30:07PM +0200, Mikhail Sennikovsky wrote: > Am Fr., 11. Okt. 2019 um 12:08 Uhr schrieb Michael S. Tsirkin > : > >... > > And pre save hook can do n->saved_guest_offloads = n->curr_guest_offloads. > Would you want to have the saved_guest_offloads as part of the saved stat

Re: [RFC 2/2] virtio-net: use post load hook

2019-10-11 Thread Mikhail Sennikovsky
I still wonder though if this approach is really cleaner than my original one of having an extra argument in set_features callback, saying whether the device settings (offloads in case of virtio-net) need to be reset. Mikhail Am Fr., 11. Okt. 2019 um 12:30 Uhr schrieb Mikhail Sennikovsky : > > Am

Re: [RFC 2/2] virtio-net: use post load hook

2019-10-11 Thread Mikhail Sennikovsky
Am Fr., 11. Okt. 2019 um 12:08 Uhr schrieb Michael S. Tsirkin : >... > And pre save hook can do n->saved_guest_offloads = n->curr_guest_offloads. Would you want to have the saved_guest_offloads as part of the saved state? The curr_guest_offloads info is already there, so why would you want to dupli

Re: [RFC 2/2] virtio-net: use post load hook

2019-10-11 Thread Michael S. Tsirkin
Ugh. Okay. So let's add a new field saved_guest_offloads and have vmstate use that instead of curr_guest_offloads. Now the new post load hook can do n->curr_guest_offloads = n->saved_guest_offloads and apply that. And pre save hook can do n->saved_guest_offloads = n->curr_guest_offloads.

Re: [RFC 2/2] virtio-net: use post load hook

2019-10-11 Thread Mikhail Sennikovsky
Note that the virtio_net_set_features gets also called from the virtio_pci_common_write when guest does virtio device configuration. In that case the curr_guest_offloads are still expected to be reset. Mikhail Am Fr., 11. Okt. 2019 um 11:51 Uhr schrieb Michael S. Tsirkin : > > On Fri, Oct 11, 201

Re: [RFC 2/2] virtio-net: use post load hook

2019-10-11 Thread Michael S. Tsirkin
On Fri, Oct 11, 2019 at 11:46:22AM +0200, Mikhail Sennikovsky wrote: > Hi Michael, > > Unfortunately your approach will not work, because the > VirtIONet::curr_guest_offloads would still be reset in > virtio_net_set_features: > -- > if (n->has_vnet_hdr) { > n->curr_guest_offloads = > v

Re: [RFC 2/2] virtio-net: use post load hook

2019-10-11 Thread Mikhail Sennikovsky
Hi Michael, Unfortunately your approach will not work, because the VirtIONet::curr_guest_offloads would still be reset in virtio_net_set_features: -- if (n->has_vnet_hdr) { n->curr_guest_offloads = virtio_net_guest_offloads_by_features(features); -- ( https://github.com/qemu/qemu/blob/

Re: [RFC 2/2] virtio-net: use post load hook

2019-10-10 Thread Jason Wang
On 2019/10/11 上午2:04, Michael S. Tsirkin wrote: Currently offloads disabled by guest via the VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET command are not preserved on VM migration. Instead all offloads reported by guest features (via VIRTIO_PCI_GUEST_FEATURES) get enabled. What happens is: first the Virt

[RFC 2/2] virtio-net: use post load hook

2019-10-10 Thread Michael S. Tsirkin
Currently offloads disabled by guest via the VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET command are not preserved on VM migration. Instead all offloads reported by guest features (via VIRTIO_PCI_GUEST_FEATURES) get enabled. What happens is: first the VirtIONet::curr_guest_offloads gets restored and offload