On 08/07/16 23:52, Paolo Bonzini wrote: > > On 08/07/2016 22:24, Sergey Fedorov wrote: >> I remember, I've just found that we discussed it in this thread: >> >> http://thread.gmane.org/gmane.comp.emulators.qemu/401723/focus=406852 >> >> I was thinking of just doing 'tb_jmp_cache' lookup out of the lock, not >> tb_find_physical(). Now thanks to QHT, we could do tb_find_physical() >> out of the lock, too. This changes things. > But in my patch ("tcg: move tb_find_fast outside the tb_lock critical > section", which originally was written by Fred---most of my contribution > was getting the invalidation right, not the lock-free lookup) > tb_find_physical was also done out of the lock. It was then retried > inside the lock, if it failed. > > This is why I needed to fail all concurrent lookups as the first step in > the invalidation. > > Emilio's QHT resulted in a rewrite of tb_find_physical, but the basic > concepts are the same.
That could work, I think, if we re-check under tb_lock whether the TB is still valid before adding a direct jump to it. Kind regards, Sergey