qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 6/6] memory: Introduce address_space_to_flatview_rcu()


From: Chuang Xu
Subject: Re: [PATCH v7 6/6] memory: Introduce address_space_to_flatview_rcu()
Date: Mon, 13 Mar 2023 16:38:58 +0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.2

Hi, Peter,

On 2023/3/10 下午11:08, Peter Xu wrote:
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.

Previously I considered that there was no address_space_translate_iommu()
traced during vm_load, so I took it as safe. But my trace may not be
able to obtain all cases of triggering do_commit() during vm_load..


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

Yes, I'll fix it in v8 later.

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)

Thanks!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]