Re: [PATCH 4/6] kvm tools: Add rwlock wrapper

Ingo Molnar
2011-05-30T08:13:09Z

* Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:

> > The stop_machine_run()-alike thing is for brlocks - for which
> > Sasha sent patches already, see these patches on the
> > kvm@vger.kernel.org list:
> >
> > [PATCH 3/4] kvm tools: Add a brlock
> > [PATCH 4/4] kvm tools: Use brlock in MMIO and IOPORT
> >
> > Wrt. brlocks, we'll keep them as simple as possible and indeed no
> > involved tricks are needed AFAICS. read_lock() will be a compiler
> > barrier(), that's as fast as it gets :-)
>
> Makes sense!
>
> The other debugging use for the read-side primitives is to execute
> the read-side ready-do-respond-to-kvm-pause code. This can help
> catch bugs where the developer put the br_read_lock() and the
> br_read_unlock() in the wrong place.

That's a very good suggestion - it might in fact be simpler to
implement than the 'replace by rw_lock' debugging variant.

Thanks,

Ingo