Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4869102pjb; Mon, 27 Jul 2020 07:14:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi3EMKlqwFJvzA7Kv8rhMhn0t6faXY4RwyNN10bTke9EVL3qkWvCuHYgDIbdqPjAkCZYB1 X-Received: by 2002:a05:6402:b86:: with SMTP id cf6mr20971222edb.42.1595859248736; Mon, 27 Jul 2020 07:14:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595859248; cv=none; d=google.com; s=arc-20160816; b=Dgjwb2la8fVukNvWOKjgoDtND3EyLKE2/xOJol62OfS97bRzZZrRu+DqgGGRSHkPsn 597wCQ4EwdGgCk4Y9pijX1vkwHFuYnBsEYKCIUfR1kQmsUGjH3ieGAhFFwzVTLjG/vws k0m4cw+Msc1ZoEwme8a3YrdllhKwmfIsIruwMwCtN6EtO7syIqRYb+UTYRkVoZ8fhhQ6 R6cq8EKo8HJgDkOLEVYwPs4TYrDaHYarM9yl+kIkCq+jgssqSZTziAGCHqgo6cwFOwCU fZpnvX64qut3JIQZZe3knf8ev9Hcd5FeCktNKNH2JGpRYyehkmJzWTdAOjw25wuc+KUC l73g== 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=TUPnS9RWumHMkqCGzrjxBMioREg8CLHp+6UnVTByt9eKQqSs84AvdW0RYDTUcCYZ7b 5KQJLe1JCGv38o+pfTHEETS1Vv++UIn1eEDbePI8IrkgBbNXEOwUkE6djoOaw0CqX4ih 2mph4foqEF02iqKMzkLlW52b3smbcVOFFMAX7vXWYSeHvpLtJ2LRj9Z+dvrY84IUoSjC adQR/bOBsaGzrFP3YdlNaTlsoIEbiqSjvSeh1ubsfH8TwW6pA+qAnWz6UXkTOnEe9yWt 3z2Faafp/WMEiGdxkJus9fd7jLXxO8qQ88D84+oLpA1jIgUgtcY4b9GXaTGIeU6ZTZJy R2/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bNY9j0FA; 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 b18si5728610ejq.13.2020.07.27.07.13.45; Mon, 27 Jul 2020 07:14:08 -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=bNY9j0FA; 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 S1729390AbgG0OMW (ORCPT + 99 others); Mon, 27 Jul 2020 10:12:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:36512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730154AbgG0OMS (ORCPT ); Mon, 27 Jul 2020 10:12:18 -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 3955421883; Mon, 27 Jul 2020 14:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859137; bh=yDL8Vv8k1NbW6bGeTuxpjBDJNb81nTSEttoBN0jtCZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bNY9j0FABERsUb+yT7KmTPTBq5lBrmOhJq3y/ZSzfMIkI79uoAGLzBx7wvh7HhORn NJ3hCzU/bC8GGT2q9WzxZ4ZasXaPiWnwY/f3R04Y6z6qBkJBfoqAD+baWGzFkB+CzT by6fqFH+VdKgUGH2sY8Wt4KhXzfw25k3WseC6To4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Anglin , Helge Deller Subject: [PATCH 4.19 80/86] parisc: Add atomic64_set_release() define to avoid CPU soft lockups Date: Mon, 27 Jul 2020 16:04:54 +0200 Message-Id: <20200727134918.421854766@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134914.312934924@linuxfoundation.org> References: <20200727134914.312934924@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) {