Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4879498pjb; Mon, 27 Jul 2020 07:27:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwb8sbTCqM7ihgKmHPmdEYj1LfB8EsbbflOGfbEBELPeUwkyg5+v/Ej35yndEdz7dMBJy4P X-Received: by 2002:a17:906:7291:: with SMTP id b17mr3057983ejl.25.1595860059199; Mon, 27 Jul 2020 07:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860059; cv=none; d=google.com; s=arc-20160816; b=zQ32sfOYFQqvNHgsHBaU40AYoh89rQ/edmzB6+VmIJFFRe+TxFD/wm+Jn9j0bcHd9Q /ifga1XHNvWuXEi2wK+zgp23d1ysaBQIrAtS+cnP20ZOSqeMDvWE9AhMZrQiiZJS1oxT 1pd+EAS8QRvP5fTU+u4wGuvqhwM5x7buaM547MioJo7CiaLrMrWJDENaelVk6rA+lCHX /+tMveB24fcYbM0crLQTag4BJWP5CWbIRjwUcKc9yvNWEjrsxrCsjQK46M9cAUEQ0vIw 7XgwgxaXAcephpEs03mYxUZCyOTWsCWnLrMfmpyHiTDXPSf06fINsXj8wOY2V+PThWjJ WhGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mYTg/nqML0dHHUnT/pCjGiM+mvrF8X/uWx7TJeAhNJQ=; b=ZGwjSQwQQ10R1Zk5mPGUdMqu3NxDjJ8rI+TfPrGTbxR9yIFY456GfQDRsvuttOTkqM pJ7hHx5gEljzEtSGSlMIKCdpZrXmt1lOX+1RAI36IVX7xIVtjxz5lwtBbyx3QouV8VGo mGgVlxNpo+5Jk8K2NLT47P+dmZP6qX43VhCFGGSFEniQATEIAi/n6FErJMU68E3WikVX Q2Etn6BVqY2BAeiXu9/Qh4oGicOIP0kI0RWMuS0MqAHcnaipcSUv2dMGiIXHGb5rDhn7 dlCoMdOT506jJd3MTxVHO1bZjoA4VYou5HE+Y3Dk+fV1ewq1O6z+CwEZsZAggOWLQFjp T9xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MQxkmHi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j6si5866340edq.8.2020.07.27.07.27.16; Mon, 27 Jul 2020 07:27:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MQxkmHi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732537AbgG0O0A (ORCPT + 99 others); Mon, 27 Jul 2020 10:26:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:56110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729512AbgG0OZ6 (ORCPT ); Mon, 27 Jul 2020 10:25:58 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 84B17207FC; Mon, 27 Jul 2020 14:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859957; bh=yDL8Vv8k1NbW6bGeTuxpjBDJNb81nTSEttoBN0jtCZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQxkmHi7RDVJEW/LKjIdwvQKBXxKGydXcLycHCK1mh7jl3t6n/cjATOt7hJMpEHAs HeRYhfShU0AFI5+F0seRWiSJvQlck/SGJVWQvdLWWBuFPooeWPaKWF5HGJW9cOf2JU JWe3NwhmwYu5iBAETRc4VOWiRT/JNg9YaSMYYSTs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Anglin , Helge Deller Subject: [PATCH 5.7 170/179] parisc: Add atomic64_set_release() define to avoid CPU soft lockups Date: Mon, 27 Jul 2020 16:05:45 +0200 Message-Id: <20200727134940.941331008@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John David Anglin commit be6577af0cef934ccb036445314072e8cb9217b9 upstream. Stalls are quite frequent with recent kernels. I enabled CONFIG_SOFTLOCKUP_DETECTOR and I caught the following stall: watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [cc1:22803] CPU: 0 PID: 22803 Comm: cc1 Not tainted 5.6.17+ #3 Hardware name: 9000/800/rp3440 IAOQ[0]: d_alloc_parallel+0x384/0x688 IAOQ[1]: d_alloc_parallel+0x388/0x688 RP(r2): d_alloc_parallel+0x134/0x688 Backtrace: [<000000004036974c>] __lookup_slow+0xa4/0x200 [<0000000040369fc8>] walk_component+0x288/0x458 [<000000004036a9a0>] path_lookupat+0x88/0x198 [<000000004036e748>] filename_lookup+0xa0/0x168 [<000000004036e95c>] user_path_at_empty+0x64/0x80 [<000000004035d93c>] vfs_statx+0x104/0x158 [<000000004035dfcc>] __do_sys_lstat64+0x44/0x80 [<000000004035e5a0>] sys_lstat64+0x20/0x38 [<0000000040180054>] syscall_exit+0x0/0x14 The code was stuck in this loop in d_alloc_parallel: 4037d414: 0e 00 10 dc ldd 0(r16),ret0 4037d418: c7 fc 5f ed bb,< ret0,1f,4037d414 4037d41c: 08 00 02 40 nop This is the inner loop of bit_spin_lock which is called by hlist_bl_unlock in d_alloc_parallel: static inline void bit_spin_lock(int bitnum, unsigned long *addr) { /* * Assuming the lock is uncontended, this never enters * the body of the outer loop. If it is contended, then * within the inner loop a non-atomic test is used to * busywait with less bus contention for a good time to * attempt to acquire the lock bit. */ preempt_disable(); #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) while (unlikely(test_and_set_bit_lock(bitnum, addr))) { preempt_enable(); do { cpu_relax(); } while (test_bit(bitnum, addr)); preempt_disable(); } #endif __acquire(bitlock); } After consideration, I realized that we must be losing bit unlocks. Then, I noticed that we missed defining atomic64_set_release(). Adding this define fixes the stalls in bit operations. Signed-off-by: Dave Anglin Cc: stable@vger.kernel.org Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- arch/parisc/include/asm/atomic.h | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/parisc/include/asm/atomic.h +++ b/arch/parisc/include/asm/atomic.h @@ -212,6 +212,8 @@ atomic64_set(atomic64_t *v, s64 i) _atomic_spin_unlock_irqrestore(v, flags); } +#define atomic64_set_release(v, i) atomic64_set((v), (i)) + static __inline__ s64 atomic64_read(const atomic64_t *v) {