From: David Hildenbrand <david@redhat.com>
To: Peter Xu <peterx@redhat.com>, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Richard Henderson" <rth@twiddle.net>
Subject: Re: [PATCH v3 3/8] memory: Introduce memory_region_transaction_depth_{inc|dec}()
Date: Wed, 28 Jul 2021 22:06:53 +0200 [thread overview]
Message-ID: <b9c34e9b-c2e9-58ef-d2b2-3a6e72764cb5@redhat.com> (raw)
In-Reply-To: <20210728183151.195139-4-peterx@redhat.com>
On 28.07.21 20:31, Peter Xu wrote:
> memory_region_transaction_{begin|commit}() could be too big when finalizing a
> memory region. E.g., we should never attempt to update address space topology
> during the finalize() of a memory region. Provide helpers for further use.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> softmmu/memory.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/softmmu/memory.c b/softmmu/memory.c
> index bfedaf9c4d..725d57ec17 100644
> --- a/softmmu/memory.c
> +++ b/softmmu/memory.c
> @@ -1079,10 +1079,20 @@ static void address_space_update_topology(AddressSpace *as)
> address_space_set_flatview(as);
> }
>
> +static void memory_region_transaction_depth_inc(void)
> +{
> + memory_region_transaction_depth++;
> +}
> +
> +static void memory_region_transaction_depth_dec(void)
> +{
> + memory_region_transaction_depth--;
> +}
> +
> void memory_region_transaction_begin(void)
> {
> qemu_flush_coalesced_mmio_buffer();
> - ++memory_region_transaction_depth;
> + memory_region_transaction_depth_inc();
> }
>
> void memory_region_transaction_commit(void)
> @@ -1092,7 +1102,7 @@ void memory_region_transaction_commit(void)
> assert(memory_region_transaction_depth);
> assert(qemu_mutex_iothread_locked());
>
> - --memory_region_transaction_depth;
> + memory_region_transaction_depth_dec();
> if (!memory_region_transaction_depth) {
> if (memory_region_update_pending) {
> flatviews_reset();
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2021-07-28 20:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-28 18:31 [PATCH v3 0/8] memory: Sanity checks memory transaction when releasing BQL Peter Xu
2021-07-28 18:31 ` [PATCH v3 1/8] cpus: Export queue work related fields to cpu.h Peter Xu
2021-07-28 18:40 ` Philippe Mathieu-Daudé
2021-07-28 18:31 ` [PATCH v3 2/8] cpus: Move do_run_on_cpu into softmmu/cpus.c Peter Xu
2021-07-28 18:35 ` Philippe Mathieu-Daudé
2021-07-28 18:31 ` [PATCH v3 3/8] memory: Introduce memory_region_transaction_depth_{inc|dec}() Peter Xu
2021-07-28 20:06 ` David Hildenbrand [this message]
2021-07-28 18:31 ` [PATCH v3 4/8] memory: Don't do topology update in memory finalize() Peter Xu
2021-07-28 18:31 ` [PATCH v3 5/8] cpus: Use qemu_cond_wait_iothread() where proper Peter Xu
2021-07-28 18:38 ` Philippe Mathieu-Daudé
2021-07-28 18:31 ` [PATCH v3 6/8] cpus: Remove the mutex parameter from do_run_on_cpu() Peter Xu
2021-07-28 18:39 ` Philippe Mathieu-Daudé
2021-07-28 18:31 ` [PATCH v3 7/8] memory: Assert on no ongoing memory transaction before release BQL Peter Xu
2021-07-28 18:31 ` [PATCH v3 8/8] memory: Delay the transaction pop() until commit completed Peter Xu
2021-09-08 15:30 ` [PATCH v3 0/8] memory: Sanity checks memory transaction when releasing BQL 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=b9c34e9b-c2e9-58ef-d2b2-3a6e72764cb5@redhat.com \
--to=david@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).