From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECE72C4363A for ; Tue, 27 Oct 2020 00:04:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5C6A218AC for ; Tue, 27 Oct 2020 00:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603757067; bh=K2UUaSLNQyBICP48dxxnV3Rzi+dMsSPNYnRRZ736Fns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ff/jt9I8Ly+3Wi3aRBxzd8UfFv5e0ANC/y2mIKOXPf2NCsr+nD7o42XNWA6Qd1Qkr +SzqM/bLI+Vazz4yLccnQ1jxFUUzCQAphgUgOE9oX2bPCVW0tFQvO+IfR3CBCei0W7 352izzhq7oRPHE8DdCXWtXldsFqTHKa+Jph/SMy4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437651AbgJ0AE0 (ORCPT ); Mon, 26 Oct 2020 20:04:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:52750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437648AbgJ0AEZ (ORCPT ); Mon, 26 Oct 2020 20:04:25 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3572E20791; Tue, 27 Oct 2020 00:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603757064; bh=K2UUaSLNQyBICP48dxxnV3Rzi+dMsSPNYnRRZ736Fns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1ThL9hFRcUDL/nNXSvJzaId2yG/tmnfOYXjONjSBJEqDj7nCtINFzNfMNGTcrUC1 cfDSs7c1YVGJqXGDLn2A6AO5fnB1344fiFwuMvO9aPpoD2twZ1Ji8DdmU5yzY+P/MR D2AAvl3+X8jEtLyerowFO4UVS/EPSYIdjYhAPATc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Berg , Richard Weinberger , Sasha Levin , linux-um@lists.infradead.org Subject: [PATCH AUTOSEL 4.19 07/60] um: change sigio_spinlock to a mutex Date: Mon, 26 Oct 2020 20:03:22 -0400 Message-Id: <20201027000415.1026364-7-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201027000415.1026364-1-sashal@kernel.org> References: <20201027000415.1026364-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Johannes Berg [ Upstream commit f2d05059e15af3f70502074f4e3a504530af504a ] Lockdep complains at boot: ============================= [ BUG: Invalid wait context ] 5.7.0-05093-g46d91ecd597b #98 Not tainted ----------------------------- swapper/1 is trying to lock: 0000000060931b98 (&desc[i].request_mutex){+.+.}-{3:3}, at: __setup_irq+0x11d/0x623 other info that might help us debug this: context-{4:4} 1 lock held by swapper/1: #0: 000000006074fed8 (sigio_spinlock){+.+.}-{2:2}, at: sigio_lock+0x1a/0x1c stack backtrace: CPU: 0 PID: 1 Comm: swapper Not tainted 5.7.0-05093-g46d91ecd597b #98 Stack: 7fa4fab0 6028dfd1 0000002a 6008bea5 7fa50700 7fa50040 7fa4fac0 6028e016 7fa4fb50 6007f6da 60959c18 00000000 Call Trace: [<60023a0e>] show_stack+0x13b/0x155 [<6028e016>] dump_stack+0x2a/0x2c [<6007f6da>] __lock_acquire+0x515/0x15f2 [<6007eb50>] lock_acquire+0x245/0x273 [<6050d9f1>] __mutex_lock+0xbd/0x325 [<6050dc76>] mutex_lock_nested+0x1d/0x1f [<6008e27e>] __setup_irq+0x11d/0x623 [<6008e8ed>] request_threaded_irq+0x169/0x1a6 [<60021eb0>] um_request_irq+0x1ee/0x24b [<600234ee>] write_sigio_irq+0x3b/0x76 [<600383ca>] sigio_broken+0x146/0x2e4 [<60020bd8>] do_one_initcall+0xde/0x281 Because we hold sigio_spinlock and then get into requesting an interrupt with a mutex. Change the spinlock to a mutex to avoid that. Signed-off-by: Johannes Berg Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/um/kernel/sigio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/um/kernel/sigio.c b/arch/um/kernel/sigio.c index b5e0cbb343828..476ded92affac 100644 --- a/arch/um/kernel/sigio.c +++ b/arch/um/kernel/sigio.c @@ -36,14 +36,14 @@ int write_sigio_irq(int fd) } /* These are called from os-Linux/sigio.c to protect its pollfds arrays. */ -static DEFINE_SPINLOCK(sigio_spinlock); +static DEFINE_MUTEX(sigio_mutex); void sigio_lock(void) { - spin_lock(&sigio_spinlock); + mutex_lock(&sigio_mutex); } void sigio_unlock(void) { - spin_unlock(&sigio_spinlock); + mutex_unlock(&sigio_mutex); } -- 2.25.1