Re: [PATCH kvmtool] virtio: Cancel and join threads when exiting devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 16, 2023 at 12:52:59PM +0100, Jean-Philippe Brucker wrote:
> On Wed, Oct 04, 2023 at 05:49:45PM -0300, Eduardo Bart wrote:
> > I'm experiencing a segmentation fault in lkvm where it may crash after
> > powering off a guest machine that uses a virtio network device.
> > The crash is hard to reproduce, because looks like it only happens
> > when the guest machine is powering off while extra virtio threads is
> > doing some work,
> > when it happens lkvm crashes in the function virtio_net_rx_thread
> > while attempting to read invalid guest physical memory,
> > because guest physical memory was unmapped.
> > 
> > I've isolated the problem and looks like when lkvm exits it unmaps the
> > guest memory while virtio device extra threads may still be executing.
> > I noticed most virtio devices are not executing pthread_cancel +
> > pthread_join to synchronize extra threads when exiting,
> > to make sure this happens I added explicit calls to the virtio device
> > exit function to all virtio devices,
> > which should cancel and join all threads before unmapping guest
> > physical memory, fixing the crash for me.
> > 
> > Below I'm attaching a patch to fix the issue, feel free to apply or
> > fix the issue some other way.
> > 
> > Signed-off-by: Eduardo Bart <edub4rt@xxxxxxxxx>
> 
> The patch doesn't apply for some reason, there seems to be whitespace
> issues, tabs replaced by spaces.

Eduardo -- please can you send a properly formatted patch addressing
Jean-Philippe's comments so that I can apply it?

Thanks,

Will




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux