Thread (8 messages) 8 messages, 3 authors, 2021-12-13

Re: [PATCH] rtw88: 8821c: disable the ASPM of RTL8821CE

flat view

From: Kai-Heng Feng <hidden>
Date: 2021-12-13 09:48:41
Also in: linux-wireless, lkml

On Mon, Dec 13, 2021 at 5:00 PM Pkshih [off-list ref] wrote:
quoted
-----Original Message-----
From: Jian-Hong Pan <redacted>
Sent: Monday, December 13, 2021 3:31 PM
To: Pkshih <pkshih@realtek.com>
Cc: Kai-Heng Feng <redacted>; Yan-Hsuan Chuang <redacted>; Kalle Valo
[off-list ref]; linux-wireless@vger.kernel.org; netdev@vger.kernel.org;
linux-kernel@vger.kernel.org; linux@endlessos.org
Subject: Re: [PATCH] rtw88: 8821c: disable the ASPM of RTL8821CE

Pkshih [off-list ref] 於 2021年12月11日 週六 下午2:31寫道:
quoted
quoted
-----Original Message-----
From: Jian-Hong Pan <redacted>
Sent: Friday, December 10, 2021 5:34 PM
To: Kai-Heng Feng <redacted>
Cc: Pkshih <pkshih@realtek.com>; Yan-Hsuan Chuang <redacted>; Kalle Valo
[off-list ref]; linux-wireless@vger.kernel.org; netdev@vger.kernel.org;
linux-kernel@vger.kernel.org; linux@endlessos.org
Subject: Re: [PATCH] rtw88: 8821c: disable the ASPM of RTL8821CE

Kai-Heng Feng [off-list ref] 於 2021年12月10日 週五 下午5:24寫道:
quoted
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 consumption.
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.
I meant that move "ref_cnt" into rtw_pci_link_ps() by [2], but you remove
the "ref_cnt". This leads lower performance, because it must turn off
ASPM after napi_poll() when we have high traffic.

In fact, Kai-Heng's patch is to leave ASPM before napi_poll(), and
"restore" ASPM setting. So, we still need "ref_cnt".
I am working on the patch for proper upstream inclusion. Will send out soon.

Kai-Heng
quoted
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=215131#c11
[2] https://bugzilla.kernel.org/show_bug.cgi?id=215131#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 = 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;
 }
How about doing this thing only if 8821CE and Intel platform?
Could you help to add this?

--
Ping-ke
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help