From patchwork Wed Oct 19 08:26:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5567 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350536wrs; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ggFSDVLJKq4ujLnPNTyIei1lU2xEq7jT/4s/eKDdtTu0jksVdEYKxZLnIjvYz8hp87WZc X-Received: by 2002:a17:90b:1184:b0:20c:c0f:7c43 with SMTP id gk4-20020a17090b118400b0020c0c0f7c43mr46158960pjb.236.1666188834484; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188834; cv=none; d=google.com; s=arc-20160816; b=Bn9tkGU1EaC3e08s9vWHXuWNrSc0mPS2BSsUOfPEIPi13psL8IxyBkvekqH8Ct9s7H +IEuHG+nylVRJQQvvMzbH9O1ryAfJ7GLUPFlw8BiGfil6qmsW61+j6iotWLyQd7AitYQ SVn+dnU/tqQgkTU4tIOO8iAEZzpiH+YNcGoahoiNvXChkEDtLrEwSnwVpKFdMR/aovc2 VE4hIEN4WdhEhIPXSW2FGJDmx7DinQQDSb7/8Dwcgu33i4EuD/leuw8qNXNRVlyS1Hyc 2fImsgmisIlJIaBhf2DumUw614I3qDF6rdwaqhDKvLrMSJ83SHJCL8lww9BKqiqQRfde tbHw== 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=wGyU6M+G5l6uYKOeCAkkDjMBiMsUEQOgQuuSJlln4wc=; b=uGNuG2lF7TmqcClPV8+EV4SE/akZmhZskn10gWnij69bYIsHrI6GWo72jHBiRRRip8 hO3Q2oa0tA3/LaIGauGhnCfKwmQlxwjcxndDeO6l3IEXOYkH1p1JKwlBCy2L3TQhjElf h6P/VfJuRJ2noqGb6UByo4nO28NK4SxSt22V7rdjCsEpC8miEA/I1S2i4yPyQ+xAVdnE ygDne0LQLDmNlU44wWD6dJe7s37vbhtY1yCs5Jf8qbCF7MOFrSjKnmG3tpvUIPJwtZks i52n2cyTMUJnEAYPKv4gGkSaMr0+iZ5uDAhxk6rk0N0JWw6TTeyvAKZlnfL16EqfXzA9 hK8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tsibVVda; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a170902f35100b0017684491caasi15195589ple.594.2022.10.19.07.13.30; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tsibVVda; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233740AbiJSN4u (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231302AbiJSNxc (ORCPT ); Wed, 19 Oct 2022 09:53:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C0B31CBAA1; Wed, 19 Oct 2022 06:36:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 594F2B82397; Wed, 19 Oct 2022 08:50:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C949FC4314D; Wed, 19 Oct 2022 08:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169440; bh=2K8Ly1+cLGZDbnIHbo7zA+ju2+Kk+NzBIKrGvopcenM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tsibVVdaloTosFNd05+uqZ09lvFMf1NtJ9RYhn0FOd3GCJjUZa7kGeeqXzleZKsgz T3f/zvHuLCJNwrbxDNRFvbhs6Nlf+WJdyiuZKCknIWiuz60F8KSEnCwr6HSHBjWpWl h6pxaBNSiXzh/0iArATo6j6EFp6kPPi5xodBlMlc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 278/862] wifi: mt76: sdio: fix the deadlock caused by sdio->stat_work Date: Wed, 19 Oct 2022 10:26:05 +0200 Message-Id: <20221019083302.305602434@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125623654596048?= X-GMAIL-MSGID: =?utf-8?q?1747125623654596048?= From: Sean Wang [ Upstream commit e5d78fd998be94fb459a3d625df7367849b997b8 ] Because wake_work and sdio->stat_work share the same workqueue mt76->wq, if sdio->stat_work cannot acquire the mutex lock such as that was possibly held up by [mt7615, mt7921]_mutex_acquire. Additionally, if [mt7615, mt7921]_mutex_acquire was called by sdio->stat_work self, the wake would be blocked by itself. Thus, we move the stat_work into ieee80211_workqueue instead to break the deadlock. Fixes: d39b52e31aa6 ("mt76: introduce mt76_sdio module") Co-developed-by: YN Chen Signed-off-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/sdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index aba2a9865821..fb2caeae6dba 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -481,7 +481,7 @@ static void mt76s_status_worker(struct mt76_worker *w) if (dev->drv->tx_status_data && !test_and_set_bit(MT76_READING_STATS, &dev->phy.state) && !test_bit(MT76_STATE_SUSPEND, &dev->phy.state)) - queue_work(dev->wq, &dev->sdio.stat_work); + ieee80211_queue_work(dev->hw, &dev->sdio.stat_work); } while (nframes > 0); if (resched) @@ -508,7 +508,7 @@ static void mt76s_tx_status_data(struct work_struct *work) } if (count && test_bit(MT76_STATE_RUNNING, &dev->phy.state)) - queue_work(dev->wq, &sdio->stat_work); + ieee80211_queue_work(dev->hw, &sdio->stat_work); else clear_bit(MT76_READING_STATS, &dev->phy.state); }