Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2023-01-13 Thread Chuang Xu
Hi, Peter, On 2023/1/12 下午11:13, Peter Xu wrote: We wanted to capture outliers when you apply the follow up patch to vm load procedure. That will make depth>0 for the whole process of vm load during migration, and we wanted to make sure it's safe, hence this patch, right? In my perspective, b

Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2023-01-12 Thread Peter Xu
On Thu, Jan 12, 2023 at 03:59:55PM +0800, Chuang Xu wrote: > Hi, Peter, Paolo, Chuang, > > On 2023/1/10 下午10:45, Peter Xu wrote: > > On Tue, Jan 10, 2023 at 12:09:41AM -0800, Chuang Xu wrote: > > > Hi, Peter and Paolo, > > Hi, Chuang, Paolo, > > > > > I'm sorry I didn't reply to your email in t

Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2023-01-12 Thread Chuang Xu
Hi, Peter, Paolo, On 2023/1/10 下午10:45, Peter Xu wrote: On Tue, Jan 10, 2023 at 12:09:41AM -0800, Chuang Xu wrote: Hi, Peter and Paolo, Hi, Chuang, Paolo, I'm sorry I didn't reply to your email in time. I was infected with COVID-19 two weeks ago, so I couldn't think about the problems discus

Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2023-01-10 Thread Peter Xu
On Tue, Jan 10, 2023 at 12:09:41AM -0800, Chuang Xu wrote: > Hi, Peter and Paolo, Hi, Chuang, Paolo, > I'm sorry I didn't reply to your email in time. I was infected with > COVID-19 two weeks ago, so I couldn't think about the problems discussed > in your email for a long time.😷 > > On 2023/1/4

Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2023-01-10 Thread Chuang Xu
Hi, Peter and Paolo, I'm sorry I didn't reply to your email in time. I was infected with COVID-19 two weeks ago, so I couldn't think about the problems discussed in your email for a long time.😷 On 2023/1/4 上午1:43, Peter Xu wrote: > Hi, Paolo, > > On Wed, Dec 28, 2022 at 09:27:50AM +0100, Paolo Bon

Re: [External] Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2023-01-03 Thread Chuang Xu
On 2022/12/28 下午6:50, Philippe Mathieu-Daudé wrote: On 23/12/22 15:23, Chuang Xu wrote: Before using any flatview, sanity check we're not during a memory region transaction or the map can be invalid. Signed-off-by: Chuang Xu --- include/exec/memory.h | 9 + softmmu/memory.c | 5

Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2023-01-03 Thread Peter Xu
Hi, Paolo, On Wed, Dec 28, 2022 at 09:27:50AM +0100, Paolo Bonzini wrote: > Il ven 23 dic 2022, 16:54 Peter Xu ha scritto: > > > > This is not valid because the transaction could happen in *another* > > thread. > > > In that case memory_region_transaction_depth() will be > 0, but RCU is > > > ne

Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2022-12-28 Thread Philippe Mathieu-Daudé
On 23/12/22 15:23, Chuang Xu wrote: Before using any flatview, sanity check we're not during a memory region transaction or the map can be invalid. Signed-off-by: Chuang Xu --- include/exec/memory.h | 9 + softmmu/memory.c | 5 + 2 files changed, 14 insertions(+) diff --gi

Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2022-12-28 Thread Paolo Bonzini
Il ven 23 dic 2022, 16:54 Peter Xu ha scritto: > > This is not valid because the transaction could happen in *another* > thread. > > In that case memory_region_transaction_depth() will be > 0, but RCU is > > needed. > > Do you mean the code is wrong, or the comment? Note that the code has > chec

Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2022-12-23 Thread Peter Xu
Hi, Paolo, On Fri, Dec 23, 2022 at 04:47:57PM +0100, Paolo Bonzini wrote: > On 12/23/22 15:23, Chuang Xu wrote: > > static inline FlatView *address_space_to_flatview(AddressSpace *as) > > { > > +/* > > + * Before using any flatview, sanity check we're not during a memory > > + * re

Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2022-12-23 Thread Paolo Bonzini
On 12/23/22 15:23, Chuang Xu wrote: static inline FlatView *address_space_to_flatview(AddressSpace *as) { +/* + * Before using any flatview, sanity check we're not during a memory + * region transaction or the map can be invalid. Note that this can + * also be called during c

Re: [RFC v4 2/3] memory: add depth assert in address_space_to_flatview

2022-12-23 Thread Peter Xu
On Fri, Dec 23, 2022 at 10:23:06PM +0800, Chuang Xu wrote: > Before using any flatview, sanity check we're not during a memory > region transaction or the map can be invalid. > > Signed-off-by: Chuang Xu > --- > include/exec/memory.h | 9 + > softmmu/memory.c | 5 + > 2 files ch