[PATCH] ARM: spinlock: avoid exclusive accesses on unlock() path

STALE2968d

2 messages, 2 authors, 2018-08-07 · open the first message on its own page

[PATCH] ARM: spinlock: avoid exclusive accesses on unlock() path

From: 马文健 <hidden>
Date: 2018-08-07 01:59:13

Hi
while one cpu is doing arch_spin_unlock,another cpu doing arch_spin_lock
the first cpu's
lock->tickets.owner++;
may be over writed by the second's 
strex	%2, %1, [%3]\n
so the owner filed doesn't get increased. 

But i'm not sure about this, may be there are something i have missed. 

Thanks.

------------------ Original ------------------

[PATCH] ARM: spinlock: avoid exclusive accesses on unlock() path

From: Will Deacon <hidden>
Date: 2018-08-07 16:56:39

On Tue, Aug 07, 2018 at 09:59:13AM +0800, ??? wrote:
while one cpu is doing arch_spin_unlock,another cpu doing arch_spin_lock
the first cpu's
lock->tickets.owner++;
may be over writed by the second's 
strex	%2, %1, [%3]\n
so the owner filed doesn't get increased. 
I don't see how this can happen. If the unlocker writes to the owner field
in-between the locker's LDXR/STXR pair (which is the only way the harmful
overwrite could occur as far as I can tell), then the STXR will fail and not
update memory.

Are you actually seeing a problem here?

Will
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help