Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp892035imm; Fri, 28 Sep 2018 08:28:51 -0700 (PDT) X-Google-Smtp-Source: ACcGV61eZhKxvT3v4ESVYmZm43i6wOJCYyFU5jfKhSFOLn/YCuxtKqQM27LxTTiFJlJNn9lBskPs X-Received: by 2002:a63:7a50:: with SMTP id j16-v6mr15775925pgn.112.1538148531747; Fri, 28 Sep 2018 08:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538148531; cv=none; d=google.com; s=arc-20160816; b=m7KCrQkwRmlCtoyPjpN9JcrgWDf2pvbf1wotLOlK4O8YJDUzFCHKxuBPbePkqNXtrz tsFbLSxu4ilotdAR9v5ULOvBQMzokEiZFSwZdcPAySgY1iZxhpRhqgk+Piags11HBxUf 2YPd3hI6+kJnCEVNS8nUwEEK5863zXvh0vHvBpfhJSSBcb57UdZDX25R7LB9iXIDaS2U h7GdvXP8rA4II6YAjaO99IgGT/3Azf3FAr0s17smiBSxEq8gVPeMzZMcCHA3J1SpUG5g YkKk0/xfUWTmbJXsypExAKSgIwXfW9YFjH4PhBP0H1FUypnkQZBI/rK09sJkha3uVuHj wDJQ== 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; bh=ACoku8FQPCjiCfMla+hWQBXH9zWg3rqGpxhjYmyLTqQ=; b=W7QiakB5vMTZubzqAS7T/3F3UA9tS6FAb5UfMYvka+q0zspsLTq0zuvjw44u/c5A6P frX0d/EhZg0g3xkWKTr3T6sYvpPjrUPWyNJvER3ZDn7ykyPpVXTJ3MYOkEvk4KeFlyRs vvpom396uOEUYm95+ay8NSgR1nNoLnpcPLeq7tlNsvP0FmsTqjfHZIOZcoyCnvVeCZhz 8HsqagLoFLK68Kr/Bpwvbl3jHvqcWoJWIMG19LWCJl4Pkk9tCoQfMDcIlZYY4InWrqKF ONus9yiUM29IXczLVT3G+1JHEIFR6ki2xbDP5VDtYCzL+Bo/r8+oLWOH9J/wPTO58o7K GZfQ== ARC-Authentication-Results: i=1; mx.google.com; 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 190-v6si3026934pfc.95.2018.09.28.08.28.35; Fri, 28 Sep 2018 08:28:51 -0700 (PDT) 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; 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 S1729093AbeI1VvH (ORCPT + 99 others); Fri, 28 Sep 2018 17:51:07 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:54701 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbeI1VvG (ORCPT ); Fri, 28 Sep 2018 17:51:06 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1g5ufG-0001AI-Qw; Fri, 28 Sep 2018 17:26:46 +0200 Date: Fri, 28 Sep 2018 17:26:46 +0200 From: Kurt Kanzenbach To: Will Deacon Cc: Thomas Gleixner , Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, Daniel Wagner , Peter Zijlstra , x86@kernel.org, Linus Torvalds , "H. Peter Anvin" , Boqun Feng , "Paul E. McKenney" , Mark Rutland Subject: Re: [Problem] Cache line starvation Message-ID: <20180928152646.mzjpwtj3qqvdnrlx@linutronix.de> References: <20180921120226.6xjgr4oiho22ex75@linutronix.de> <20180926125301.GE2979@brain-police> <20180927142547.ucgh5elb7pxs46dq@linutronix.de> <20180927144127.qdkem4juhztxdkdb@linutronix.de> <20180928090521.mj5elgqnla6qcz2r@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180928090521.mj5elgqnla6qcz2r@linutronix.de> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 28, 2018 at 11:05:21AM +0200, Kurt Kanzenbach wrote: > Hi Thomas, > > On Thu, Sep 27, 2018 at 04:47:47PM +0200, Thomas Gleixner wrote: > > On Thu, 27 Sep 2018, Kurt Kanzenbach wrote: > > > On Thu, Sep 27, 2018 at 04:25:47PM +0200, Kurt Kanzenbach wrote: > > > > However, the issue still triggers fine. With stress-ng we're able to > > > > generate latency in millisecond range. The only workaround we've found > > > > so far is to add a "delay" in cpu_relax(). > > > > > > It might interesting for you, how we added the delay. We've used: > > > > > > static inline void cpu_relax(void) > > > { > > > volatile int i = 0; > > > > > > asm volatile("yield" ::: "memory"); > > > while (i++ <= 1000); > > > } > > > > > > Of course it's not efficient, but it works. > > > > I wonder if it's just the store on the stack which makes it work. I've seen > > that when instrumenting x86. When the careful instrumentation just stayed > > in registers it failed. Once it was too much and stack got involved it > > vanished away. > > I've performed more tests: Adding a store to a global variable just > before calling cpu_relax() doesn't help. Furthermore, adding up to 20 > yield instructions (just like you did on x86) didn't work either. In addition, the stress-ng test triggers on v4.14-rt and v4.18-rt as well. As v4.18-rt still uses the old spin lock implementation, I've backported the qspinlock implementation to v4.18-rt. The commits I've identified are: - 598865c5f32d ("arm64: barrier: Implement smp_cond_load_relaxed") - c11090474d70 ("arm64: locking: Replace ticket lock implementation with qspinlock") Using these commits it's still possible to trigger the issue. But it takes longer. Did I miss anything? Thanks, Kurt