qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v6 00/50] tcg tb_lock removal


From: Emilio G. Cota
Subject: Re: [Qemu-devel] [PATCH v6 00/50] tcg tb_lock removal
Date: Fri, 20 Oct 2017 22:34:10 -0400
User-agent: Mutt/1.5.24 (2015-08-30)

On Fri, Oct 20, 2017 at 09:10:38 +0200, Paolo Bonzini wrote:
> >> 2) in tb_for_each_tagged_safe, could the "prev" argument instead be
> >> "next", like
> > 
> > Is this just to make them closer to the macros in queue.h?
> > 
> > In this case tracking *prev in the loop (rather than next) is
> > useful because it makes removing the "current" element very simple:
> 
> This actually makes a lot of sense.  Maybe we should change queue.h the
> other way. ;)

Turns out this works here but it isn't as general-purpose as it
might look. In this case it works because we don't free the tb. If
we did, then we'd either need a branch in the iterator or a third
*next pointer.

In fact, the macro wouldn't be safe even if it tracked *next, since
on a removal *pprev must not be updated to the removed item.
IOW, the caller must be the one keeping track of *pprev, for otherwise
things break after the first removal. (Again, this doesn't affect this
particular instance, because its only caller stops iterating after
a removal.)

I have therefore given up on the macro and changed its only caller to
update *pprev. IMO it's less pretty, but more robust.

The updated branch with the changes you suggested (plus the above) is
available at:
  https://github.com/cota/qemu/tree/multi-tcg-v6-plus2

Thanks,

                Emilio



reply via email to

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