From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E89CECE58D for ; Wed, 9 Oct 2019 09:31:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2FDFD21835 for ; Wed, 9 Oct 2019 09:31:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Kf/+zvZ8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FDFD21835 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bCXxiFOGwL3NLIIipQIcQ9M/67qVnIoKHzAN6B17k/o=; b=Kf/+zvZ8mlX/zK 0tw6MM+wXRUBw/+CQcX97cRQ9/Dbo+6Rqe2OrwCxVOPX40X/RD8xAeHapaWrdgTDl+v5ykkKtqQlk GU5Dl5EKCdD2ZQinXPPB+1p/VNWZ3PQYB9sLidyf9HaZZn4u/7V+MuZFwX72Hr4/bbe7U0ataYl02 uoGjCAsi6iijmtYmOqT3kPjX9VNWpeTjy5NTwKYhR5c3ppkK1SFdKzwvZaUUrsFWnP7piRBulQ4vh oWqFvT4w9Q+8wy+QNQ8LUvYHbkv+r9sEL+on6BBCyTHIEtFYzgnaSK+HvhGR2uapE2lFwz6CQOOEu LSESl2EtGro8yXZa4ppA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iI8JX-0003a5-MQ; Wed, 09 Oct 2019 09:31:23 +0000 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.2 #3 (Red Hat Linux)) id 1iI8JU-0003Zf-NF; Wed, 09 Oct 2019 09:31:21 +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 879F7305DE2; Wed, 9 Oct 2019 11:30:26 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 48FC22022BA0D; Wed, 9 Oct 2019 11:31:18 +0200 (CEST) Date: Wed, 9 Oct 2019 11:31:18 +0200 From: Peter Zijlstra To: Arnd Bergmann Subject: Re: [RFC PATCH 0/3] Queued spinlocks/RW-locks for ARM Message-ID: <20191009093118.GJ2328@hirez.programming.kicks-ass.net> References: <20191007214439.27891-1-sebastian@breakpoint.cc> <56004687-af3e-3b8b-c9b5-21cd653db12b@redhat.com> <20191009084610.GG2311@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Russell King , Sebastian Andrzej Siewior , Ingo Molnar , Waiman Long , Will Deacon , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 09, 2019 at 10:57:25AM +0200, Arnd Bergmann wrote: > On Wed, Oct 9, 2019 at 10:46 AM Peter Zijlstra wrote: > > > > On Tue, Oct 08, 2019 at 04:32:27PM +0200, Arnd Bergmann wrote: > > > diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h > > > index 8b701f8e175c..6bf4964c105c 100644 > > > --- a/arch/arm/include/asm/cmpxchg.h > > > +++ b/arch/arm/include/asm/cmpxchg.h > > > @@ -114,6 +114,24 @@ static inline unsigned long __xchg(unsigned long > > > x, volatile void *ptr, int size > > > return ret; > > > } > > > > > > +#ifdef CONFIG_CPU_V6 > > > +static inline unsigned short smp_xchg16_relaxed(volatile unsigned > > > short *ptr, unsigned short x) > > > +{ > > > + unsigned short ret, tmp; > > > + asm volatile("@ smp_xchg16_relaxed\n" > > > + ".arch armv6k\n" > > > + "1: ldrexh %0, [%3]\n" > > > + " strexh %1, %2, [%3]\n" > > > + " teq %1, #0\n" > > > + " bne 1b" > > > + : "=&r" (ret), "=&r" (tmp) > > > + : "r" (x), "r" (ptr) > > > + : "memory", "cc"); > > > + return ret; > > > +} > > > +#define smp_xchg16_relaxed smp_xchg16_relaxed > > > +#endif > > > > Why is this not in __xchg() as a variant for case 2 ? > > ldrexh/strexh are instructions that are only available on SMP-capable > architecture revisions (ARMv6K or higher). When building a kernel > that runs both on pre-K ARMv6 uniprocessor systems and on later > SMP systems, __xchg() can only do 32-bit ldrex/strex. You can do u16 xchg using a u32 ll/sc, see openrisc's xchg_small(). _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel