From: Peter Xu <peterx@redhat.com>
To: John Johnson <john.g.johnson@oracle.com>
Cc: Thanos Makatos <thanos.makatos@nutanix.com>,
Paolo Bonzini <pbonzini@redhat.com>,
QEMU Devel Mailing List <qemu-devel@nongnu.org>,
Markus Armbruster <armbru@redhat.com>,
John Levon <john.levon@nutanix.com>
Subject: Re: Question on memory commit during MR finalize()
Date: Mon, 19 Jul 2021 21:22:09 -0400 [thread overview]
Message-ID: <YPYlQUwIT/R0FkWP@t490s> (raw)
In-Reply-To: <D22C9D84-EE93-4DA8-99DE-98C46E27809C@oracle.com>
On Mon, Jul 19, 2021 at 08:58:44PM +0000, John Johnson wrote:
>
>
> > On Jul 19, 2021, at 12:59 PM, Peter Xu <peterx@redhat.com> wrote:
> >
> >
> > Here vfio_user_send_recv() looks tricky to me - it releases the bql within a
> > memory update procedure, and IMHO it needs some serious justification on why it
> > can do so. For example, what if memory layout changed when waiting for the
> > reply? As it can happen in parallel if without bql, afaict.
> >
>
>
> The reason bql is dropped is usually the thread will sleep waiting
> for a reply from the server, and I didn't think it was a good idea to block
> all threads in the meantime. Most vfio-user requests result from a guest
> action, so just blocking the single CPU thread for the reply is good.
Sleeping with bql is actually ok imho, but indeed if it can take very long then
we should make it async.
>
> The vfio-user code doesn’t depend on the memory layout being stable,
> it’s just sending the layout updates to the server. Would it be better to
> send memory updates asynchronously, and wait for all the replies in the commit
> callback?
Yes, I believe a lot of similar things are done within qemu, e.g. there can be
a bottom half scheduled so all things will be serialized using bql.
Btw, it's not only about whether vfio-user would survive with memory layout
change, I think the problem is vfio-user now released the bql without qemu core
qemu memory noticing it, while core memory relies on bql to serialize. That's
why we can get very strange rcu thread crash - it's potentially an outcome of
the race.
Thanks,
--
Peter Xu
prev parent reply other threads:[~2021-07-20 1:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-20 21:00 Question on memory commit during MR finalize() Peter Xu
2020-04-20 21:44 ` Paolo Bonzini
2020-04-20 23:31 ` Peter Xu
2020-04-21 9:43 ` Paolo Bonzini
2020-04-21 10:43 ` Peter Xu
2021-07-15 14:27 ` Thanos Makatos
2021-07-15 18:35 ` Peter Xu
2021-07-16 11:42 ` Thanos Makatos
2021-07-16 14:18 ` Peter Xu
2021-07-19 14:38 ` Thanos Makatos
2021-07-19 15:56 ` Peter Xu
2021-07-19 18:02 ` Thanos Makatos
2021-07-19 19:05 ` Thanos Makatos
2021-07-19 19:59 ` Peter Xu
2021-07-19 20:58 ` John Johnson
2021-07-20 1:22 ` Peter Xu [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=YPYlQUwIT/R0FkWP@t490s \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=john.g.johnson@oracle.com \
--cc=john.levon@nutanix.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thanos.makatos@nutanix.com \
/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;
as well as URLs for NNTP newsgroup(s).