[lkml]   [2015]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] x86 spinlock: Fix memory corruption on completing completions
On 02/11, Raghavendra K T wrote:
> On 02/10/2015 06:56 PM, Oleg Nesterov wrote:
>> In this case __ticket_check_and_clear_slowpath() really needs to cmpxchg
>> the whole .head_tail. Plus obviously more boring changes. This needs a
>> separate patch even _if_ this can work.
> Correct, but apart from this, before doing xadd in unlock,
> we would have to make sure lsb bit is cleared so that we can live with 1
> bit overflow to tail which is unused. now either or both of head,tail
> lsb bit may be set after unlock.

Sorry, can't understand... could you spell?

If TICKET_SLOWPATH_FLAG lives in .head arch_spin_unlock() could simply do

head = xadd(&lock->tickets.head, TICKET_LOCK_INC);


so it can't overflow to .tail?

But probably I missed your concern.

And we we do this, probably it makes sense to add something like

bool tickets_equal(__ticket_t one, __ticket_t two)
return (one ^ two) & ~TICKET_SLOWPATH_FLAG;

and change kvm_lock_spinning() to use tickets_equal(tickets.head, want), plus
it can have more users in asm/spinlock.h.


 \ /
  Last update: 2015-02-11 19:01    [W:0.071 / U:5.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site