]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.1/wifi-ath11k-decrease-mhi-channel-buffer-length-to-8k.patch
Fixes for 6.1
[thirdparty/kernel/stable-queue.git] / queue-6.1 / wifi-ath11k-decrease-mhi-channel-buffer-length-to-8k.patch
1 From 7fa94059b68c963f5c8131b079f9061942b9ad41 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Fri, 23 Feb 2024 13:31:11 +0800
4 Subject: wifi: ath11k: decrease MHI channel buffer length to 8KB
5
6 From: Baochen Qiang <quic_bqiang@quicinc.com>
7
8 [ Upstream commit 1cca1bddf9ef080503c15378cecf4877f7510015 ]
9
10 Currently buf_len field of ath11k_mhi_config_qca6390 is assigned
11 with 0, making MHI use a default size, 64KB, to allocate channel
12 buffers. This is likely to fail in some scenarios where system
13 memory is highly fragmented and memory compaction or reclaim is
14 not allowed.
15
16 There is a fail report which is caused by it:
17 kworker/u32:45: page allocation failure: order:4, mode:0x40c00(GFP_NOIO|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
18 CPU: 0 PID: 19318 Comm: kworker/u32:45 Not tainted 6.8.0-rc3-1.gae4495f-default #1 openSUSE Tumbleweed (unreleased) 493b6d5b382c603654d7a81fc3c144d59a1dfceb
19 Workqueue: events_unbound async_run_entry_fn
20 Call Trace:
21 <TASK>
22 dump_stack_lvl+0x47/0x60
23 warn_alloc+0x13a/0x1b0
24 ? srso_alias_return_thunk+0x5/0xfbef5
25 ? __alloc_pages_direct_compact+0xab/0x210
26 __alloc_pages_slowpath.constprop.0+0xd3e/0xda0
27 __alloc_pages+0x32d/0x350
28 ? mhi_prepare_channel+0x127/0x2d0 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814]
29 __kmalloc_large_node+0x72/0x110
30 __kmalloc+0x37c/0x480
31 ? mhi_map_single_no_bb+0x77/0xf0 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814]
32 ? mhi_prepare_channel+0x127/0x2d0 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814]
33 mhi_prepare_channel+0x127/0x2d0 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814]
34 __mhi_prepare_for_transfer+0x44/0x80 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814]
35 ? __pfx_____mhi_prepare_for_transfer+0x10/0x10 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814]
36 device_for_each_child+0x5c/0xa0
37 ? __pfx_pci_pm_resume+0x10/0x10
38 ath11k_core_resume+0x65/0x100 [ath11k a5094e22d7223135c40d93c8f5321cf09fd85e4e]
39 ? srso_alias_return_thunk+0x5/0xfbef5
40 ath11k_pci_pm_resume+0x32/0x60 [ath11k_pci 830b7bfc3ea80ebef32e563cafe2cb55e9cc73ec]
41 ? srso_alias_return_thunk+0x5/0xfbef5
42 dpm_run_callback+0x8c/0x1e0
43 device_resume+0x104/0x340
44 ? __pfx_dpm_watchdog_handler+0x10/0x10
45 async_resume+0x1d/0x30
46 async_run_entry_fn+0x32/0x120
47 process_one_work+0x168/0x330
48 worker_thread+0x2f5/0x410
49 ? __pfx_worker_thread+0x10/0x10
50 kthread+0xe8/0x120
51 ? __pfx_kthread+0x10/0x10
52 ret_from_fork+0x34/0x50
53 ? __pfx_kthread+0x10/0x10
54 ret_from_fork_asm+0x1b/0x30
55 </TASK>
56
57 Actually those buffers are used only by QMI target -> host communication.
58 And for WCN6855 and QCA6390, the largest packet size for that is less
59 than 6KB. So change buf_len field to 8KB, which results in order 1
60 allocation if page size is 4KB. In this way, we can at least save some
61 memory, and as well as decrease the possibility of allocation failure
62 in those scenarios.
63
64 Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30
65
66 Reported-by: Vlastimil Babka <vbabka@suse.cz>
67 Closes: https://lore.kernel.org/ath11k/96481a45-3547-4d23-ad34-3a8f1d90c1cd@suse.cz/
68 Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
69 Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
70 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
71 Link: https://msgid.link/20240223053111.29170-1-quic_bqiang@quicinc.com
72 Signed-off-by: Sasha Levin <sashal@kernel.org>
73 ---
74 drivers/net/wireless/ath/ath11k/mhi.c | 2 +-
75 1 file changed, 1 insertion(+), 1 deletion(-)
76
77 diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c
78 index a62ee05c54097..4bea36cc71085 100644
79 --- a/drivers/net/wireless/ath/ath11k/mhi.c
80 +++ b/drivers/net/wireless/ath/ath11k/mhi.c
81 @@ -105,7 +105,7 @@ static struct mhi_controller_config ath11k_mhi_config_qca6390 = {
82 .max_channels = 128,
83 .timeout_ms = 2000,
84 .use_bounce_buf = false,
85 - .buf_len = 0,
86 + .buf_len = 8192,
87 .num_channels = ARRAY_SIZE(ath11k_mhi_channels_qca6390),
88 .ch_cfg = ath11k_mhi_channels_qca6390,
89 .num_events = ARRAY_SIZE(ath11k_mhi_events_qca6390),
90 --
91 2.43.0
92