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

Re: [Xen-devel] [PATCH v2] xen/x86: lock cacheline for add_sized()



On 07.08.2019 09:32, Juergen Gross wrote:
add_sized() should use an atomic update of the memory word, as it is
used by spin_unlock().

Ticket locks are using a read-modify-write operation on parts of the
lockword for unlocking, while trying to lock is done by an atomic
update of the complete lockword. This requires the unlock operation to
be atomic, too, as otherwise the unlock might not write back the
correct data.

I have to take back my reply to v1, and hence I'm afraid that
if the change is really needed the description is still
insufficient. Let's look at both sides: Acquire is a LOCKed
read-modify-write of the full word, with the additional
property that the value written back to the low half is
unchanged from the value read. Release is

        read low half
        increment low half
        write low half

Since the low half doesn't change during any acquire (including
attempts, i.e. try-lock), it doesn't matter if it races with
the above sequence. It can freely happen between any two of the
three steps.

Therefore what I'm really after is (a) clarification whether
the issue you mean to fix was observed in practice and (b) a
concrete scenario where things would go wrong.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.