[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150215161733.GB27608@redhat.com>
Date: Sun, 15 Feb 2015 17:17:33 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Raghavendra K T <raghavendra.kt@...ux.vnet.ibm.com>
Cc: tglx@...utronix.de, mingo@...hat.com, hpa@...or.com,
peterz@...radead.org, torvalds@...ux-foundation.org,
konrad.wilk@...cle.com, pbonzini@...hat.com,
paulmck@...ux.vnet.ibm.com, waiman.long@...com, davej@...hat.com,
x86@...nel.org, jeremy@...p.org, paul.gortmaker@...driver.com,
ak@...ux.intel.com, jasowang@...hat.com,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
xen-devel@...ts.xenproject.org, riel@...hat.com,
borntraeger@...ibm.com, akpm@...ux-foundation.org,
a.ryabinin@...sung.com, sasha.levin@...cle.com, dave@...olabs.net
Subject: Re: [PATCH V5] x86 spinlock: Fix memory corruption on completing
completions
Well, I regret I mentioned the lack of barrier after enter_slowpath ;)
On 02/15, Raghavendra K T wrote:
>
> @@ -46,7 +46,8 @@ static __always_inline bool static_key_false(struct static_key *key);
>
> static inline void __ticket_enter_slowpath(arch_spinlock_t *lock)
> {
> - set_bit(0, (volatile unsigned long *)&lock->tickets.tail);
> + set_bit(0, (volatile unsigned long *)&lock->tickets.head);
> + barrier();
> }
Because this barrier() looks really confusing.
Firsty, it is equally unneeded on x86. At the same time, it can not help.
We need a memory barrier() between set_bit(SLOWPATH) and READ_ONCE(head)
to avoid the race with spin_unlock().
So I think you should replace it with smp_mb__after_atomic() or remove it.
Other than that I believe this version is correct. So I won't insist, this
is cosmetic after all.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists