diff mbox series

[wireless-next,v14,4/4] wifi: mac80211: Set RTS threshold on per-radio basis

Message ID 20250605111040.3451328-5-quic_rdevanat@quicinc.com
State Superseded
Headers show
Series wifi: cfg80211/mac80211: Set/get wiphy parameters on per-radio basis | expand

Commit Message

Roopni Devanathan June 5, 2025, 11:10 a.m. UTC
Add support to get the radio for which RTS threshold needs to be changed
from userspace. Pass on this radio index to underlying drivers as an
additional argument.

A value of -1 indicates radio index is not mentioned and that the
configuration applies to all radio(s) of the wiphy.

Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
---
 net/mac80211/cfg.c  | 11 +++++++++--
 net/mac80211/util.c | 10 +++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

Comments

kernel test robot June 10, 2025, 8:47 a.m. UTC | #1
Hello,

kernel test robot noticed "BUG:unable_to_handle_page_fault_for_address" on:

commit: 2d9436a4ecd84c9924c6c7c9f0d7ecf70846d085 ("[PATCH wireless-next v14 4/4] wifi: mac80211: Set RTS threshold on per-radio basis")
url: https://github.com/intel-lab-lkp/linux/commits/Roopni-Devanathan/wifi-cfg80211-mac80211-Add-support-to-get-radio-index/20250605-191329
patch link: https://lore.kernel.org/all/20250605111040.3451328-5-quic_rdevanat@quicinc.com/
patch subject: [PATCH wireless-next v14 4/4] wifi: mac80211: Set RTS threshold on per-radio basis

in testcase: hwsim
version: hwsim-x86_64-b01c4843b-1_20250601
with following parameters:

	test: group-23



config: x86_64-rhel-9.4-func
compiler: gcc-12
test machine: 8 threads 1 sockets Intel(R) Core(TM) i7-4790 v3 @ 3.60GHz (Haswell) with 6G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)


If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202506101647.943b7c9c-lkp@intel.com


