qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Chuang Xu <xuchuangxclwt@bytedance.com>
Cc: qemu-devel@nongnu.org, dgilbert@redhat.com, quintela@redhat.com,
	pbonzini@redhat.com, david@redhat.com, philmd@linaro.org,
	zhouyibo@bytedance.com
Subject: Re: [PATCH v7 6/6] memory: Introduce address_space_to_flatview_rcu()
Date: Fri, 10 Mar 2023 10:08:13 -0500	[thread overview]
Message-ID: <ZAtH3XgTtqwTpcOS@x1n> (raw)
In-Reply-To: <20230310022425.2992472-7-xuchuangxclwt@bytedance.com>

On Fri, Mar 10, 2023 at 10:24:25AM +0800, Chuang Xu wrote:
> In last patch, we wrap vm_load with begin/commit, here we introduce
> address_space_to_flatview_rcu() to avoid unnecessary enforce commit
> during vm_load.
> 
> Signed-off-by: Chuang Xu <xuchuangxclwt@bytedance.com>
> ---
>  include/exec/memory-internal.h |  2 +-
>  include/exec/memory.h          | 20 ++++++++++++++++++++
>  softmmu/memory.c               |  2 +-
>  3 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
> index 100c1237ac..1432240449 100644
> --- a/include/exec/memory-internal.h
> +++ b/include/exec/memory-internal.h
> @@ -30,7 +30,7 @@ static inline AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv)
>  
>  static inline AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as)
>  {
> -    return flatview_to_dispatch(address_space_to_flatview(as));
> +    return flatview_to_dispatch(address_space_to_flatview_rcu(as));
>  }

I'm not sure whether this one is always safe.

tcg_commit() seems to be safe, but maybe address_space_translate_iommu() is
not?  Maybe easier to leave this untouched?

>  
>  FlatView *address_space_get_flatview(AddressSpace *as);
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index d6fd89db64..235e3017bc 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -1100,6 +1100,9 @@ bool memory_region_transaction_in_progress(void);
>  
>  void memory_region_transaction_do_commit(void);
>  
> +/*
> + * We recommend using this by default.
> + */

I think this comment doesn't really help.. drop it?

>  static inline FlatView *address_space_to_flatview(AddressSpace *as)

-- 
Peter Xu



  reply	other threads:[~2023-03-10 15:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10  2:24 [PATCH v7 0/6] migration: reduce time of loading non-iterable vmstate Chuang Xu
2023-03-10  2:24 ` [PATCH v7 1/6] memory: Reference as->current_map directly in memory commit Chuang Xu
2023-03-14 11:25   ` David Edmondson
2023-03-10  2:24 ` [PATCH v7 2/6] rcu: Introduce rcu_read_is_locked() Chuang Xu
2023-03-10 14:50   ` Peter Xu
2023-03-10  2:24 ` [PATCH v7 3/6] memory: Introduce memory_region_transaction_do_commit() Chuang Xu
2023-03-10 14:51   ` Peter Xu
2023-03-13  2:53     ` Chuang Xu
2023-03-10  2:24 ` [PATCH v7 4/6] memory: Add sanity check in address_space_to_flatview Chuang Xu
2023-03-10 14:56   ` Peter Xu
2023-03-10  2:24 ` [PATCH v7 5/6] migration: Reduce time of loading non-iterable vmstate Chuang Xu
2023-03-10 14:58   ` Peter Xu
2023-03-16 10:46   ` Juan Quintela
2023-03-10  2:24 ` [PATCH v7 6/6] memory: Introduce address_space_to_flatview_rcu() Chuang Xu
2023-03-10 15:08   ` Peter Xu [this message]
2023-03-13  8:38     ` Chuang 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=ZAtH3XgTtqwTpcOS@x1n \
    --to=peterx@redhat.com \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=xuchuangxclwt@bytedance.com \
    --cc=zhouyibo@bytedance.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).