Re: [PATCH v2] wifi: ath12k: fix false positive RCU warnings on PREEMPT_RT

曾昱翔
2026-04-22T18:30:02Z

On Wed, Apr 22, 2026 at 06:33:45 -0700, Jeff Johnson wrote:
> Amended patch in my pending branch:
> https://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git/commit/?h=pending&id=32f70ee38388bb9089b9cffa9791f5ef8d5d32cd

Thanks for picking it up and fixing the Tested-on placement.

Sebastian pointed out on v2 that the fix should use
lockdep_assert_in_rcu_read_lock() rather than RCU_LOCKDEP_WARN(),
since the former is gated on CONFIG_PROVE_RCU (same effect) but
expresses the intent more precisely. He also noted that the bug
is not PREEMPT_RT specific but applies to preemptible RCU in
general.

I've sent v3 addressing both points:
https://lore.kernel.org/ath12k/20260422180814.1938317-1-asas1asas200@gmail.com/

Let me know if you'd like me to do anything further.

Thanks,
Yu-Hsiang

Jeff Johnson <jeff.johnson@oss.qualcomm.com> 於 2026年4月22日週三 下午9:33寫道：
>
> On 4/21/2026 2:27 PM, Jeff Johnson wrote:
> > On 4/21/2026 10:25 AM, Yu-Hsiang Tseng wrote:
> >> Two functions in ath12k assert that the caller holds an RCU read lock:
> >> ath12k_mac_get_arvif() and ath12k_p2p_noa_update_vdev_iter(). Both use:
> >>
> >> WARN_ON(!rcu_read_lock_any_held());
> >>
> >> On PREEMPT_RT kernels built with CONFIG_PROVE_RCU=n, this produces a
> >> false positive splat whenever these functions are invoked from paths
> >> that do hold the RCU read lock (e.g. firmware stats processing or
> >> mac80211 interface iteration).
> >>
> >> Root cause:
> >>
> >> - On !PROVE_RCU, rcu_read_lock_any_held() is a static inline that
> >> returns !preemptible() as a proxy for "in an RCU read section".
> >>
> >> - On PREEMPT_RT, rcu_read_lock() does not disable preemption. A
> >> task can therefore be preemptible while legitimately holding an
> >> RCU read lock.
> >>
> >> - Callers such as ath12k_wmi_tlv_rssi_chain_parse() (via guard(rcu)())
> >> and ieee80211_iterate_active_interfaces_atomic() do hold the RCU
> >> read lock, so these warnings are incorrect.
> >>
> >> Typical splat seen on a WCN7850 station with periodic fw stats
> >> processing:
> >>
> >> WARNING: drivers/net/wireless/ath/ath12k/mac.c:791 at
> >> ath12k_mac_get_arvif+0x9e/0xd0 [ath12k]
> >> Tainted: G W O 6.19.13-rt #1 PREEMPT_RT
> >> Call Trace:
> >> ath12k_wmi_tlv_rssi_chain_parse+0x69/0x170 [ath12k]
> >> ath12k_wmi_tlv_iter+0x7f/0x120 [ath12k]
> >> ath12k_wmi_tlv_fw_stats_parse+0x342/0x6b0 [ath12k]
> >> ath12k_wmi_op_rx+0xe9e/0x3150 [ath12k]
> >> ath12k_htc_rx_completion_handler+0x3df/0x5b0 [ath12k]
> >> ath12k_ce_per_engine_service+0x325/0x3e0 [ath12k]
> >> ath12k_pci_ce_workqueue+0x20/0x40 [ath12k]
> >>
> >> Replace the WARN_ON() with RCU_LOCKDEP_WARN(), which is gated on
> >> debug_lockdep_rcu_enabled() and therefore compiles out entirely
> >> when PROVE_RCU is disabled. PROVE_RCU kernels continue to get the
> >> full lockdep-based check.
> >>
> >> Fixes: 3dd2c68f206e ("wifi: ath12k: prepare vif data structure for MLO handling")
> >> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3
> >
> > Note that Tested-on: is not a official upstream tag, it is an ath-specific
> > tag. Since it is not an official tag, it should be specified separately from
> > the official tags:
> >
> > <commit text>
> > <blank line>
> > Tested-on: ...
> > <blank line>
> > <official upstream tags>
> > Signed-off-by: ...
> >
> > Unless there are are other review comments there is no need to send a v3 to
> > address this -- I can make this change when I pick up the patch.
> Amended patch in my pending branch:
> https://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git/commit/?h=pending&id=32f70ee38388bb9089b9cffa9791f5ef8d5d32cd