Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753366AbbHCNCR (ORCPT ); Mon, 3 Aug 2015 09:02:17 -0400 Received: from smtprelay2.synopsys.com ([198.182.60.111]:58460 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753222AbbHCNCO convert rfc822-to-8bit (ORCPT ); Mon, 3 Aug 2015 09:02:14 -0400 From: Vineet Gupta To: Peter Zijlstra CC: lkml , "arc-linux-dev@synopsys.com" Subject: Re: [PATCH 5/6] ARCv2: spinlock/rwlock/atomics: Delayed retry of failed SCOND with exponential backoff Thread-Topic: [PATCH 5/6] ARCv2: spinlock/rwlock/atomics: Delayed retry of failed SCOND with exponential backoff Thread-Index: AQHQzeKpjbAtcvqjWUyBSa5w/nnd2g== Date: Mon, 3 Aug 2015 13:02:09 +0000 Message-ID: References: <1438596188-10875-1-git-send-email-vgupta@synopsys.com> <1438596188-10875-6-git-send-email-vgupta@synopsys.com> <20150803115059.GM25159@twins.programming.kicks-ass.net> Accept-Language: en-US, en-IN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.12.197.191] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1301 Lines: 32 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 -- 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/