Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp870975pxx; Tue, 27 Oct 2020 02:32:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyH/oi3OYvW8bP61gt72QUDdeI4Fhw+FfiPZ2sTVHYchj1XKrcsscRSKd4Us4eG5lXaw1Qq X-Received: by 2002:a17:906:11d6:: with SMTP id o22mr1516135eja.171.1603791125664; Tue, 27 Oct 2020 02:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603791125; cv=none; d=google.com; s=arc-20160816; b=uBqo2e2hYW5WK3Dx6zHAP5Ido7XmiRMLbJK270dcR/wRNGkLG60zj3UoNPQbIhBpb0 tWvVhApgsPU0Hi5CaggDQxWd+sExtUlnIdIrt6lK4e7I2Ly0vH90taaYSOY0orb0aqup FQn0RXEOhkKtHdeNMk483iNWzMtwQyHOntDP1eSQ7nXCNC6/mrdlseHhaY0TRgszg8Sm K1fx7qJkoeRGjI1gYB2KK6f2pKcEk2bCtA62yx7eEqd5wxzvpIA+gYSd6vyxZAnGpslG sQa2Aj8C5rCTEnfrNKm3Vp6XOyekg/qoyRKgOIAOGZarobRW813OSxwKBOTYS8h47FfB Qgxw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IGbmwxjImDOkIDIB8Y10EQTXe3r9Uw9DPOPZ5doVIMw=; b=onaUXYkNrCQ+g4DKjyClvs5009orNOfpxOUxOh0VBm7tloDudBtO8GaqxvRZ+CAJn5 JKwjfIlyv13ArGGhNVyfVd7aIdvWctl3Yx9qO5kkp0tJ2ZH+7N6tSAlJT3uS8GH9RlEO 6sUi2YznDc9dvUEOw606ZNm3EkGMAQGIPk+MI+e8D9QT2vmW5pjUOvMjOHavHgrBSaqT lPy2M7BD+MBnp85xqM+uLip42Tg3/w8jtX913Dnp9VXrF8J2j11cYJaIfDYcPTMe3xrU jHFepvZcGwR02quJPkKWSwbIOH2zNbC2v7hRoMu8VAgW0lpSeqBUQsJ0qN/EV+VQiArv E3+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GH2+Bnxx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si446333edq.317.2020.10.27.02.31.43; Tue, 27 Oct 2020 02:32:05 -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=GH2+Bnxx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408800AbgJZXtu (ORCPT + 99 others); Mon, 26 Oct 2020 19:49:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:47406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408698AbgJZXt1 (ORCPT ); Mon, 26 Oct 2020 19:49:27 -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 9C5E72075B; Mon, 26 Oct 2020 23:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756166; bh=QBMzE2TYiAzTYDYeREI8e45MI19Mj2RK6UJvoABnMWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GH2+Bnxx6+AooS3gmwi+PABx6iiH+aGvZbFUE70Ytr1m1i0WLvI4VWw49PGvb8hYE qCduMuxbLXmC2//dJCdE1Soez/yHYH61kFBjMBv6iceb9hSAgN1xE80pC9+PufzSro nTlqPb1kWSkP9/wqPpNdjmySW+rRLOKXWbjNltOM= 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 5.9 016/147] um: change sigio_spinlock to a mutex Date: Mon, 26 Oct 2020 19:46:54 -0400 Message-Id: <20201026234905.1022767-16-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026234905.1022767-1-sashal@kernel.org> References: <20201026234905.1022767-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: 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 10c99e058fcae..d1cffc2a7f212 100644 --- a/arch/um/kernel/sigio.c +++ b/arch/um/kernel/sigio.c @@ -35,14 +35,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