qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 11/17] translate-all: add page_locked asserti


From: Emilio G. Cota
Subject: Re: [Qemu-devel] [PATCH v2 11/17] translate-all: add page_locked assertions
Date: Thu, 10 May 2018 17:36:08 -0400
User-agent: Mutt/1.5.24 (2015-08-30)

On Mon, Apr 23, 2018 at 20:27:36 -0400, Emilio G. Cota wrote:
> On Fri, Apr 13, 2018 at 17:31:20 -1000, Richard Henderson wrote:
> > On 04/05/2018 04:13 PM, Emilio G. Cota wrote:
> > > +#ifdef CONFIG_DEBUG_TCG
> > > +
> > > +struct page_lock_debug {
> > > +    const PageDesc *pd;
> > > +    QLIST_ENTRY(page_lock_debug) entry;
> > > +};
> > > +
> > > +static __thread QLIST_HEAD(, page_lock_debug) page_lock_debug_head;
(snip)
> > Why do you need a separate data structure for this?
> 
> The alternative would be to:
> - reuse page_collection, but in some cases we lock pages without
>   page_collection
> - Expand PageDesc with a bool, but that state would be global
>   and not per-thread, which could hide actual bugs (e.g. we
>   could see that the bool is set and not assert, despite
>   the bool having been set by another thread).
> 
> I figured a per-thread list would be appropriate here,
> since it doesn't have the problems of the above solutions,
> and is simple--and slow, which is why it's under DEBUG_TCG.

In v3 I've changed this to use a per-thread g_hash_table as a
hash map.

                E.



reply via email to

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