From: Peter Xu <peterx@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
QEMU Devel Mailing List <qemu-devel@nongnu.org>
Subject: Re: Question on memory commit during MR finalize()
Date: Tue, 21 Apr 2020 06:43:34 -0400 [thread overview]
Message-ID: <20200421104334.GC420399@xz-x1> (raw)
In-Reply-To: <5ed295a3-9e4a-0dca-adc6-5361dc78a83c@redhat.com>
On Tue, Apr 21, 2020 at 11:43:36AM +0200, Paolo Bonzini wrote:
> On 21/04/20 01:31, Peter Xu wrote:
> >>
> >> However, instead of memory_region_transaction_commit,
> >> memory_region_finalize probably should do something like
> >>
> >> --memory_region_transaction_depth;
> >> assert (memory_region_transaction_depth ||
> >> (!memory_region_update_pending &&
> >> !ioeventfd_update_pending));
> > Ah I see; this makes sense.
> >
> > And finally I found the problem, which is indeed the bug in my own tree - I
> > forgot to remove the previous changes to flush the dirty ring during mem
> > removal (basically that's run_on_cpu() called during a memory commit, that will
> > wrongly release the BQL without being noticed).
> >
> > Besides above assert, I'm thinking maybe we can also assert on something like:
> >
> > !(memory_region_transaction_depth || memory_region_update_pending ||
> > ioeventfd_update_pending)
> >
> > When releasing BQL (unlock, or qemu_cond_wait() on BQL, which should cover
> > run_on_cpu()), so that we can identify misuse of BQL easier like this.
>
> Asserting invariants around lock release are an interesting concept, but
> I'm not sure where to insert them exactly. But it would be great if you
> would like to introduce an assert_empty_memory_transaction() function
> with the assertion I quoted above.
Let me give it a shot later today. :)
--
Peter Xu
next prev parent reply other threads:[~2020-04-21 10:44 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 [this message]
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
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=20200421104334.GC420399@xz-x1 \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).