[   96.637922][ T5597] BUG: unable to handle page fault for address: fffffffffffffffc
[   96.645465][ T5597] #PF: supervisor read access in kernel mode
[   96.651272][ T5597] #PF: error_code(0x0000) - not-present page
[   96.657079][ T5597] PGD 19b873067 P4D 19b873067 PUD 19b875067 PMD 0
[   96.663409][ T5597] Oops: Oops: 0000 [#1] SMP KASAN PTI
[   96.668616][ T5597] CPU: 5 UID: 0 PID: 5597 Comm: hostapd Tainted: G S                  6.15.0-rc7-01662-g2d9436a4ecd8 #1 PREEMPT(voluntary)
[   96.681254][ T5597] Tainted: [S]=CPU_OUT_OF_SPEC
[   96.685852][ T5597] Hardware name: Dell Inc. OptiPlex 9020/03CPWF, BIOS A11 04/01/2015
[ 96.693733][ T5597] RIP: 0010:ieee80211_set_wiphy_params (net/mac80211/cfg.c:3068) mac80211 
[ 96.701124][ T5597] Code: 48 b8 00 00 00 00 00 fc ff df 48 89 ea 48 c1 ea 03 0f b6 14 02 48 89 e8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 5a 03 00 00 <44> 8b 7d 00 e9 a1 fb ff ff 65 8b 2d 58 0e 33 c4 89 ed be 08 00 00
All code
========
   0:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
   7:	fc ff df 
   a:	48 89 ea             	mov    %rbp,%rdx
   d:	48 c1 ea 03          	shr    $0x3,%rdx
  11:	0f b6 14 02          	movzbl (%rdx,%rax,1),%edx
  15:	48 89 e8             	mov    %rbp,%rax
  18:	83 e0 07             	and    $0x7,%eax
  1b:	83 c0 03             	add    $0x3,%eax
  1e:	38 d0                	cmp    %dl,%al
  20:	7c 08                	jl     0x2a
  22:	84 d2                	test   %dl,%dl
  24:	0f 85 5a 03 00 00    	jne    0x384
  2a:*	44 8b 7d 00          	mov    0x0(%rbp),%r15d		<-- trapping instruction
  2e:	e9 a1 fb ff ff       	jmp    0xfffffffffffffbd4
  33:	65 8b 2d 58 0e 33 c4 	mov    %gs:-0x3bccf1a8(%rip),%ebp        # 0xffffffffc4330e92
  3a:	89 ed                	mov    %ebp,%ebp
  3c:	be                   	.byte 0xbe
  3d:	08 00                	or     %al,(%rax)
	...

Code starting with the faulting instruction
===========================================
   0:	44 8b 7d 00          	mov    0x0(%rbp),%r15d
   4:	e9 a1 fb ff ff       	jmp    0xfffffffffffffbaa
   9:	65 8b 2d 58 0e 33 c4 	mov    %gs:-0x3bccf1a8(%rip),%ebp        # 0xffffffffc4330e68
  10:	89 ed                	mov    %ebp,%ebp
  12:	be                   	.byte 0xbe
  13:	08 00                	or     %al,(%rax)
	...
[   96.720506][ T5597] RSP: 0018:ffffc90000a5f0f8 EFLAGS: 00010246
[   96.726398][ T5597] RAX: 0000000000000007 RBX: ffff88817b9783c0 RCX: 1ffffffff85c10a0
[   96.734194][ T5597] RDX: 0000000000000000 RSI: 00000000ffffffff RDI: ffff88817b978530
[   96.741990][ T5597] RBP: fffffffffffffffc R08: 0000000000000001 R09: fffff5200014be00
[   96.749787][ T5597] R10: ffffc90000a5f007 R11: 0000000000000000 R12: 0000000000000008
[   96.757578][ T5597] R13: 00000000ffffffff R14: ffff88817b978920 R15: 0000000000000000
[   96.765371][ T5597] FS:  00007f4aad0fa740(0000) GS:ffff8881acccb000(0000) knlGS:0000000000000000
[   96.774116][ T5597] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   96.780529][ T5597] CR2: fffffffffffffffc CR3: 00000000572c8005 CR4: 00000000001726f0
[   96.788325][ T5597] Call Trace:
[   96.791453][ T5597]  <TASK>
[ 96.794234][ T5597] nl80211_set_wiphy (net/wireless/rdev-ops.h:587 net/wireless/nl80211.c:3982) cfg80211 
[ 96.800233][ T5597] ? __mutex_unlock_slowpath+0x260/0x2e0 
[ 96.806737][ T5597] ? __pfx_nl80211_set_wiphy (net/wireless/nl80211.c:3646) cfg80211 
[ 96.813055][ T5597] ? __pfx_netdev_run_todo (net/core/dev.c:11350) 
[ 96.818182][ T5597] ? nl80211_pre_doit (net/wireless/nl80211.c:16887) cfg80211 
[ 96.824076][ T5597] genl_family_rcv_msg_doit (net/netlink/genetlink.c:1117) 
[ 96.829455][ T5597] ? __pfx_genl_family_rcv_msg_doit (net/netlink/genetlink.c:1088) 
[ 96.835349][ T5597] ? security_capable (security/security.c:1142) 
[ 96.840035][ T5597] genl_family_rcv_msg (net/netlink/genetlink.c:1195) 
[ 96.844979][ T5597] ? __pfx_genl_family_rcv_msg (net/netlink/genetlink.c:1160) 
[ 96.850440][ T5597] ? __pfx_nl80211_pre_doit (net/wireless/nl80211.c:16797) cfg80211 
[ 96.856668][ T5597] ? __pfx_nl80211_set_wiphy (net/wireless/nl80211.c:3646) cfg80211 
[ 96.862981][ T5597] ? __pfx_nl80211_post_doit (net/wireless/nl80211.c:16899) cfg80211 
[ 96.869295][ T5597] ? stack_trace_save (kernel/stacktrace.c:123) 
[ 96.873980][ T5597] genl_rcv_msg (net/netlink/genetlink.c:65 net/netlink/genetlink.c:1211) 
[ 96.878231][ T5597] netlink_rcv_skb (net/netlink/af_netlink.c:2534) 
[ 96.882829][ T5597] ? __pfx_genl_rcv_msg (net/netlink/genetlink.c:1201) 
[ 96.887686][ T5597] ? __pfx_netlink_rcv_skb (net/netlink/af_netlink.c:2511) 
[ 96.892803][ T5597] ? __pfx_netlink_lookup (net/netlink/af_netlink.c:514) 
[ 96.897833][ T5597] ? _copy_from_iter (arch/x86/include/asm/uaccess_64.h:126 arch/x86/include/asm/uaccess_64.h:141 lib/iov_iter.c:55 include/linux/iov_iter.h:30 include/linux/iov_iter.h:300 include/linux/iov_iter.h:328 lib/iov_iter.c:249 lib/iov_iter.c:260) 
[ 96.902689][ T5597] genl_rcv (net/netlink/genetlink.c:1220) 
[ 96.906506][ T5597] netlink_unicast (net/netlink/af_netlink.c:1314 net/netlink/af_netlink.c:1339) 
[ 96.911103][ T5597] ? __pfx_netlink_unicast (net/netlink/af_netlink.c:1324) 
[ 96.916218][ T5597] ? kasan_save_track (arch/x86/include/asm/current.h:25 mm/kasan/common.c:60 mm/kasan/common.c:69) 
[   96.920904][ T5597]  ? 0xffffffff81000000
[ 96.924896][ T5597] ? __check_object_size (mm/memremap.c:421) 
[ 96.930531][ T5597] netlink_sendmsg (net/netlink/af_netlink.c:1883) 
[ 96.935128][ T5597] ? __pfx_netlink_sendmsg (net/netlink/af_netlink.c:1802) 
[ 96.940253][ T5597] ? __import_iovec (lib/iov_iter.c:1444 lib/iov_iter.c:1459) 
[ 96.944935][ T5597] ? _inline_copy_from_user (arch/x86/include/asm/uaccess_64.h:134 arch/x86/include/asm/uaccess_64.h:134 arch/x86/include/asm/uaccess_64.h:141 include/linux/uaccess.h:178) 
[ 96.950150][ T5597] ? __pfx_netlink_sendmsg (net/netlink/af_netlink.c:1802) 
[ 96.955263][ T5597] ____sys_sendmsg (net/socket.c:712 net/socket.c:727 net/socket.c:2566) 
[ 96.959863][ T5597] ? __pfx_____sys_sendmsg (net/socket.c:2512) 
[ 96.964979][ T5597] ? __pfx_copy_msghdr_from_user (net/socket.c:2492) 
[ 96.970613][ T5597] ? xas_load (include/linux/xarray.h:175 include/linux/xarray.h:1264 lib/xarray.c:241) 
[ 96.974694][ T5597] ? filemap_get_entry (mm/filemap.c:1852) 
[ 96.979640][ T5597] ___sys_sendmsg (net/socket.c:2622) 
[ 96.984066][ T5597] ? _inline_copy_from_user (arch/x86/include/asm/uaccess_64.h:134 arch/x86/include/asm/uaccess_64.h:134 arch/x86/include/asm/uaccess_64.h:141 include/linux/uaccess.h:178) 
[ 96.989268][ T5597] ? __pfx____sys_sendmsg (net/socket.c:2609) 
[ 96.994296][ T5597] ? __pfx_copy_from_sockptr_offset (include/linux/sockptr.h:46) 
[ 97.001230][ T5597] ? folio_wait_stable (arch/x86/include/asm/bitops.h:206 arch/x86/include/asm/bitops.h:238 include/asm-generic/bitops/instrumented-non-atomic.h:142 include/linux/pagemap.h:309 mm/page-writeback.c:3194) 
[ 97.006001][ T5597] ? netlink_setsockopt (arch/x86/include/asm/bitops.h:60 (discriminator 1) include/asm-generic/bitops/instrumented-atomic.h:29 (discriminator 1) net/netlink/af_netlink.c:1703 (discriminator 1)) 
[ 97.011032][ T5597] ? __pfx_netlink_setsockopt (net/netlink/af_netlink.c:1633) 
[ 97.016406][ T5597] ? _inline_copy_from_user (arch/x86/include/asm/uaccess_64.h:134 arch/x86/include/asm/uaccess_64.h:134 arch/x86/include/asm/uaccess_64.h:141 include/linux/uaccess.h:178) 
[ 97.021608][ T5597] ? copy_from_sockptr_offset (include/linux/sockptr.h:51) 
[ 97.028106][ T5597] ? fdget (include/linux/atomic/atomic-arch-fallback.h:479 include/linux/atomic/atomic-instrumented.h:50 fs/file.c:1152 fs/file.c:1166) 
[ 97.031927][ T5597] __sys_sendmsg (net/socket.c:2652) 
[ 97.036349][ T5597] ? __pfx___sys_sendmsg (net/socket.c:2637) 
[ 97.041293][ T5597] ? __pfx_netlink_setsockopt (net/netlink/af_netlink.c:1633) 
[ 97.046666][ T5597] ? do_sock_setsockopt (net/socket.c:2265) 
[ 97.051695][ T5597] ? __pfx_do_sock_setsockopt (net/socket.c:2265) 
[ 97.057069][ T5597] ? syscall_exit_to_user_mode (arch/x86/include/asm/irqflags.h:37 arch/x86/include/asm/irqflags.h:114 include/linux/entry-common.h:232 kernel/entry/common.c:206 kernel/entry/common.c:218) 
[ 97.062530][ T5597] do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94) 
[ 97.066867][ T5597] ? __pfx___fsnotify_parent (fs/notify/fsnotify.c:239) 
[ 97.072157][ T5597] ? fdget (include/linux/atomic/atomic-arch-fallback.h:479 include/linux/atomic/atomic-instrumented.h:50 fs/file.c:1152 fs/file.c:1166) 
[ 97.075977][ T5597] ? __sys_setsockopt (net/socket.c:2321) 
[ 97.080749][ T5597] ? syscall_exit_to_user_mode (arch/x86/include/asm/irqflags.h:37 arch/x86/include/asm/irqflags.h:114 include/linux/entry-common.h:232 kernel/entry/common.c:206 kernel/entry/common.c:218) 
[ 97.086210][ T5597] ? do_syscall_64 (arch/x86/entry/syscall_64.c:113) 
[ 97.090722][ T5597] ? __pfx_vfs_write (fs/read_write.c:665) 
[ 97.095320][ T5597] ? do_syscall_64 (arch/x86/entry/syscall_64.c:113) 
[ 97.099833][ T5597] ? fdget_pos (arch/x86/include/asm/atomic64_64.h:15 include/linux/atomic/atomic-arch-fallback.h:2583 include/linux/atomic/atomic-long.h:38 include/linux/atomic/atomic-instrumented.h:3189 include/linux/file_ref.h:215 fs/file.c:1189 fs/file.c:1211) 
[ 97.104085][ T5597] ? ksys_write (fs/read_write.c:736) 
[ 97.108335][ T5597] ? __pfx_ksys_write (fs/read_write.c:726) 
[ 97.113019][ T5597] ? ksys_write (fs/read_write.c:736) 
[ 97.117270][ T5597] ? __pfx_ksys_write (fs/read_write.c:726) 
[ 97.121955][ T5597] ? syscall_exit_to_user_mode (arch/x86/include/asm/irqflags.h:37 arch/x86/include/asm/irqflags.h:114 include/linux/entry-common.h:232 kernel/entry/common.c:206 kernel/entry/common.c:218) 
[ 97.127417][ T5597] ? do_syscall_64 (arch/x86/entry/syscall_64.c:113) 
[ 97.131929][ T5597] ? syscall_exit_to_user_mode (arch/x86/include/asm/irqflags.h:37 arch/x86/include/asm/irqflags.h:114 include/linux/entry-common.h:232 kernel/entry/common.c:206 kernel/entry/common.c:218) 
[ 97.137391][ T5597] ? do_syscall_64 (arch/x86/entry/syscall_64.c:113) 
[ 97.141903][ T5597] ? exc_page_fault (arch/x86/include/asm/irqflags.h:37 arch/x86/include/asm/irqflags.h:114 arch/x86/mm/fault.c:1488 arch/x86/mm/fault.c:1538) 
[ 97.146415][ T5597] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) 
[   97.152149][ T5597] RIP: 0033:0x7f4aad2edbc0
[ 97.156403][ T5597] Code: 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 66 2e 0f 1f 84 00 00 00 00 00 90 80 3d 21 fa 0c 00 00 74 17 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 48 83 ec 28 89 54
All code
========
   0:	00 f7                	add    %dh,%bh
   2:	d8 64 89 02          	fsubs  0x2(%rcx,%rcx,4)
   6:	48 c7 c0 ff ff ff ff 	mov    $0xffffffffffffffff,%rax
   d:	eb b7                	jmp    0xffffffffffffffc6
   f:	66 2e 0f 1f 84 00 00 	cs nopw 0x0(%rax,%rax,1)
  16:	00 00 00 
  19:	90                   	nop
  1a:	80 3d 21 fa 0c 00 00 	cmpb   $0x0,0xcfa21(%rip)        # 0xcfa42
  21:	74 17                	je     0x3a
  23:	b8 2e 00 00 00       	mov    $0x2e,%eax
  28:	0f 05                	syscall
  2a:*	48 3d 00 f0 ff ff    	cmp    $0xfffffffffffff000,%rax		<-- trapping instruction
  30:	77 58                	ja     0x8a
  32:	c3                   	ret
  33:	0f 1f 80 00 00 00 00 	nopl   0x0(%rax)
  3a:	48 83 ec 28          	sub    $0x28,%rsp
  3e:	89                   	.byte 0x89
  3f:	54                   	push   %rsp

