From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934044AbcHaNbE (ORCPT ); Wed, 31 Aug 2016 09:31:04 -0400 Received: from foss.arm.com ([217.140.101.70]:32788 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760223AbcHaNbC (ORCPT ); Wed, 31 Aug 2016 09:31:02 -0400 Subject: Re: [PATCH] [bugfix] replace unnessary ldax with common ldr To: Catalin Marinas , Kenneth Lee References: <1472538931-145463-1-git-send-email-liguozhu@hisilicon.com> <20160830090721.GC5163@e104818-lin.cambridge.arm.com> Cc: Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Vladimir Murzin Message-ID: <57C6DC00.2050709@arm.com> Date: Wed, 31 Aug 2016 14:30:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160830090721.GC5163@e104818-lin.cambridge.arm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/08/16 10:07, Catalin Marinas wrote: > On Tue, Aug 30, 2016 at 02:35:31PM +0800, Kenneth Lee wrote: >> (add comment for the previous mail, sorry for the duplication) >> >> There is no store_ex pairing with this load_ex. It is not necessary and >> gave wrong hint to the cache system. >> >> Signed-off-by: Kenneth Lee >> --- >> arch/arm64/include/asm/spinlock.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h >> index c85e96d..3334c4f 100644 >> --- a/arch/arm64/include/asm/spinlock.h >> +++ b/arch/arm64/include/asm/spinlock.h >> @@ -63,7 +63,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) >> */ >> " sevl\n" >> "2: wfe\n" >> -" ldaxrh %w2, %4\n" >> +" ldrh %w2, %4\n" >> " eor %w1, %w2, %w0, lsr #16\n" >> " cbnz %w1, 2b\n" >> /* We got the lock. Critical section starts here. */ > > This is needed because the arch_spin_unlock() code only uses an STLR > without an explicit SEV (like we have on AArch32). An event is > automatically generated when the exclusive monitor is cleared by STLR. > But without setting it with a load exclusive in arch_spin_lock() (even > though it does not acquire the lock), there won't be anything to clear, > hence no event to be generated. In this case, the WFE would wait > indefinitely. > Maybe worth to add this as a comment, no? Cheers Vladimir