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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F6D5C433EF for ; Mon, 13 Dec 2021 07:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231401AbhLMHbe (ORCPT ); Mon, 13 Dec 2021 02:31:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231348AbhLMHbd (ORCPT ); Mon, 13 Dec 2021 02:31:33 -0500 Received: from mail-oo1-xc36.google.com (mail-oo1-xc36.google.com [IPv6:2607:f8b0:4864:20::c36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C3D7C061751 for ; Sun, 12 Dec 2021 23:31:33 -0800 (PST) Received: by mail-oo1-xc36.google.com with SMTP id g11-20020a4a754b000000b002c679a02b18so3976382oof.3 for ; Sun, 12 Dec 2021 23:31:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ja0HWj5Gsp47ZRg+7SvX5BE8xP1Fjyd70WjG4w88Yr0=; b=gNctGPKesvpZMCr7thv7ODaTJqEid+48HsFA940xTiiPhCRj4hi1mJKbP//E/lmHi2 FndPK+OzVXd+CN3ahIT+TLlK6dZPdK+cLnlCV8L5CQVcfCdvcy5t0WCJl6uidYcsav9l a1lUrr+pplxeSlMQLlDEHhQe/o3XlZbcncRelT3fCsu2dmZKCwxyyIA7M6vNbnHGHQED kjzQ4R9wFDAPFlzFMp0IZKwP7NmCBkP+ULkqpKTs3mWUnp40Xv0sgfrL/j5DHaPKpWA3 xGFPyaWBW7aMpkrek14lCqkM+b/TACsiHOWxU7kyTNqdMyoDN2qzr2Yi3Ma/MC084UqZ IHkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ja0HWj5Gsp47ZRg+7SvX5BE8xP1Fjyd70WjG4w88Yr0=; b=wG/tHwdzyipSUcdDiCFDTbBwGRnjv98WSL9aGS91mzbRpi7yxa8wXUEgWZ/PMPWT6w ieV/CoF39p3fyBX5ZfmV7JjpS+OAd5TjuQM6haf4k14KVoSSyB2KMpOBVQbmrcVTLirR wHVr55bv179A3jvl0p4tIfyFggc6XjbJbQ/T5nXcUF3hTmr/Y6gOzWC7cOP4RcB2LRUz 7PV5y5wxnir0SJ6/puCZrarJx6gIVnDvtRKFVcDTZK87QWSj89aBp00HfeavOK/zIIB0 k2eI5dCKJ9mUiSjDIImLQmCTTZUp3lTfGOCPVNShg2BZhTZp8WmY/VVw2+DWHe0IFSQZ 8Vdg== X-Gm-Message-State: AOAM533vwhSo7tQ1Ji/fYhDgho+6mjRcAsx3N4PxpgxMJy04gqObYc2n 6aPfkXMUJFe/CHFEPJ/RnSae+4tDGEcDagj2WT2quzFuwVRvhQ== X-Google-Smtp-Source: ABdhPJxQmmt+yc5NhtgQ0NAMiwtBslV6TPGcnOnhsnge7dbaU7T3rFu3ysrvHoUrzTuOGooSDOHZE9XAds9dCnWlKPQ= X-Received: by 2002:a4a:af02:: with SMTP id w2mr18822678oon.7.1639380692821; Sun, 12 Dec 2021 23:31:32 -0800 (PST) MIME-Version: 1.0 References: <20211210081659.4621-1-jhp@endlessos.org> <6b0fcc8cf3bd4a77ad190dc6f72eb66f@realtek.com> <617008e3be9c4b5aa37b26f97daf9354@realtek.com> In-Reply-To: <617008e3be9c4b5aa37b26f97daf9354@realtek.com> From: Jian-Hong Pan Date: Mon, 13 Dec 2021 15:30:56 +0800 Message-ID: Subject: Re: [PATCH] rtw88: 8821c: disable the ASPM of RTL8821CE To: Pkshih Cc: Kai-Heng Feng , Yan-Hsuan Chuang , Kalle Valo , "linux-wireless@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux@endlessos.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Pkshih =E6=96=BC 2021=E5=B9=B412=E6=9C=8811=E6=97=A5 = =E9=80=B1=E5=85=AD =E4=B8=8B=E5=8D=882:31=E5=AF=AB=E9=81=93=EF=BC=9A > > > > -----Original Message----- > > From: Jian-Hong Pan > > Sent: Friday, December 10, 2021 5:34 PM > > To: Kai-Heng Feng > > Cc: Pkshih ; Yan-Hsuan Chuang ; Kalle Valo > > ; linux-wireless@vger.kernel.org; netdev@vger.ker= nel.org; > > linux-kernel@vger.kernel.org; linux@endlessos.org > > Subject: Re: [PATCH] rtw88: 8821c: disable the ASPM of RTL8821CE > > > > Kai-Heng Feng =E6=96=BC 2021=E5=B9=B412= =E6=9C=8810=E6=97=A5 =E9=80=B1=E4=BA=94 =E4=B8=8B=E5=8D=885:24=E5=AF=AB=E9= =81=93=EF=BC=9A > > > > > > On Fri, Dec 10, 2021 at 5:00 PM Pkshih wrote: > > > > > > > > +Kai-Heng > > > > > > > > > -----Original Message----- > > > > > From: Jian-Hong Pan > > > > > Sent: Friday, December 10, 2021 4:17 PM > > > > > To: Pkshih ; Yan-Hsuan Chuang ; Kalle Valo > > > > > > > > > > Cc: linux-wireless@vger.kernel.org; netdev@vger.kernel.org; linux= -kernel@vger.kernel.org; > > > > > linux@endlessos.org; Jian-Hong Pan > > > > > Subject: [PATCH] rtw88: 8821c: disable the ASPM of RTL8821CE > > > > > > > > > > More and more laptops become frozen, due to the equipped RTL8821C= E. > > > > > > > > > > This patch follows the idea mentioned in commits 956c6d4f20c5 ("r= tw88: > > > > > add quirks to disable pci capabilities") and 1d4dcaf3db9bd ("rtw8= 8: add > > > > > quirk to disable pci caps on HP Pavilion 14-ce0xxx"), but disable= s its > > > > > PCI ASPM capability of RTL8821CE directly, instead of checking DM= I. > > > > > > > > > > Buglink:https://bugzilla.kernel.org/show_bug.cgi?id=3D215239 > > > > > Fixes: 1d4dcaf3db9bd ("rtw88: add quirk to disable pci caps on HP= Pavilion 14-ce0xxx") > > > > > Signed-off-by: Jian-Hong Pan > > > > > > > > We also discuss similar thing in this thread: > > > > https://bugzilla.kernel.org/show_bug.cgi?id=3D215131 > > > > > > > > Since we still want to turn on ASPM to save more power, I would lik= e to > > > > enumerate the blacklist. Does it work to you? > > > > > > Too many platforms are affected, the blacklist method won't scale. > > > > Exactly! > > Got it. > > > > > > Right now it seems like only Intel platforms are affected, so can I > > > propose a patch to disable ASPM when its upstream port is Intel? > > > > I only have laptops with Intel chip now. So, I am not sure the status > > with AMD platforms. > > If this is true, then "disable ASPM when its upstream port is Intel" > > might be a good idea. > > > > Jian-Hong, could you try Kai-Heng's workaround that only turn off ASPM > during NAPI poll function. If it also works to you, I think it is okay > to apply this workaround to all Intel platform with RTL8821CE chipset. > Because this workaround has little (almost no) impact of power consumptio= n. According to Kai-Heng's hack patch [1] and the comment [2] mentioning checking "ref_cnt" by rtw_pci_link_ps(), I arrange the patch as following. This patch only disables ASPM (if the hardware has the capability) when system gets into rtw_pci_napi_poll() and re-enables ASPM when it leaves rtw_pci_napi_poll(). It is as Ping-Ke mentioned "only turn off ASPM during NAPI poll function". The WiFi & BT work, and system is still alive after I use the internet awhile. Besides, there is no more "pci bus timeout, check dma status" error. [1] https://bugzilla.kernel.org/show_bug.cgi?id=3D215131#c11 [2] https://bugzilla.kernel.org/show_bug.cgi?id=3D215131#c15 Jian-Hong Pan diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c index a7a6ebfaa203..a6fdddecd37d 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -1658,6 +1658,7 @@ static int rtw_pci_napi_poll(struct napi_struct *napi, int budget) priv); int work_done =3D 0; + rtw_pci_link_ps(rtwdev, false); while (work_done < budget) { u32 work_done_once; @@ -1681,6 +1682,7 @@ static int rtw_pci_napi_poll(struct napi_struct *napi, int budget) if (rtw_pci_get_hw_rx_ring_nr(rtwdev, rtwpci)) napi_schedule(napi); } + rtw_pci_link_ps(rtwdev, true); return work_done; } > > > > > > If so, please help to add one quirk entry of your platform. > > > > > > > > Another thing is that "attachment 299735" is another workaround for= certain > > > > platform. And, we plan to add quirk to enable this workaround. > > > > Could you try if it works to you? > > > > > > When the hardware is doing DMA, it should initiate leaving ASPM L1, > > > correct? So in theory my workaround should be benign enough for most > > > platforms. > > I don't see and know the detail of hardware waveform, but I think your > understanding is correct. > > -- > Ping-Ke >