From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCHv2 5/6] xen: use ticket locks for spin locks Date: Tue, 21 Apr 2015 10:59:11 +0100 Message-ID: <55361F6F.7000502@citrix.com> References: <1428675597-28465-1-git-send-email-david.vrabel@citrix.com> <1428675597-28465-6-git-send-email-david.vrabel@citrix.com> <20150416120347.GJ13443@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YkUy7-0003H9-Sy for xen-devel@lists.xenproject.org; Tue, 21 Apr 2015 09:59:52 +0000 In-Reply-To: <20150416120347.GJ13443@deinos.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan , David Vrabel Cc: xen-devel@lists.xenproject.org, Keir Fraser , Ian Campbell , Jan Beulich , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On 16/04/15 13:03, Tim Deegan wrote: > >> +static int __spin_is_locked(spinlock_t *lock) >> +{ >> + return lock->tickets.head != lock->tickets.tail; >> +} > > Maybe atomic_read the lock and do the comparison on the local value? > Just from an abundance of caution - can't think of an obvious reason > why this race should matter. I think it would be preferable to avoid giving the impression that avoiding this race is important so I've left this as is (FWIW, the Linux implementation is like this). David