Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1822531imm; Fri, 6 Jul 2018 07:09:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpefZ762smWFZYvHF5FST6pUrpv3C54P5R9VnCcHiu2P3IX581z7C8WhXw3rEN5vi2QOuZmm X-Received: by 2002:a63:7c18:: with SMTP id x24-v6mr9611325pgc.311.1530886147150; Fri, 06 Jul 2018 07:09:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530886147; cv=none; d=google.com; s=arc-20160816; b=hD4esiAhUshks6ZCUAC4Ga5b6lFSd5K07oQchDHkWKNZJ2U+CUEhHCToDTTpxUyxYz DawHSpEmplnjMTsZnRZ1JtV8bzzzw1LzLbhsJyq43ZRU9+5GKTikvMru6VIyNy9IxGxw /CoDUFTDcTdMEZVpw9aXhC6wJlyrZeqa6heFH+5b0m/+va1BEN9EBuo6syvaXXOSCc1i gdg98myfLpjU+B2YolEoEucmZDwuogj73OG7wB0rLTnIEL1JvQ2Vd85T1Zs/ULWfPR03 opiovL302pqi0PVA6y5+CopsVr/1ryAl91ziZs/ZYGI315Gk0369o9/bFdR13EueT9pX zKKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Q9UjvVqnGNmh3IhoWjrIlyEiSvuqlAhEg29XfNg75f8=; b=avW0nhNe+UMH8mCmM7HRikzac7UKJegtOBQdwsGXxPoMylu9sLkKRH0xpTWEiFo2is QLeqjF+MTdGOjClEOJPvnwgJ1vKOxHNwI3uWZBIIzxcCi8MEJqB6QglLy8csNS0S950S 5ISSMGGmEWTNE6uF+xrFtYrhHyKC15lAt++S2bRTGYC+rZXNx2/iop0JhrQb0oahtY/G Oq7sbEN6VCD4DUoFvSB0TCMS9P1vF2/0pg6+IWbmuhhO+W6voYzSzDBfIkjhPb5C1bmZ L5sGUcoN0K0OXpxCWky+yI2fHXOm6iieRlM/SCQ1TPW64igmqxSVBD3giPukU0wa+NOE RG1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p83-v6si8760491pfa.180.2018.07.06.07.08.41; Fri, 06 Jul 2018 07:09:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753956AbeGFOHj (ORCPT + 99 others); Fri, 6 Jul 2018 10:07:39 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:57816 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753652AbeGFOHh (ORCPT ); Fri, 6 Jul 2018 10:07:37 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.08794352|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e02c03312;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=12;RT=12;SR=0;TI=SMTPD_---.CN6tvVZ_1530886019; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:SMTPD_---.CN6tvVZ_1530886019) by smtp.aliyun-inc.com(10.147.40.44); Fri, 06 Jul 2018 22:06:59 +0800 Date: Fri, 6 Jul 2018 22:06:59 +0800 From: Guo Ren To: Peter Zijlstra Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, daniel.lezcano@linaro.org, jason@lakedaemon.net, arnd@arndb.de, c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, thomas.petazzoni@bootlin.com, wbx@uclibc-ng.org, green.hu@gmail.com Subject: Re: [PATCH V2 11/19] csky: Atomic operations Message-ID: <20180706140659.GB25190@guoren> References: <860b8db036b33d7b3648cb1f4ec827a53dc1a01b.1530465326.git.ren_guo@c-sky.com> <20180705175902.GF2530@hirez.programming.kicks-ass.net> <20180706114402.GB27148@guoren> <20180706120323.GW2476@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180706120323.GW2476@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 06, 2018 at 02:03:23PM +0200, Peter Zijlstra wrote: > > > Test-and-set with MB acting as ACQUIRE, ok. > > Em ... Ok, I'll try to use test-and-set function instead of it. > > "test-and-set" is just the name of this type of spinlock implementation. > > You _could_ use the linux test_and_set bitop, but those are defined on > unsigned long and spinlock_t is generally assumed to be of unsigned int > size. > > Go with the ticket locks as per below. Ok, I'll learn it. > > Ok, I'll try to implement ticket lock in next version patch. > > If you need inspiration, look at: > arch/arm/include/asm/spinlock.h > > Or look at the current version of that file and ignore the LSE version. > > Note that unlock is a store half-word (u16), not having seen your arch > manual yet I don't know if you even have that. Nice tips, thank you very much. Guo Ren