[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: |
Peter Xu |
Subject: |
Re: [PATCH v7 6/6] memory: Introduce address_space_to_flatview_rcu() |
Date: |
Fri, 10 Mar 2023 10:08:13 -0500 |
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
- Re: [PATCH v7 2/6] rcu: Introduce rcu_read_is_locked(), (continued)