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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC1F2C433EF for ; Mon, 22 Nov 2021 11:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=inde77+0+FXbfE371DAgjytxwKBkp8qlcJFzsQMvVt4=; b=PAVSWLRaJ6KVcKrq7aY1u1ggt5 ZlRS8jRcdlMByiCEJpPs8MMRMGDpI4fAWQGlF3Z1RISo5Uy8hB69VPJUtV6MSM769UK3oK1yhtg62 VxDjVDM3h6dhvOQzzfwnFzhBkksCGaduoQEsDTinZrO1k3TCLEBk1p8VKj15dov451AaR6c8wRFwe txJXuHxFxtEEy6CE3yfg9jXAdudYXf1dtLvZQX5FoldSnwCm/GRhNtATIHxnKnwIDiAWGEtaIIGiI iuPxhUu1y/PB2iwXeGij4cEJVXLoywlC7G+AvCHAfyhShFzAqCY9bsd4bR2Nr+saSRVJVJsek7Zi6 UNZS5Niw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mp7sQ-00GAl9-AN; Mon, 22 Nov 2021 11:52:50 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mp6t7-00FuvC-5J for linux-mediatek@lists.infradead.org; Mon, 22 Nov 2021 10:49:30 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B6AEE60241; Mon, 22 Nov 2021 10:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637578168; bh=6IZt0vZBL703Wzm5h/gihPzq2vaEooHapA9/mKWYmto=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uUg/HxIaQdbcsRjngKrP/1yIJGL5oZ4Yg/2elYJtMTcd+Mloc9O8fmVK9ibcWU5Ca Jm7hrS6LQqxIUggVJlT4B/fK/a9I1InOOKHFwd62VbJsCUnvwEvF0FkJQqCX5nCqG3 A7fgeu7GbuYdM6NgTMjZ9YgfEZ5AiIKdQlZ3sibG1b+ZLLPmiPe6yf7sImNNHOhA1T aR9KQr33r90mDGwcs5ka14BFijbJXIEb37K62nBKxFivTyTKyOPCGj+COpuV+c5wSU dH/D8q1RjGOTqeuW3Z6qkDduwR60z7aXmtRVVvkMaBATn8lXzn1I+kddG4kewSGsiY N0gYFNKqHUs8A== Date: Mon, 22 Nov 2021 11:49:24 +0100 From: Lorenzo Bianconi To: sean.wang@mediatek.com Cc: lorenzo.bianconi@redhat.com, nbd@nbd.name, Soul.Huang@mediatek.com, YN.Chen@mediatek.com, Leon.Yen@mediatek.com, Eric-SY.Chang@mediatek.com, Deren.Wu@mediatek.com, km.lin@mediatek.com, robin.chiu@mediatek.com, Eddie.Chen@mediatek.com, ch.yeh@mediatek.com, posh.sun@mediatek.com, ted.huang@mediatek.com, Eric.Liang@mediatek.com, Stella.Chang@mediatek.com, steve.lee@mediatek.com, jsiuda@google.com, frankgor@google.com, jemele@google.com, shawnku@google.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH 2/2] mt76: mt7921s: fix the device cannot sleep deeply in suspend Message-ID: References: <1637552808-24472-1-git-send-email-sean.wang@mediatek.com> MIME-Version: 1.0 In-Reply-To: <1637552808-24472-1-git-send-email-sean.wang@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211122_024929_317523_58CCDCEE X-CRM114-Status: GOOD ( 20.81 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============0530897834394504250==" Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org --===============0530897834394504250== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XvgaRyxRn9W6Ups7" Content-Disposition: inline --XvgaRyxRn9W6Ups7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > From: Sean Wang >=20 >=20 > >=20 > >> >> > >> >> - if (test_bit(MT76_MCU_RESET, &dev->phy.state)) { > >> >> - if (!mt76s_txqs_empty(dev)) > >> >> - continue; > >> >> - else > >> >> - wake_up(&sdio->wait); > >> >> - } > >> >> } while (nframes > 0); > >> >> > >> >> + if (test_bit(MT76_MCU_RESET, &dev->phy.state) && > >> >> + mt76s_txqs_empty(dev)) > >> >> + wake_up(&sdio->wait); > >> >> + > >> > >> If doing so, mt76s_txqs_empty may not always be true because enqueuing > >> packets to q_tx or MCU command to q_mcu simultanenously from the other > >> contexts in different cpu is possible. > >> > >> It seemed to me we should check it for each iteration to guarantee > >> that we can wake up the one that is waiting for the all the queues are= empty at some time. > > > >IIUC what we are interested here is there are no queued frames into the = hw queues during suspend or reset, right? >=20 > That is not completely true. Take the suspend procedure on mt7921s as an = example. >=20 > That should be "There are no queued frames into the hw queues right after= mt76_connac_mcu_set_hif_suspend." >=20 > The MCU data and WiFi are all handled in mt76s_txrx_worker so we should s= ynchronize all of > the Tx queues are all empty and then handle mt76_connac_mcu_set_hif_suspe= nd to guarantee > mt76_connac_mcu_set_hif_suspend is the last one to access the SDIO bus an= d there is no frame that accesses SDIO bus afterhand. ack, correct, "there are no queued frames into the hw queues right after mt76_connac_mcu_set_hif_suspend." What I mean is we are not really checking there are no frames in the hw que= ue here, but mt76 sdio has processed all the frames, got my point? maybe it is what we are looking for.. Regards, Lorenzo >=20 > > > >> > >> >> /* enable interrupt */ > >> >> sdio_writel(sdio->func, WHLPCR_INT_EN_SET, MCR_WHLPCR, NULL); > >> >> sdio_release_host(sdio->func); > >> >> > >> >> Regards, > >> >> Lorenzo > >> >> > >> >> > -- > >> >> > 2.25.1 > >> >> > > >> > > >> > > >> > > >> > > --XvgaRyxRn9W6Ups7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCYZt1tAAKCRA6cBh0uS2t rIgUAP9cH8ze/XEp+miz+xtPvfgGccW2FQqPeK59A5pUSznO9gEAjWdLGp0yUamR m6kdq55y2RuFs7kd51MVV7DfrxldHww= =oCiO -----END PGP SIGNATURE----- --XvgaRyxRn9W6Ups7-- --===============0530897834394504250== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek --===============0530897834394504250==--