|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCHv4 5/8] xen: use ticket locks for spin locks
At 14:13 +0100 on 11 May (1431353629), David Vrabel wrote:
> On 08/05/15 10:36, Jan Beulich wrote:
> >>
> >> + }
> >> + }
> >> smp_mb();
> >> }
> >
> > The old code had smp_mb() before _and_ after the check - is it really
> > correct to drop the one before (or effectively replace it by smp_rmb()
> > in observe_{lock,head}())?
>
> Typical usage is:
>
> d->is_dying = DOMDYING_dying;
> spin_barrier(&d->domain_lock);
>
> So there needs to be a barrier before we check that the lock is
> released. i.e., I removed the wrong smp_mb().
>
> I don't see the need for the second barrier since there's no stores in
> _spin_barrier() and observe_lock() and observe_head() both have their
> required read barriers.
You need the second smp_mb() to make sure that any post-barrier writes
don't happen before those reads (i.e. before the barrier).
E.g. evtchn_destroy() uses a barrier before modifying some state
(though in that case I think the read barrier might be enough because
the writes depend on reads, but you get the idea).
Tim.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |