From: "Jan Beulich" Subject: Re: [PATCHv2 5/6] xen: use ticket locks for spin locks Date: Thu, 16 Apr 2015 14:32:52 +0100 Message-ID: <552FD6240200007800072CA7@mail.emea.novell.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.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yijub-0000fw-BF for xen-devel@lists.xenproject.org; Thu, 16 Apr 2015 13:32:57 +0000 In-Reply-To: <20150416120347.GJ13443@deinos.phlegethon.org> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel , Tim Deegan Cc: xen-devel@lists.xenproject.org, Keir Fraser , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org >>> On 16.04.15 at 14:03, wrote: > At 15:19 +0100 on 10 Apr (1428679196), David Vrabel wrote: >> Replace the byte locks with ticket locks. Ticket locks are: a) fair; >> and b) peform better when contented since they spin without an atomic >> operation. >> >> The lock is split into two ticket values: head and tail. A locker >> acquires a ticket by (atomically) increasing tail and using the >> previous tail value. A CPU holds the lock if its ticket == head. The >> lock is released by increasing head. >> >> Architectures need only provide an xadd() implementation. > > I like this. Thanks for measuring the IRQ latency too -- that's the > most nervous-making part of the overall change. While in general I like ticket locks too, the IRQ latency issue still worries me, and the promised experimental evidence that this is not an issue won't be able to fully eliminate that reservation. As already said in response to the v1 posting, while this likely isn't a primary usage scenario, running Xen itself as a guest of another hypervisor will (by analogy with what we know about Linux) immediately be known to be hampered by this. This isn't to say that I'm opposed to this going in, all I've been trying to point out is that we're set for another full re-work of spin locks if such a use case ever became more important to any user of Xen. Jan