mbox series

[0/2] vhost/net: Clear the pending messages when the backend is removed

Message ID 20230117151518.44725-1-eric.auger@redhat.com (mailing list archive)
Headers show
Series vhost/net: Clear the pending messages when the backend is removed | expand

Message

Eric Auger Jan. 17, 2023, 3:15 p.m. UTC
When the vhost iotlb is used along with a guest virtual iommu
and the guest gets rebooted, some MISS messages may have been
recorded just before the reboot and spuriously executed by
the virtual iommu after the reboot. This is due to the fact
the pending messages are not cleared.

As vhost does not have any explicit reset user API,
VHOST_NET_SET_BACKEND looks a reasonable point where to clear
the pending messages, in case the backend is removed (fd = -1).

This version is a follow-up on the discussions held in [1].

The first patch removes an unused 'enabled' parameter in
vhost_init_device_iotlb().

Best Regards

Eric

History:
[1] RFC: [RFC] vhost: Clear the pending messages on vhost_init_device_iotlb()
https://lore.kernel.org/all/20221107203431.368306-1-eric.auger@redhat.com/

Eric Auger (2):
  vhost: Remove the enabled parameter from vhost_init_device_iotlb
  vhost/net: Clear the pending messages when the backend is removed

 drivers/vhost/net.c   | 5 ++++-
 drivers/vhost/vhost.c | 5 +++--
 drivers/vhost/vhost.h | 3 ++-
 3 files changed, 9 insertions(+), 4 deletions(-)

Comments

Eric Auger Jan. 29, 2023, 5:58 p.m. UTC | #1
Hi,

On 1/17/23 16:15, Eric Auger wrote:
> When the vhost iotlb is used along with a guest virtual iommu
> and the guest gets rebooted, some MISS messages may have been
> recorded just before the reboot and spuriously executed by
> the virtual iommu after the reboot. This is due to the fact
> the pending messages are not cleared.
>
> As vhost does not have any explicit reset user API,
> VHOST_NET_SET_BACKEND looks a reasonable point where to clear
> the pending messages, in case the backend is removed (fd = -1).
>
> This version is a follow-up on the discussions held in [1].
>
> The first patch removes an unused 'enabled' parameter in
> vhost_init_device_iotlb().

Gentle Ping. Does it look a reasonable fix now?

Thanks

Eric
>
> Best Regards
>
> Eric
>
> History:
> [1] RFC: [RFC] vhost: Clear the pending messages on vhost_init_device_iotlb()
> https://lore.kernel.org/all/20221107203431.368306-1-eric.auger@redhat.com/
>
> Eric Auger (2):
>   vhost: Remove the enabled parameter from vhost_init_device_iotlb
>   vhost/net: Clear the pending messages when the backend is removed
>
>  drivers/vhost/net.c   | 5 ++++-
>  drivers/vhost/vhost.c | 5 +++--
>  drivers/vhost/vhost.h | 3 ++-
>  3 files changed, 9 insertions(+), 4 deletions(-)
>
Michael S. Tsirkin Jan. 29, 2023, 10:33 p.m. UTC | #2
On Sun, Jan 29, 2023 at 06:58:09PM +0100, Eric Auger wrote:
> Hi,
> 
> On 1/17/23 16:15, Eric Auger wrote:
> > When the vhost iotlb is used along with a guest virtual iommu
> > and the guest gets rebooted, some MISS messages may have been
> > recorded just before the reboot and spuriously executed by
> > the virtual iommu after the reboot. This is due to the fact
> > the pending messages are not cleared.
> >
> > As vhost does not have any explicit reset user API,
> > VHOST_NET_SET_BACKEND looks a reasonable point where to clear
> > the pending messages, in case the backend is removed (fd = -1).
> >
> > This version is a follow-up on the discussions held in [1].
> >
> > The first patch removes an unused 'enabled' parameter in
> > vhost_init_device_iotlb().
> 
> Gentle Ping. Does it look a reasonable fix now?
> 
> Thanks
> 
> Eric

Yes I applied this - giving it a bit of time in next.

> >
> > Best Regards
> >
> > Eric
> >
> > History:
> > [1] RFC: [RFC] vhost: Clear the pending messages on vhost_init_device_iotlb()
> > https://lore.kernel.org/all/20221107203431.368306-1-eric.auger@redhat.com/
> >
> > Eric Auger (2):
> >   vhost: Remove the enabled parameter from vhost_init_device_iotlb
> >   vhost/net: Clear the pending messages when the backend is removed
> >
> >  drivers/vhost/net.c   | 5 ++++-
> >  drivers/vhost/vhost.c | 5 +++--
> >  drivers/vhost/vhost.h | 3 ++-
> >  3 files changed, 9 insertions(+), 4 deletions(-)
> >