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: Mon, 23 Apr 2018 20:27:36 -0400
User-agent: Mutt/1.5.24 (2015-08-30)

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;
> > +
> > +static struct page_lock_debug *get_page_lock_debug(const PageDesc *pd)
> > +{
> > +    struct page_lock_debug *pld;
> > +
> > +    QLIST_FOREACH(pld, &page_lock_debug_head, entry) {
> > +        if (pld->pd == pd) {
> > +            return pld;
> > +        }
> > +    }
> > +    return NULL;
> > +}
> 
> 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.

Thanks,

                Emilio 



reply via email to

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