Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753770AbbHCOI0 (ORCPT ); Mon, 3 Aug 2015 10:08:26 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:45037 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752171AbbHCOIZ (ORCPT ); Mon, 3 Aug 2015 10:08:25 -0400 Date: Mon, 3 Aug 2015 16:08:22 +0200 From: Peter Zijlstra To: Vineet Gupta Cc: lkml , "arc-linux-dev@synopsys.com" Subject: Re: [PATCH 5/6] ARCv2: spinlock/rwlock/atomics: Delayed retry of failed SCOND with exponential backoff Message-ID: <20150803140822.GR25159@twins.programming.kicks-ass.net> References: <1438596188-10875-1-git-send-email-vgupta@synopsys.com> <1438596188-10875-6-git-send-email-vgupta@synopsys.com> <20150803114104.GK25159@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1800 Lines: 47 On Mon, Aug 03, 2015 at 01:50:01PM +0000, Vineet Gupta wrote: > diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h > index 3dd36c1efee1..c2e012ca4560 100644 > --- a/arch/arc/include/asm/atomic.h > +++ b/arch/arc/include/asm/atomic.h > @@ -23,17 +23,50 @@ > > #define atomic_set(v, i) (((v)->counter) = (i)) > > +#ifdef CONFIG_ARC_STAR_9000923308 > + > +#define SCOND_FAIL_RETRY_VAR_DEF \ > + unsigned int delay = 1, tmp; \ > + > +#define SCOND_FAIL_RETRY_ASM \ > + " bz 4f \n" \ > + " ; --- scond fail delay --- \n" \ > + " mov %[tmp], %[delay] \n" /* tmp = delay */ \ > + "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \ > + " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \ > + " asl %[delay], %[delay], 1 \n" /* delay *= 2 */ \ You forgot the overflow test .. :-) > + " b 1b \n" /* start over */ \ > + "4: ; --- success --- \n" \ > + > +#define SCOND_FAIL_RETRY_VARS \ > + ,[delay] "+&r" (delay),[tmp] "=&r" (tmp) \ > + > +#else /* !CONFIG_ARC_STAR_9000923308 */ > + > +#define SCOND_FAIL_RETRY_VAR_DEF > + > +#define SCOND_FAIL_RETRY_ASM \ > + " bnz 1b \n" \ > + > +#define SCOND_FAIL_RETRY_VARS > + > +#endif But yes, much better. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/