From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752298AbdLLLCJ (ORCPT ); Tue, 12 Dec 2017 06:02:09 -0500 Received: from terminus.zytor.com ([65.50.211.136]:56227 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750749AbdLLLCF (ORCPT ); Tue, 12 Dec 2017 06:02:05 -0500 Date: Tue, 12 Dec 2017 02:58:30 -0800 From: tip-bot for Will Deacon Message-ID: Cc: hpa@zytor.com, schwidefsky@de.ibm.com, sebott@linux.vnet.ibm.com, will.deacon@arm.com, tglx@linutronix.de, peterz@infradead.org, torvalds@linux-foundation.org, mingo@kernel.org, heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org Reply-To: heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org, sebott@linux.vnet.ibm.com, schwidefsky@de.ibm.com, will.deacon@arm.com, tglx@linutronix.de, peterz@infradead.org, torvalds@linux-foundation.org, mingo@kernel.org, hpa@zytor.com In-Reply-To: <1511894539-7988-2-git-send-email-will.deacon@arm.com> References: <1511894539-7988-2-git-send-email-will.deacon@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/urgent] locking/core: Fix deadlock during boot on systems with GENERIC_LOCKBREAK Git-Commit-ID: f87f3a328dbbb3e79dd53e7e889ced9222512649 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: f87f3a328dbbb3e79dd53e7e889ced9222512649 Gitweb: https://git.kernel.org/tip/f87f3a328dbbb3e79dd53e7e889ced9222512649 Author: Will Deacon AuthorDate: Tue, 28 Nov 2017 18:42:18 +0000 Committer: Ingo Molnar CommitDate: Tue, 12 Dec 2017 11:24:01 +0100 locking/core: Fix deadlock during boot on systems with GENERIC_LOCKBREAK Commit: a8a217c22116 ("locking/core: Remove {read,spin,write}_can_lock()") removed the definition of raw_spin_can_lock(), causing the GENERIC_LOCKBREAK spin_lock() routines to poll the ->break_lock field when waiting on a lock. This has been reported to cause a deadlock during boot on s390, because the ->break_lock field is also set by the waiters, and can potentially remain set indefinitely if no other CPUs come in to take the lock after it has been released. This patch removes the explicit spinning on ->break_lock from the waiters, instead relying on the outer trylock() operation to determine when the lock is available. Reported-by: Sebastian Ott Tested-by: Sebastian Ott Signed-off-by: Will Deacon Acked-by: Peter Zijlstra Cc: Heiko Carstens Cc: Linus Torvalds Cc: Martin Schwidefsky Cc: Thomas Gleixner Fixes: a8a217c22116 ("locking/core: Remove {read,spin,write}_can_lock()") Link: http://lkml.kernel.org/r/1511894539-7988-2-git-send-email-will.deacon@arm.com Signed-off-by: Ingo Molnar --- kernel/locking/spinlock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/locking/spinlock.c b/kernel/locking/spinlock.c index 1fd1a75..0ebb253 100644 --- a/kernel/locking/spinlock.c +++ b/kernel/locking/spinlock.c @@ -68,8 +68,8 @@ void __lockfunc __raw_##op##_lock(locktype##_t *lock) \ \ if (!(lock)->break_lock) \ (lock)->break_lock = 1; \ - while ((lock)->break_lock) \ - arch_##op##_relax(&lock->raw_lock); \ + \ + arch_##op##_relax(&lock->raw_lock); \ } \ (lock)->break_lock = 0; \ } \ @@ -88,8 +88,8 @@ unsigned long __lockfunc __raw_##op##_lock_irqsave(locktype##_t *lock) \ \ if (!(lock)->break_lock) \ (lock)->break_lock = 1; \ - while ((lock)->break_lock) \ - arch_##op##_relax(&lock->raw_lock); \ + \ + arch_##op##_relax(&lock->raw_lock); \ } \ (lock)->break_lock = 0; \ return flags; \