Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753134AbbHCLdi (ORCPT ); Mon, 3 Aug 2015 07:33:38 -0400 Received: from casper.infradead.org ([85.118.1.10]:47831 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752833AbbHCLdg (ORCPT ); Mon, 3 Aug 2015 07:33:36 -0400 Date: Mon, 3 Aug 2015 13:33:31 +0200 From: Peter Zijlstra To: Vineet Gupta Cc: lkml , arc-linux-dev@synopsys.com Subject: Re: [PATCH 4/6] ARC: LLOCK/SCOND based rwlock Message-ID: <20150803113331.GJ25159@twins.programming.kicks-ass.net> References: <1438596188-10875-1-git-send-email-vgupta@synopsys.com> <1438596188-10875-5-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1438596188-10875-5-git-send-email-vgupta@synopsys.com> 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: 1056 Lines: 37 On Mon, Aug 03, 2015 at 03:33:06PM +0530, Vineet Gupta wrote: > With LLOCK/SCOND, the rwlock counter can be atomically updated w/o need > for a guarding spin lock. Maybe re-iterate the exclusive vs shared spin story again. And aside from the far too many full barriers (again), I was just wondering about: > +static inline void arch_write_unlock(arch_rwlock_t *rw) > +{ > + unsigned int val; > + > + smp_mb(); > + > + /* > + * rw->counter = __ARCH_RW_LOCK_UNLOCKED__; > + */ > + __asm__ __volatile__( > + "1: llock %[val], [%[rwlock]] \n" > + " scond %[UNLOCKED], [%[rwlock]]\n" > + " bnz 1b \n" > + " \n" > + : [val] "=&r" (val) > + : [rwlock] "r" (&(rw->counter)), > + [UNLOCKED] "r" (__ARCH_RW_LOCK_UNLOCKED__) > + : "memory", "cc"); > + > + smp_mb(); > +} Why can't that be a straight store? -- 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/