Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp34532pxf; Wed, 24 Mar 2021 20:05:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIUrvGkFre/SvRa0DlFr4XumYmEC1yn1+fXnk+LKR5W/9BgOurd+vs9jIOvKF0AGl3Uo/c X-Received: by 2002:a05:6402:42d1:: with SMTP id i17mr6465531edc.131.1616641520889; Wed, 24 Mar 2021 20:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616641520; cv=none; d=google.com; s=arc-20160816; b=vhe4bjQYmI0SO+9qBB+k81qo1+kOoFy2wDywrSYjZRg3U5wOQHRBZcY97UPRrx/PKq EapeKvU0FowgQYNeuE6Azdq3o/uyjc66UxT9OrGJ9ZSykvqX3GeSelPzR+CSyjXV1BUA +krZVPiJIq1Cg7zqRo5RpHXqktjUb6n/DkHlw4AhjVnsHLG88zB6XGSEeDA1pi0kku9l C59zxlVaRDgxtc8U8jGNtaozvYy2JiBIXOJGzAd6wa/aOJKjLQlal5KR8wVLaZ7zpV1c fdoMIOqsGGJp9AorkuDJ1JOXR2OBsfJywxOUf4d2cGXw/UeAIMvquYc3eDBJ6gnrUEhg VO9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RrFr490dFRvD+R99oCaLdve7Nm3IkFIKrRyx/bsnPjw=; b=fLeqXXikQvsSv5RdOM41zQd/gvh4a2SOkWLy7w2cy3Km5+eI7bx0nAS0J4IFNOtyR5 xpLN91kmDkRg9JgcLcKZWD7Xsl5DPhGao1u8vwETkpgjO8Yd6M9M9TI/Rzo2KsOE0LmA UUURkb3zqLAADMKkztH6rzV0vQiZ4cv294I5v+R2fTtKQJyNQzYjLqguuVF9qYxi6Fug zXcATLrFTTug1K2EDtfHOJ0RRR9xtTh/8hU3swv//eDawEKuq6fivVa3iR47fLwJeEEc kD8wIxZ7iovMWXVf9qu9iDLLUDIP5c7Gtcq9v+g8CjGbdgX01cUADE1fKh8ZCgs1EbdN +SRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pCjx6OdE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id br23si3174258ejb.740.2021.03.24.20.04.58; Wed, 24 Mar 2021 20:05:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pCjx6OdE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234308AbhCXMjf (ORCPT + 99 others); Wed, 24 Mar 2021 08:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233111AbhCXMjU (ORCPT ); Wed, 24 Mar 2021 08:39:20 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C282C061763 for ; Wed, 24 Mar 2021 05:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=RrFr490dFRvD+R99oCaLdve7Nm3IkFIKrRyx/bsnPjw=; b=pCjx6OdE08VvbOSiDs5kXJYRfY lb6q5yV7oK21uCsJurgbts409+Y33BBPfIzSDl0cPL44qmR68W42PFq2xBQ0qGwVBugETmOVyaeot w1eswJnqfkAWVwstGiKCTAVFlNDVrkleJvnT+XxAU5SsNRpEGhEzIIQ7A4599wb8UzDRMpkgdU1IG AvWhv6UX1oD5IfuJZcBJk8R6ygN/zKr6YrqUgE+Uulzlozczzma83KFb7/s7Vi/mO81BfGLItSqux DI9uia8RCVxcbJr4sI09MAhA8ZTK1v/saDTRqlhCiK/sSHYl67RXk3MXvixORZZXJ+bQBVH1AedNa 67chedKA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lP2lY-00BLAE-Vp; Wed, 24 Mar 2021 12:37:45 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 60B6B301A7A; Wed, 24 Mar 2021 13:37:40 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4473E2BF5B73E; Wed, 24 Mar 2021 13:37:40 +0100 (CET) Date: Wed, 24 Mar 2021 13:37:40 +0100 From: Peter Zijlstra To: Anup Patel Cc: Guo Ren , linux-riscv , "linux-kernel@vger.kernel.org List" , Guo Ren , Catalin Marinas , Will Deacon , Palmer Dabbelt , Arnd Bergmann Subject: Re: [PATCH] riscv: locks: introduce ticket-based spinlock implementation Message-ID: References: <1616580892-80815-1-git-send-email-guoren@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 24, 2021 at 05:58:58PM +0530, Anup Patel wrote: > On Wed, Mar 24, 2021 at 3:45 PM wrote: > > > > From: Guo Ren > > > > This patch introduces a ticket lock implementation for riscv, along the > > same lines as the implementation for arch/arm & arch/csky. > > > > Signed-off-by: Guo Ren > > Cc: Catalin Marinas > > Cc: Will Deacon > > Cc: Peter Zijlstra > > Cc: Palmer Dabbelt > > Cc: Anup Patel > > Cc: Arnd Bergmann > > --- > > arch/riscv/Kconfig | 1 + > > arch/riscv/include/asm/Kbuild | 1 + > > arch/riscv/include/asm/spinlock.h | 158 ++++++++++++-------------------- > > arch/riscv/include/asm/spinlock_types.h | 19 ++-- > > NACK from myside. > > Linux ARM64 has moved away from ticket spinlock to qspinlock. > > We should directly go for qspinlock. I think it is a sensible intermediate step, even if you want to go qspinlock. Ticket locks are more or less trivial and get you fairness and all that goodness without the mind bending complexity of qspinlock. Once you have the ticket lock implementation solid (and qrwlock) and everything, *then* start to carefully look at qspinlock. Now, arguably arm64 did the heavy lifting of making qspinlock good on weak architectures, but if you want to do it right, you still have to analyze the whole thing for your own architecture.