2023-01-10 22:48:26

by Bert Karwatzki

[permalink] [raw]
Subject: [PATCH 6.2-rc3] wifi: mt76: fix dma error

Since linux-6.2-rc1 the mediatek mt76 wlan driver suffers from problems
https://bugzilla.kernel.org/show_bug.cgi?id=216901. I bisected this to
commit cd372b8c99c5a5cf6a464acebb7e4a79af7ec8ae and noticed that the

if (txwi) {
q->entry[q->head].txwi = DMA_DUMMY_DATA;
q->entry[q->head].skip_buf0 = true;
}

part is moved from the beginning of mt76_dma_add_buf to the
inside of the for loop. But q->head is modified at the beginning of
this loop.
This patch puts at the beginning of mt76_dma_add_buf
diff -aur linux-6.2-rc3.old/drivers/net/wireless/mediatek/mt76/dma.c
linux-6.2-rc3/drivers/net/wireless/mediatek/mt76/dma.c
--- linux-6.2-rc3.old/drivers/net/wireless/mediatek/mt76/dma.c 2023-
01-08 18:49:43.000000000 +0100
+++ linux-6.2-rc3/drivers/net/wireless/mediatek/mt76/dma.c 2023-
01-09 22:07:29.533248047 +0100
@@ -215,6 +215,11 @@
u32 ctrl;
int i, idx = -1;

+ if (txwi) {
+ q->entry[q->head].txwi = DMA_DUMMY_DATA;
+ q->entry[q->head].skip_buf0 = true;
+ }
+
for (i = 0; i < nbufs; i += 2, buf += 2) {
u32 buf0 = buf[0].addr, buf1 = 0;

@@ -238,11 +243,6 @@
ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0,
buf[0].len) |
MT_DMA_CTL_TO_HOST;
} else {
- if (txwi) {
- q->entry[q->head].txwi =
DMA_DUMMY_DATA;
- q->entry[q->head].skip_buf0 = true;
- }
-
if (buf[0].skip_unmap)
entry->skip_buf0 = true;
entry->skip_buf1 = i == nbufs - 1;

Bert Karwatzki


Subject: Re: [PATCH 6.2-rc3] wifi: mt76: fix dma error

[CCing Felix]

On 10.01.23 23:39, Bert Karwatzki wrote:
> Since linux-6.2-rc1 the mediatek mt76 wlan driver suffers from problems
> https://bugzilla.kernel.org/show_bug.cgi?id=216901. I bisected this to
> commit cd372b8c99c5a5cf6a464acebb7e4a79af7ec8ae and noticed that the
>
> if (txwi) {
> q->entry[q->head].txwi = DMA_DUMMY_DATA;
> q->entry[q->head].skip_buf0 = true;
> }
>
> part is moved from the beginning of mt76_dma_add_buf to the
> inside of the for loop. But q->head is modified at the beginning of
> this loop.

Thx for your patch. TWIMC, a earlier (and tested) patch to address that
regression can afaics be found here:

https://lore.kernel.org/lkml/[email protected]/

Makes me wonder: Felix, btw, did you ever properly submit that patch for
inclusion? Where? I can't find it with lore. :-/ Or will it be addressed
by a different patch?

/me really hopes we can get this resolved this week before rc4 ships, as
it seems this regressions bothers quite a few people

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)
--
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
That page also explains what to do if mails like this annoy you.

P.S.:

#regzbot ^backmonitor: https://bugzilla.kernel.org/show_bug.cgi?id=216901

> This patch puts at the beginning of mt76_dma_add_buf
> diff -aur linux-6.2-rc3.old/drivers/net/wireless/mediatek/mt76/dma.c
> linux-6.2-rc3/drivers/net/wireless/mediatek/mt76/dma.c
> --- linux-6.2-rc3.old/drivers/net/wireless/mediatek/mt76/dma.c 2023-
> 01-08 18:49:43.000000000 +0100
> +++ linux-6.2-rc3/drivers/net/wireless/mediatek/mt76/dma.c 2023-
> 01-09 22:07:29.533248047 +0100
> @@ -215,6 +215,11 @@
> u32 ctrl;
> int i, idx = -1;
>
> + if (txwi) {
> + q->entry[q->head].txwi = DMA_DUMMY_DATA;
> + q->entry[q->head].skip_buf0 = true;
> + }
> +
> for (i = 0; i < nbufs; i += 2, buf += 2) {
> u32 buf0 = buf[0].addr, buf1 = 0;
>
> @@ -238,11 +243,6 @@
> ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0,
> buf[0].len) |
> MT_DMA_CTL_TO_HOST;
> } else {
> - if (txwi) {
> - q->entry[q->head].txwi =
> DMA_DUMMY_DATA;
> - q->entry[q->head].skip_buf0 = true;
> - }
> -
> if (buf[0].skip_unmap)
> entry->skip_buf0 = true;
> entry->skip_buf1 = i == nbufs - 1;
>
> Bert Karwatzki

2023-01-13 16:29:15

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 6.2-rc3] wifi: mt76: fix dma error

"Linux kernel regression tracking (Thorsten Leemhuis)"
<[email protected]> writes:

> [CCing Felix]
>
> On 10.01.23 23:39, Bert Karwatzki wrote:
>> Since linux-6.2-rc1 the mediatek mt76 wlan driver suffers from problems
>> https://bugzilla.kernel.org/show_bug.cgi?id=216901. I bisected this to
>> commit cd372b8c99c5a5cf6a464acebb7e4a79af7ec8ae and noticed that the
>>
>> if (txwi) {
>> q->entry[q->head].txwi = DMA_DUMMY_DATA;
>> q->entry[q->head].skip_buf0 = true;
>> }
>>
>> part is moved from the beginning of mt76_dma_add_buf to the
>> inside of the for loop. But q->head is modified at the beginning of
>> this loop.
>
> Thx for your patch. TWIMC, a earlier (and tested) patch to address that
> regression can afaics be found here:
>
> https://lore.kernel.org/lkml/[email protected]/
>
> Makes me wonder: Felix, btw, did you ever properly submit that patch for
> inclusion? Where? I can't find it with lore. :-/ Or will it be addressed
> by a different patch?

The patch is now in my queue:

https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

> /me really hopes we can get this resolved this week before rc4 ships, as
> it seems this regressions bothers quite a few people

If all goes well this should make it to v6.2-rc5.

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches