Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp819704pxb; Tue, 3 Nov 2020 13:27:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCWCrDHXjuYG4MqyHPIHxfwAXmThicVSc9OmBnj8fEKpR3R1RjKITokHOYGK+TGa5eKGBb X-Received: by 2002:a17:906:b143:: with SMTP id bt3mr3678044ejb.495.1604438859860; Tue, 03 Nov 2020 13:27:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604438859; cv=none; d=google.com; s=arc-20160816; b=NeDIigssfPrvopGQPFPaj3c2VO6Pz4aRdZNT7G25Iz2yoj378yxIvZ3E4zO9MyHmgQ bVNo6fc3vd5rRBY6SyFpESr34w4zfT4rYp5C4qk0hxNMnp2t3eLzS/07a+Mu9aW6nMsV fSFOSm8gpaHk9eSHNz3yTBPlPO/s0z7ToLw+8OLzqM3oQk+2o2lx1LPUabM4JDpbvnsV a/CzeBRtgwWxjkrKhXkQDUNGwxp56QRnHiOg2W3aJbXw83dBfrl6cQhiZvIs6j0tYnX/ kLNFSI2IfWMboun0Jsfv7sf1m1GTZpfsWvyBbTTBaAF+GRk3xUgQ9JKVMoV2sDRXb8tt nXnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Sy7mRBCaQ7VYUZ3OoEdwd/KTohgZ4InT3mTyzklZ4DI=; b=cj2pDkA88u1QE0jUEclim6l6iZ9+WG5RonFLLRhrfciuSTY6mWuPk/GvqCUCIzGXl+ goqjeRTv3O1UsSelTUPFNKR9SooJ/SYaUYaOkyspp7OOhuQrCH2mV5Z2Ek8dlum5dBP+ TuSANjxqYUmGZgh0/+eR5WdOpmLctd+LI9em2Uvj0S5u3PB+1A+jY7RECfWmJhw+oA0s OunZGqH9wb1rzte++953LcWqvJAs8nk7hM0vElv5X58PjFwz/nMynXa2uUnUHDk6QjDf +9tiMIh6NL+I3AmJcNC+/0OiylhkAtmTnzy616eE4Lrz9LcDQs89Dt8+UYrOjcvgECLK B+Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="sYE0uT/N"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v4si11070101edl.447.2020.11.03.13.27.17; Tue, 03 Nov 2020 13:27:39 -0800 (PST) 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="sYE0uT/N"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733197AbgKCVDY (ORCPT + 99 others); Tue, 3 Nov 2020 16:03:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:40792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387774AbgKCVDV (ORCPT ); Tue, 3 Nov 2020 16:03:21 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 D1BBE20658; Tue, 3 Nov 2020 21:03:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437400; bh=8IoPhvaNi50VZ4kDbgG2391J0F0bfxVrFVK+xANb+9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sYE0uT/NJj0S7Xu5jE4/lhHdoJzXtClXaSRRTE9D8452XHwmPAn+WY0EhanNXIBOv xyraC/VPQqt8wvahXCB1gLJf1/niIyWnTy20felaw0y1ccXetJIpu2BJ4Zmu9uQsOR wnXWL02DJSqDy7CdsdbHmOpacqPFtxCNLPT2/WAI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Richard Weinberger , Sasha Levin Subject: [PATCH 4.19 061/191] um: change sigio_spinlock to a mutex Date: Tue, 3 Nov 2020 21:35:53 +0100 Message-Id: <20201103203240.381853885@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.27.0