From: Will Deacon <will@kernel.org>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: Eduardo Bart <edub4rt@gmail.com>,
kvm@vger.kernel.org, alex@mikhalevich.com
Subject: Re: [PATCH kvmtool] virtio: Cancel and join threads when exiting devices
Date: Tue, 7 Nov 2023 11:08:59 +0000 [thread overview]
Message-ID: <20231107110858.GA19219@willie-the-truck> (raw)
In-Reply-To: <20231016115259.GA835650@myrica>
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@gmail.com>
>
> 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
prev parent reply other threads:[~2023-11-07 11:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 20:49 [PATCH kvmtool] virtio: Cancel and join threads when exiting devices Eduardo Bart
2023-10-16 11:52 ` Jean-Philippe Brucker
2023-11-07 11:08 ` Will Deacon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231107110858.GA19219@willie-the-truck \
--to=will@kernel.org \
--cc=alex@mikhalevich.com \
--cc=edub4rt@gmail.com \
--cc=jean-philippe@linaro.org \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox