Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5731087imb; Fri, 8 Mar 2019 00:40:38 -0800 (PST) X-Google-Smtp-Source: APXvYqxPoCCvd2SdgfixpgR+UF3nrSDW5WHx8E7dks+gHVi/2FM54mLYxVTzpSRDybWiwu4vqeuI X-Received: by 2002:a17:902:9a88:: with SMTP id w8mr17642809plp.8.1552034437951; Fri, 08 Mar 2019 00:40:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552034437; cv=none; d=google.com; s=arc-20160816; b=fxZnpO0c7Sb4gn1LPxflTBmojrwr+x3/3c/9QpnIOUpzwQ80UcqtnE57cdxTch1Xu1 fN5ckLcgNf7tENEzpTx3voF/4fgTyWhOBIGxzkbOUbYQPcC6mAmEtZ/1k7kcgWoDyTGY bA1uzAp+dYQA0DPWBZe1YmtwBv5PSM0PF2EAW3B+hA2ca0AIhTIZB6vm6e6FAnCGZs4x BJ9hg8UefeaTl0xT/2Z3j3fO3eQmlOe4x593ufSlE802NnxVk4s0HDChtoMcwIgqHYeT Rgx4k7S8u20sKP7y16Q76errsfFZVflWTDez+mkVydvwX9Rol6+8O0m1LunnOk2C1YNN 1ukA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=u/uytGJIoZ1pDgJLD6BeysxYDLMjvKeAnFkPwxGb0KM=; b=DvSeAACrj1tC9cttQIMn9rYDWVgtcUdD8+k0ulnxDVivaA7Vutn3B9IjpKiQkia/Nz zb2nKBsTwaCccQUH5Mk11EnlHkD9mudReW/7mKpKDpn7mg8e5+op6uP0cT3FTH4zAtYe hprLGaJjtDP6nFTO2a3ujlP2ULckv38lUBH9fmN1NDGILCPlYTOpsKL6dmcs2zotmVpC HQFM4Z+TkgoAZhWPifd/T8Qg5BfzCqVToiKKcpeIR8+QjegJZMG3nlQdlwJhOWZnCyQI 9mwuzW6SFkIsYxER9DA0mLEl1YlMErVeUlVBqwRE1cV+MQNNoSxO3VjHYfy6jotwRUrt cIoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=hIH4dJUZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 91si6766123ply.258.2019.03.08.00.40.22; Fri, 08 Mar 2019 00:40:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=hIH4dJUZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726308AbfCHIjb (ORCPT + 99 others); Fri, 8 Mar 2019 03:39:31 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:41132 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725308AbfCHIjb (ORCPT ); Fri, 8 Mar 2019 03:39:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=u/uytGJIoZ1pDgJLD6BeysxYDLMjvKeAnFkPwxGb0KM=; b=hIH4dJUZrL28NNUrV6uxLRLM4 UxDNiQACFIoYfMvG7RxyleCgL+t6rex+mFhHN8WYIuVe0BociCXQDEJyjdx3ovxKgEiQviPoPqcog cQM6DdnIDXfW2b5rj2jP9EZ8pWlecicOWC+ZEvu7dJf/+7qImUEONYGXMjpHHXgFvQIyS5tErT4Zg gxTzgoiiCz/S5lFqrenRrgKXsw+37XJPgFrw/3kUmEOaQIaRvxd+JjMDDcVA6ml0hGuVI4MWL//CV pzI+RuXWpIXp5HEuuroQbD+NbtL013lW/pJrET6ZvIJrLnTzbo8coAq65YuiCL1fc2Jhh/0Se9pWE 9+ec8Vx4Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h2B2Q-0008Ck-8e; Fri, 08 Mar 2019 08:39:30 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AE00020262FAE; Fri, 8 Mar 2019 09:39:28 +0100 (CET) Date: Fri, 8 Mar 2019 09:39:28 +0100 From: Peter Zijlstra To: Vineet Gupta Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ARCv2: spinlock: remove the extra smp_mb before lock, after unlock Message-ID: <20190308083928.GQ32477@hirez.programming.kicks-ass.net> References: <1552008946-8008-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1552008946-8008-1-git-send-email-vgupta@synopsys.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 07, 2019 at 05:35:46PM -0800, Vineet Gupta wrote: > - ARCv2 LLSC based spinlocks smp_mb() both before and after the LLSC > instructions, which is not required per lkmm ACQ/REL semantics. > smp_mb() is only needed _after_ lock and _before_ unlock. > So remove the extra barriers. > The reason they were there was mainly historical. At the time of > initial SMP Linux bringup on HS38 cores, I was too conservative, > given the fluidity of both hw and sw. The last attempt to ditch the > extra barrier showed some hackbench regression which is apparently > not the case now (atleast for LLSC case, read on...) > > - EX based spinlocks (!CONFIG_ARC_HAS_LLSC) still needs the extra > smp_mb(), not due to lkmm, but due to some hardware shenanigans. > W/o that, hackbench triggers RCU stall splat. This is not a "real" > Linux use case anyways so I'm not worried about it. > > | [ARCLinux]# for i in (seq 1 1 5) ; do hackbench; done > | Running with 10 groups 400 process > | INFO: task hackbench:158 blocked for more than 10 seconds. > | Not tainted 4.20.0-00005-g96b18288a88e-dirty #117 > | "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. > | hackbench D 0 158 135 0x00000000 > | > | Stack Trace: > | watchdog: BUG: soft lockup - CPU#3 stuck for 59s! [hackbench:469] > | Modules linked in: > | Path: (null) > | CPU: 3 PID: 469 Comm: hackbench Not tainted 4.20.0-00005-g96b18288a88e-dirty > | > | [ECR ]: 0x00000000 => Check Programmer's Manual > | [EFA ]: 0x00000000 > | [BLINK ]: do_exit+0x4a6/0x7d0 > | [ERET ]: _raw_write_unlock_irq+0x44/0x5c > > - And while at it, remove the extar smp_mb() from EX based > arch_read_trylock() since the spin lock there guarantees a full > barrier anyways > > - For LLSC case, hackbench threads improves with this patch (HAPS @ 50MHz) > > ---- before ---- > | > | [ARCLinux]# for i in 1 2 3 4 5; do hackbench 10 thread; done > | Running with 10 groups 400 threads > | Time: 16.253 > | Time: 16.445 > | Time: 16.590 > | Time: 16.721 > | Time: 16.544 > > ---- after ---- > | > | [ARCLinux]# for i in 1 2 3 4 5; do hackbench 10 thread; done > | Running with 10 groups 400 threads > | Time: 15.638 > | Time: 15.730 > | Time: 15.870 > | Time: 15.842 > | Time: 15.729 > > Signed-off-by: Vineet Gupta Acked-by: Peter Zijlstra (Intel)