[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
- [Qemu-devel] [PATCH v2 00/17] tcg: tb_lock_removal redux v2, Emilio G. Cota, 2018/04/05
- [Qemu-devel] [PATCH v2 06/17] translate-all: make l1_map lockless, Emilio G. Cota, 2018/04/05
- [Qemu-devel] [PATCH v2 11/17] translate-all: add page_locked assertions, Emilio G. Cota, 2018/04/05
- [Qemu-devel] [PATCH v2 02/17] qht: return existing entry when qht_insert fails, Emilio G. Cota, 2018/04/05
- [Qemu-devel] [PATCH v2 08/17] translate-all: work page-by-page in tb_invalidate_phys_range_1, Emilio G. Cota, 2018/04/05
- [Qemu-devel] [PATCH v2 16/17] translate-all: remove tb_lock mention from cpu_restore_state_from_tb, Emilio G. Cota, 2018/04/05
- [Qemu-devel] [PATCH v2 13/17] translate-all: discard TB when tb_link_page returns an existing matching TB, Emilio G. Cota, 2018/04/05
- [Qemu-devel] [PATCH v2 01/17] qht: require a default comparison function, Emilio G. Cota, 2018/04/05
- [Qemu-devel] [PATCH v2 07/17] translate-all: remove hole in PageDesc, Emilio G. Cota, 2018/04/05
- [Qemu-devel] [PATCH v2 09/17] translate-all: move tb_invalidate_phys_page_range up in the file, Emilio G. Cota, 2018/04/05
- [Qemu-devel] [PATCH v2 04/17] tcg: move tb_ctx.tb_phys_invalidate_count to tcg_ctx, Emilio G. Cota, 2018/04/05