Skip to content

Commit

Permalink
rtlwifi: rtl8192ce: add protection on rtl92ce_{enable|disable_interru…
Browse files Browse the repository at this point in the history
…pt()

Seem usefull on b2264 DW pcie interface
Now, we can use NetworkManager ~without any issue

Without this patch (randomly)
[  184.243426] rcu: INFO: rcu_sched self-detected stall on CPU
[  184.249008] rcu: 	0-....: (8405 ticks this GP) idle=df74/1/0x40000002 softirq=3607/3607 fqs=2972
[  184.257790] 	(t=8407 jiffies g=6613 q=56899 ncpus=4)
[  184.257803] CPU: 0 PID: 1059 Comm: ifconfig Not tainted 6.2.7 #3
[  184.257813] Hardware name: STi SoC with Flattened Device Tree
[  184.257818] PC is at pci_read32_sync+0x10/0x14 [rtl_pci]
[  184.257860] LR is at rtl92ce_enable_interrupt+0x4c/0x8c [rtl8192ce]
[  184.257921] pc : [<bf46d03c>]    lr : [<bf478e44>]    psr: 20060013
[  184.257928] sp : f1375ce0  ip : bf451b34  fp : c14f3c00
[  184.257933] r10: c2c4b780  r9 : c28f4000  r8 : c15b18bc
[  184.257938] r7 : 00000000  r6 : c15bd880  r5 : c15bc880  r4 : c15b1880
[  184.257944] r3 : f09e8000  r2 : 00000730  r1 : f09e8120  r0 : 00001b5f
[  184.257950] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[  184.257959] Control: 10c5387d  Table: 86c0804a  DAC: 00000051
[  184.257970]  pci_read32_sync [rtl_pci] from rtl92ce_enable_interrupt+0x4c/0x8c [rtl8192ce]
[  184.258018]  rtl92ce_enable_interrupt [rtl8192ce] from rtl_pci_start+0xbc/0x18c [rtl_pci]
[  184.258059]  rtl_pci_start [rtl_pci] from rtl_op_start+0x58/0x7c [rtlwifi]
[  184.258269]  rtl_op_start [rtlwifi] from drv_start+0x4c/0x10c [mac80211]
[  184.259512]  drv_start [mac80211] from ieee80211_do_open+0x370/0x6d8 [mac80211]
[  184.260444]  ieee80211_do_open [mac80211] from ieee80211_open+0x60/0x84 [mac80211]
[  184.261374]  ieee80211_open [mac80211] from __dev_open+0xfc/0x1d0
[  184.261860]  __dev_open from __dev_change_flags+0x190/0x214
[  184.261878]  __dev_change_flags from dev_change_flags+0x20/0x5c
[  184.261894]  dev_change_flags from devinet_ioctl+0x7a8/0x7dc
[  184.261918]  devinet_ioctl from inet_ioctl+0x1a4/0x244
[  184.261937]  inet_ioctl from sock_ioctl+0x4dc/0x5b8
[  184.261962]  sock_ioctl from sys_ioctl+0x510/0xbd8
[  184.261985]  sys_ioctl from ret_fast_syscall+0x0/0x1c

Anyway, even with this patch, we may (low rate) got some not expected msg from kernel
when switching from AP discover and AP usage. This is exactly what NetworkManager do in background
So, this patch need to be tuned
[ 1011.101387] ------------[ cut here ]------------
[ 1011.101399] WARNING: CPU: 0 PID: 528 at net/mac80211/rx.c:5146 ieee80211_rx_list+0x6bc/0xd38 [mac80211]
[ 1011.102736] CPU: 0 PID: 528 Comm: apps.plugin Not tainted 6.2.9 torvalds#17
[ 1011.102751] Hardware name: STi SoC with Flattened Device Tree
[ 1011.102763]  unwind_backtrace from show_stack+0x18/0x1c
[ 1011.102794]  show_stack from dump_stack_lvl+0x58/0x70
[ 1011.102823]  dump_stack_lvl from __warn+0x84/0x12c
[ 1011.102857]  __warn from warn_slowpath_fmt+0xb4/0x18c
[ 1011.102886]  warn_slowpath_fmt from ieee80211_rx_list+0x6bc/0xd38 [mac80211]
[ 1011.103835]  ieee80211_rx_list [mac80211] from ieee80211_rx_napi+0x38/0xb0 [mac80211]
[ 1011.105676]  ieee80211_rx_napi [mac80211] from ieee80211_tasklet_handler+0xd8/0xdc [mac80211]
[ 1011.107055]  ieee80211_tasklet_handler [mac80211] from tasklet_action_common.constprop.0+0xf8/0x128
[ 1011.107875]  tasklet_action_common.constprop.0 from __do_softirq+0x168/0x400
[ 1011.107912]  __do_softirq from __irq_exit_rcu+0xa4/0xc8
[ 1011.107939]  __irq_exit_rcu from irq_exit+0x10/0x30
[ 1011.107969]  irq_exit from call_with_stack+0x18/0x20
[ 1011.108004]  call_with_stack from __irq_svc+0x9c/0xb8
[ 1011.108027] Exception stack(0xf0c29ed0 to 0xf0c29f18)
[ 1011.108045] 9ec0:                                     c01a4788 00000000 2c629000 60000093
[ 1011.108054] 9ee0: 00000000 c4d9d778 c4d9d100 c2adbd08 0000069c fffffe30 5ac3c35a c2a04d8c
[ 1011.108062] 9f00: 00000000 f0c29f20 c014b488 c071105 60000013 ffffffff
[ 1011.108068]  __irq_svc from __cond_resched+0x0/0x54
[ 1011.108082]  __cond_resched from task_work_run+0xa4/0xcc
[ 1011.108100]  task_work_run from do_work_pending+0x448/0x51c
[ 1011.108116]  do_work_pending from slow_work_pending+0xc/0x20
[ 1011.108126] Exception stack(0xf0c29fb0 to 0xf0c29ff8)
[ 1011.108134] 9fa0:                                     fffffffe 005467f0 00028000 00000000
[ 1011.108142] 9fc0: 004a99e8 00000001 004a1400 00000142 005467f0 00000000 0049ec48 00000000
[ 1011.108150] 9fe0: 00000001 be9650b8 00000000 b6b02660 80000010 ffffff9c
[ 1011.108210] ---[ end trace 0000000000000000 ]---
[ 1011.108229] ------------[ cut here ]------------

Signed-off-by: Jerome AUDU <jau@free.fr>
  • Loading branch information
waby38b committed Mar 30, 2023
1 parent fe15c26 commit 0709197
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,24 +1271,31 @@ void rtl92ce_set_qos(struct ieee80211_hw *hw, int aci)
}
}

DEFINE_SPINLOCK(rtl92ce_lock);
void rtl92ce_enable_interrupt(struct ieee80211_hw *hw)
{
unsigned long flags;
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));

spin_lock_irqsave(&rtl92ce_lock, flags);
rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF);
rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF);
rtlpci->irq_enabled = true;
spin_unlock_irqrestore(&rtl92ce_lock, flags);
}

void rtl92ce_disable_interrupt(struct ieee80211_hw *hw)
{
unsigned long flags;
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));

spin_lock_irqsave(&rtl92ce_lock, flags);
rtl_write_dword(rtlpriv, REG_HIMR, IMR8190_DISABLED);
rtl_write_dword(rtlpriv, REG_HIMRE, IMR8190_DISABLED);
rtlpci->irq_enabled = false;
spin_unlock_irqrestore(&rtl92ce_lock, flags);
}

static void _rtl92ce_poweroff_adapter(struct ieee80211_hw *hw)
Expand Down

0 comments on commit 0709197

Please sign in to comment.