Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3843743imd; Mon, 29 Oct 2018 13:17:03 -0700 (PDT) X-Google-Smtp-Source: AJdET5cSEqKpqSiEkU5xdRk9L7Dm/v35zloxuEWu/v7LDKq7Fcf6QDZTCWxS2daKJhAPVatpWiDU X-Received: by 2002:a63:4243:: with SMTP id p64-v6mr15397797pga.127.1540844223850; Mon, 29 Oct 2018 13:17:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540844223; cv=none; d=google.com; s=arc-20160816; b=q7Q0zNhASNdhvczsQ7w5LH63bALZEyXBvHxs+8rNFulJXsi23J44oq2dVhg86NAiXp XpDPc/Rm09WNm5Ysv0VnlMzfnbGr5xzbYc7slfKTklVRymiXQMFQhwnvG69T1fWL/uDk H06VLcqcourGOVp0bGMnXuKjWJTgBz/vWbW7ftF9Xq3PRrw4sPOFNpIts7iB/fCzdiAK Xyy3bBqhLPl8oJetZBE4guBMjpffS3jUIIW9D4gDeGDdvn1Do0mARA8JZx0zwY16Qr4c /+HgTkaVKWtD0obt3nunb+JKc7ZYSxGbtl4UeCxWlyGdESV001G/y5gs2mgUiKbF1ovh 2HyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=UV/88/F9SSPi9jA9HsXvhIfJgcmnncZg4pzQROXfWGE=; b=Jc+555ZQQbG7H8YfVF+d2JTW3txuxrueOhJrQ7JUGdtFCqR3tTCnUUXsLwNSVE/hi0 1S5NjUS7NIhc3OgYx3rFzAYalW/dZcagOc1XB2qoWR5dERZMmyw3aB43Epqh+2kpG+97 irmRejF6EMUKDEI06o0scbycSQP8m/NDwj5XObA8tAasi0DPqva/YobdY0CpSoUgO7KX GCv7YTnUcQ/bS6wSE3aEYhHbBhxWtr7PM3UcqyF8ETQX4Ou874yWXtuLznT8Y4sG0Jqx 0QYeySUmxhX7M+Qoh1ElWQJApOGpQE8wqlfO1hoMi88M6tr72LLGxULAGjiMkYc7zVgr IW2Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=monom.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v63-v6si11505807pfb.67.2018.10.29.13.16.48; Mon, 29 Oct 2018 13:17:03 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=monom.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729663AbeJ3FGi (ORCPT + 99 others); Tue, 30 Oct 2018 01:06:38 -0400 Received: from mail.monom.org ([188.138.9.77]:50778 "EHLO mail.monom.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728735AbeJ3FGg (ORCPT ); Tue, 30 Oct 2018 01:06:36 -0400 Received: from mail.monom.org (localhost [127.0.0.1]) by filter.mynetwork.local (Postfix) with ESMTP id 184E1500A77; Mon, 29 Oct 2018 21:16:20 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail.monom.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 Received: from localhost (ppp-93-104-187-85.dynamic.mnet-online.de [93.104.187.85]) by mail.monom.org (Postfix) with ESMTPSA id D1F34500294; Mon, 29 Oct 2018 21:16:19 +0100 (CET) From: Daniel Wagner To: LKML , linux-rt-users , Steven Rostedt , Thomas Gleixner , Carsten Emde , John Kacur , Sebastian Andrzej Siewior , Daniel Wagner , Tom Zanussi , Julia Cartwright Cc: Peter Zijlstra Subject: [PATCH RT 1/2] x86/kconfig: Fall back to ticket spinlocks Date: Mon, 29 Oct 2018 21:16:16 +0100 Message-Id: <20181029201617.24733-2-wagi@monom.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20181029201617.24733-1-wagi@monom.org> References: <20181029201617.24733-1-wagi@monom.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Wagner v4.4.162-rt176-rc1 stable review patch. If anyone has any objections, please let me know. ----------- Sebastian writes: """ We reproducibly observe cache line starvation on a Core2Duo E6850 (2 cores), a i5-6400 SKL (4 cores) and on a NXP LS2044A ARM Cortex-A72 (4 cores). The problem can be triggered with a v4.9-RT kernel by starting cyclictest -S -p98 -m -i2000 -b 200 and as "load" stress-ng --ptrace 4 The reported maximal latency is usually less than 60us. If the problem triggers then values around 400us, 800us or even more are reported. The upperlimit is the -i parameter. Reproduction with 4.9-RT is almost immediate on Core2Duo, ARM64 and SKL, but it took 7.5 hours to trigger on v4.14-RT on the Core2Duo. Instrumentation show always the picture: CPU0 CPU1 => do_syscall_64 => do_syscall_64 => SyS_ptrace => syscall_slow_exit_work => ptrace_check_attach => ptrace_do_notify / rt_read_unlock => wait_task_inactive rt_spin_lock_slowunlock() -> while task_running() __rt_mutex_unlock_common() / check_task_state() mark_wakeup_next_waiter() | raw_spin_lock_irq(&p->pi_lock); raw_spin_lock(¤t->pi_lock); | . . | raw_spin_unlock_irq(&p->pi_lock); . \ cpu_relax() . - . *IRQ* In the error case we observe that the while() loop is repeated more than 5000 times which indicates that the pi_lock can be acquired. CPU1 on the other side does not make progress waiting for the same lock with interrupts disabled. This continues until an IRQ hits CPU0. Once CPU0 starts processing the IRQ the other CPU is able to acquire pi_lock and the situation relaxes. """ This matches with the observeration for v4.4-rt on a Core2Duo E6850: CPU 0: - no progress for a very long time in rt_mutex_dequeue_pi): stress-n-1931 0d..11 5060.891219: function: __try_to_take_rt_mutex stress-n-1931 0d..11 5060.891219: function: rt_mutex_dequeue stress-n-1931 0d..21 5060.891220: function: rt_mutex_enqueue_pi stress-n-1931 0....2 5060.891220: signal_generate: sig=17 errno=0 code=262148 comm=stress-ng-ptrac pid=1928 grp=1 res=1 stress-n-1931 0d..21 5060.894114: function: rt_mutex_dequeue_pi stress-n-1931 0d.h11 5060.894115: local_timer_entry: vector=239 CPU 1: - IRQ at 5060.894114 on CPU 1 followed by the IRQ on CPU 0 stress-n-1928 1....0 5060.891215: sys_enter: NR 101 (18, 78b, 0, 0, 17, 788) stress-n-1928 1d..11 5060.891216: function: __try_to_take_rt_mutex stress-n-1928 1d..21 5060.891216: function: rt_mutex_enqueue_pi stress-n-1928 1d..21 5060.891217: function: rt_mutex_dequeue_pi stress-n-1928 1....1 5060.891217: function: rt_mutex_adjust_prio stress-n-1928 1d..11 5060.891218: function: __rt_mutex_adjust_prio stress-n-1928 1d.h10 5060.894114: local_timer_entry: vector=239 Backporting all qspinlock related patches is very likely to introduce regressions. Therefore, the recommended solution by PeterZ and Thomas is to drop back to ticket spinlocks for v4.4. Cc: Sebastian Andrzej Siewior Cc: Peter Zijlstra Cc: Thomas Gleixner Signed-off-by: Daniel Wagner --- arch/x86/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 6df130a37d41..f00cab581e2d 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -42,7 +42,6 @@ config X86 select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_CMPXCHG_LOCKREF if X86_64 select ARCH_USE_QUEUED_RWLOCKS - select ARCH_USE_QUEUED_SPINLOCKS select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH select ARCH_WANTS_DYNAMIC_TASK_STRUCT select ARCH_WANT_FRAME_POINTERS -- 2.14.4