Code starting with the faulting instruction
===========================================
   0:	48 3d 00 f0 ff ff    	cmp    $0xfffffffffffff000,%rax
   6:	77 58                	ja     0x60
   8:	c3                   	ret
   9:	0f 1f 80 00 00 00 00 	nopl   0x0(%rax)
  10:	48 83 ec 28          	sub    $0x28,%rsp
  14:	89                   	.byte 0x89
  15:	54                   	push   %rsp


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20250610/202506101647.943b7c9c-lkp@intel.com
diff mbox series

Patch

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index e2ed8401bd32..c46bf160a6a0 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3060,8 +3060,15 @@  static int ieee80211_set_wiphy_params(struct wiphy *wiphy, int radio_idx,
 	}
 
 	if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
-		err = drv_set_rts_threshold(local, radio_idx,
-					    wiphy->rts_threshold);
+		u32 rts_threshold;
+
+		if (radio_idx >= wiphy->n_radio)
+			rts_threshold = wiphy->rts_threshold;
+		else
+			rts_threshold =
+				wiphy->radio_cfg[radio_idx].rts_threshold;
+
+		err = drv_set_rts_threshold(local, radio_idx, rts_threshold);
 
 		if (err)
 			return err;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 78cdce9d3993..cf61716c0bb3 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1756,6 +1756,7 @@  int ieee80211_reconfig(struct ieee80211_local *local)
 	bool sched_scan_stopped = false;
 	bool suspended = local->suspended;
 	bool in_reconfig = false;
+	u32 rts_threshold;
 
 	lockdep_assert_wiphy(local->hw.wiphy);
 
@@ -1829,7 +1830,14 @@  int ieee80211_reconfig(struct ieee80211_local *local)
 	drv_set_frag_threshold(local, -1, hw->wiphy->frag_threshold);
 
 	/* setup RTS threshold */
-	drv_set_rts_threshold(local, -1, hw->wiphy->rts_threshold);
+	if (hw->wiphy->n_radio > 0) {
+		for (i = 0; i < hw->wiphy->n_radio; i++) {
+			rts_threshold = hw->wiphy->radio_cfg[i].rts_threshold;
+			drv_set_rts_threshold(local, i, rts_threshold);
+		}
+	} else {
+		drv_set_rts_threshold(local, -1, hw->wiphy->rts_threshold);
+	}
 
 	/* reset coverage class */
 	drv_set_coverage_class(local, -1, hw->wiphy->coverage_class);