public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	"arc-linux-dev@synopsys.com" <arc-linux-dev@synopsys.com>
Subject: Re: [PATCH 5/6] ARCv2: spinlock/rwlock/atomics: Delayed retry of failed SCOND with exponential backoff
Date: Mon, 3 Aug 2015 15:06:52 +0200	[thread overview]
Message-ID: <20150803130652.GO25159@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <C2D7FE5348E1B147BCA15975FBA23075665B0A0E@IN01WEMBXB.internal.synopsys.com>

On Mon, Aug 03, 2015 at 01:02:09PM +0000, Vineet Gupta wrote:
> On Monday 03 August 2015 05:21 PM, Peter Zijlstra wrote:
> 
> On Mon, Aug 03, 2015 at 03:33:07PM +0530, Vineet Gupta wrote:
> 
> 
> > +#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 */        \
> > +     "       b       1b                      \n"     /* start over */        \
> > +     "4: ; --- success ---                   \n"                             \
> 
> 
> One more note, you might want a test to handle the case where delay *= 2
> overflows and results in a 0.
> 
> 
> yeah !
> 
> - asl %[delay], %[delay], 1
> + asl.f  %[delay], %[delay], 1
> + mov.z %[delay], 1

The other obvious option is: 0x80000000 :-)

  reply	other threads:[~2015-08-03 13:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 10:03 [PATCH 0/6] ARC: spinlocks/atomics rework Vineet Gupta
2015-08-03 10:03 ` [PATCH 1/6] Revert "ARCv2: STAR 9000837815 workaround hardware exclusive transactions livelock" Vineet Gupta
2015-08-03 10:03 ` [PATCH 2/6] ARC: refactor atomic inline asm operands with symbolic names Vineet Gupta
2015-08-03 10:03 ` [PATCH 3/6] ARC: LLOCK/SCOND based spin_lock Vineet Gupta
2015-08-03 11:29   ` Peter Zijlstra
2015-08-03 11:44     ` Vineet Gupta
2015-08-03 10:03 ` [PATCH 4/6] ARC: LLOCK/SCOND based rwlock Vineet Gupta
2015-08-03 11:33   ` Peter Zijlstra
2015-08-03 11:51     ` Vineet Gupta
2015-08-03 10:03 ` [PATCH 5/6] ARCv2: spinlock/rwlock/atomics: Delayed retry of failed SCOND with exponential backoff Vineet Gupta
2015-08-03 11:41   ` Peter Zijlstra
2015-08-03 13:01     ` Vineet Gupta
2015-08-03 13:50       ` Vineet Gupta
2015-08-03 14:08         ` Peter Zijlstra
2015-08-03 11:50   ` Peter Zijlstra
2015-08-03 13:02     ` Vineet Gupta
2015-08-03 13:06       ` Peter Zijlstra [this message]
2015-08-03 10:03 ` [PATCH 6/6] ARCv2: spinlock/rwlock: Reset retry delay when starting a new spin-wait cycle Vineet Gupta
2015-08-03 11:43   ` Peter Zijlstra
2015-08-03 14:40     ` Vineet Gupta
2015-08-03 14:42       ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150803130652.GO25159@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=arc-linux-dev@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox