diff mbox series

[SRU,Xenial,v4] UBUNTU: SAUCE: Redpine: improve cancel_hw_scan handling to fix kernel panic

Message ID 1531749587-21901-1-git-send-email-siva8118@gmail.com
State New
Headers show
Series [SRU,Xenial,v4] UBUNTU: SAUCE: Redpine: improve cancel_hw_scan handling to fix kernel panic | expand

Commit Message

Siva Rebbagondla July 16, 2018, 1:59 p.m. UTC
From: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1773410
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1777850

Kernel panic is observed when network manager is stopped or Interface is
is DOWN, while system is entering into hibernation. The root cause of the
issue is scan work function keeps running even after cancel_hw_scan() call.
Issue is resolved by calling cancel_work_sync().

...skipping...
[ 1171.913244] BUG: unable to handle page request at 00000000001067e38
[ 1171.913248] IP: cfg80211_scan_done+0xb0/0xc0 [cfg80211]
[ 1171.913554] Hardware name: Dell Inc. Edge Gateway 3003/      , BIOS 01.00.06 01/22/2018
[ 1171.913668] Workqueue: phy1 ieee80211_scan_work [mac80211]
[ 1171.913773] RIP: 0010:cfg80211_scan_done+0xb0/0xc0 [cfg80211]
[ 1171.913780] RSP: 0018:ffffc1fe41b47dc8 EFLAGS: 00010286
[ 1171.913789] RAX: 0000000000000001 RBX: ffffffffc0e60120 RCX: 0000000100080006
[ 1171.913794] RDX: ffff9eeab7e3bc58 RSI: ffff9eeab0c69080 RDI: ffff9eeab7e3bc00
[ 1171.913799] RBP: ffff9eeab7e3bc00 R08: 00000000b7e3b201 R09: 0000000100080006
[ 1171.913805] R10: ffffc1fe41b47d20 R11: 0000000000000000 R12: ffff9eeab0c69080
[ 1171.913810] R13: 0000000000000022 R14: ffff9eeab0c68760 R15: ffff9eeab7af3c00
[ 1171.913817] FS:  0000000000000000(0000) GS:ffff9eeab0000000(0000) knlGS:0000000000000000
[ 1171.913823] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1171.913828] CR2: 00007f76c73ac190 CR3: 000000006e20a000 CR4: 00000000001006f0
[ 1171.913833] Call Trace:
[ 1171.913864]  ? rsi_mac80211_sta_remove+0x260/0x260 [rsi_91x]
[ 1171.913971]  __ieee80211_scan_completed+0xb1/0x390 [mac80211]
[ 1171.914078]  ieee80211_scan_work+0x7e/0x480 [mac80211]
[ 1171.914098]  process_one_work+0x142/0x3d0
[ 1171.914111]  worker_thread+0x229/0x440
[ 1171.914122]  kthread+0xf5/0x130
[ 1171.914132]  ? process_one_work+0x3d0/0x3d0
[ 1171.914140]  ? kthread_associate_blkcg+0x90/0x90
[ 1171.914152]  ret_from_fork+0x35/0x40

Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
---
v2: Added enhancement in case of AP mode.
v3: Updated BugLink is in proper format.
v4: Added enhancement for handling mutex_locks.
---
 ubuntu/rsi/rsi_91x_mac80211.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Shrirang Bagul July 20, 2018, 2:23 a.m. UTC | #1
On Mon, 2018-07-16 at 19:29 +0530, Siva Rebbagondla wrote:
> From: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> 
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1773410
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1777850

Siva, please use the correct format for buglinks, these bug links should be:
BugLink: https://bugs.launchpad.net/bugs/1773410
BugLink: https://bugs.launchpad.net/bugs/1777850

> Kernel panic is observed when network manager is stopped or Interface is
> is DOWN, while system is entering into hibernation. The root cause of the
> issue is scan work function keeps running even after cancel_hw_scan() call.
> Issue is resolved by calling cancel_work_sync().
> 
> ...skipping...
> [ 1171.913244] BUG: unable to handle page request at 00000000001067e38
> [ 1171.913248] IP: cfg80211_scan_done+0xb0/0xc0 [cfg80211]
> [ 1171.913554] Hardware name: Dell Inc. Edge Gateway 3003/      , BIOS 01.00.06
> 01/22/2018
> [ 1171.913668] Workqueue: phy1 ieee80211_scan_work [mac80211]
> [ 1171.913773] RIP: 0010:cfg80211_scan_done+0xb0/0xc0 [cfg80211]
> [ 1171.913780] RSP: 0018:ffffc1fe41b47dc8 EFLAGS: 00010286
> [ 1171.913789] RAX: 0000000000000001 RBX: ffffffffc0e60120 RCX: 0000000100080006
> [ 1171.913794] RDX: ffff9eeab7e3bc58 RSI: ffff9eeab0c69080 RDI: ffff9eeab7e3bc00
> [ 1171.913799] RBP: ffff9eeab7e3bc00 R08: 00000000b7e3b201 R09: 0000000100080006
> [ 1171.913805] R10: ffffc1fe41b47d20 R11: 0000000000000000 R12: ffff9eeab0c69080
> [ 1171.913810] R13: 0000000000000022 R14: ffff9eeab0c68760 R15: ffff9eeab7af3c00
> [ 1171.913817] FS:  0000000000000000(0000) GS:ffff9eeab0000000(0000)
> knlGS:0000000000000000
> [ 1171.913823] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 1171.913828] CR2: 00007f76c73ac190 CR3: 000000006e20a000 CR4: 00000000001006f0
> [ 1171.913833] Call Trace:
> [ 1171.913864]  ? rsi_mac80211_sta_remove+0x260/0x260 [rsi_91x]
> [ 1171.913971]  __ieee80211_scan_completed+0xb1/0x390 [mac80211]
> [ 1171.914078]  ieee80211_scan_work+0x7e/0x480 [mac80211]
> [ 1171.914098]  process_one_work+0x142/0x3d0
> [ 1171.914111]  worker_thread+0x229/0x440
> [ 1171.914122]  kthread+0xf5/0x130
> [ 1171.914132]  ? process_one_work+0x3d0/0x3d0
> [ 1171.914140]  ? kthread_associate_blkcg+0x90/0x90
> [ 1171.914152]  ret_from_fork+0x35/0x40
> 
> Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Acked-by: Shrirang Bagul <shrirang.bagul@canonical.com>
> ---
> v2: Added enhancement in case of AP mode.
> v3: Updated BugLink is in proper format.
> v4: Added enhancement for handling mutex_locks.
> ---
>  ubuntu/rsi/rsi_91x_mac80211.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/ubuntu/rsi/rsi_91x_mac80211.c b/ubuntu/rsi/rsi_91x_mac80211.c
> index 36c0cfd..727a754 100644
> --- a/ubuntu/rsi/rsi_91x_mac80211.c
> +++ b/ubuntu/rsi/rsi_91x_mac80211.c
> @@ -375,6 +375,7 @@ static int rsi_mac80211_hw_scan_start(struct ieee80211_hw *hw,
>  	if (common->bgscan_en || common->scan_in_prog)
>  		return -EBUSY;
>  
> +	cancel_work_sync(&common->scan_work);
>  	mutex_lock(&common->mutex);
>  
>  	if (!bss->assoc) {
> @@ -627,6 +628,7 @@ static void rsi_mac80211_stop(struct ieee80211_hw *hw)
>  
>  	ven_rsi_dbg(ERR_ZONE, "===> Interface DOWN <===\n");
>  
> +	cancel_work_sync(&common->scan_work);
>  	mutex_lock(&common->mutex);
>  	
>  	common->iface_down = true;
> @@ -2343,14 +2345,10 @@ void rsi_mac80211_rfkill_poll(struct ieee80211_hw *hw)
>  	struct rsi_hw *adapter = hw->priv;
>  	struct rsi_common *common = adapter->priv;
>  	
> -	mutex_lock(&common->mutex);
> -
>  	if (common->fsm_state != FSM_MAC_INIT_DONE)
>  		wiphy_rfkill_set_hw_state(hw->wiphy, true);
>  	else
>  		wiphy_rfkill_set_hw_state(hw->wiphy, false);
> -
> -	mutex_unlock(&common->mutex);
>  }
>  
>  #ifdef CONFIG_VEN_RSI_WOW
Anthony Wong July 25, 2018, 2:39 p.m. UTC | #2
On Fri, Jul 20, 2018 at 10:23:17AM +0800, Shrirang Bagul wrote:
> On Mon, 2018-07-16 at 19:29 +0530, Siva Rebbagondla wrote:
> > From: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> > 
> > BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1773410
> > BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1777850
> 
> Siva, please use the correct format for buglinks, these bug links should be:
> BugLink: https://bugs.launchpad.net/bugs/1773410
> BugLink: https://bugs.launchpad.net/bugs/1777850
> 
> > Kernel panic is observed when network manager is stopped or Interface is
> > is DOWN, while system is entering into hibernation. The root cause of the
> > issue is scan work function keeps running even after cancel_hw_scan() call.
> > Issue is resolved by calling cancel_work_sync().
> > 
> > ...skipping...
> > [ 1171.913244] BUG: unable to handle page request at 00000000001067e38
> > [ 1171.913248] IP: cfg80211_scan_done+0xb0/0xc0 [cfg80211]
> > [ 1171.913554] Hardware name: Dell Inc. Edge Gateway 3003/      , BIOS 01.00.06
> > 01/22/2018
> > [ 1171.913668] Workqueue: phy1 ieee80211_scan_work [mac80211]
> > [ 1171.913773] RIP: 0010:cfg80211_scan_done+0xb0/0xc0 [cfg80211]
> > [ 1171.913780] RSP: 0018:ffffc1fe41b47dc8 EFLAGS: 00010286
> > [ 1171.913789] RAX: 0000000000000001 RBX: ffffffffc0e60120 RCX: 0000000100080006
> > [ 1171.913794] RDX: ffff9eeab7e3bc58 RSI: ffff9eeab0c69080 RDI: ffff9eeab7e3bc00
> > [ 1171.913799] RBP: ffff9eeab7e3bc00 R08: 00000000b7e3b201 R09: 0000000100080006
> > [ 1171.913805] R10: ffffc1fe41b47d20 R11: 0000000000000000 R12: ffff9eeab0c69080
> > [ 1171.913810] R13: 0000000000000022 R14: ffff9eeab0c68760 R15: ffff9eeab7af3c00
> > [ 1171.913817] FS:  0000000000000000(0000) GS:ffff9eeab0000000(0000)
> > knlGS:0000000000000000
> > [ 1171.913823] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > [ 1171.913828] CR2: 00007f76c73ac190 CR3: 000000006e20a000 CR4: 00000000001006f0
> > [ 1171.913833] Call Trace:
> > [ 1171.913864]  ? rsi_mac80211_sta_remove+0x260/0x260 [rsi_91x]
> > [ 1171.913971]  __ieee80211_scan_completed+0xb1/0x390 [mac80211]
> > [ 1171.914078]  ieee80211_scan_work+0x7e/0x480 [mac80211]
> > [ 1171.914098]  process_one_work+0x142/0x3d0
> > [ 1171.914111]  worker_thread+0x229/0x440
> > [ 1171.914122]  kthread+0xf5/0x130
> > [ 1171.914132]  ? process_one_work+0x3d0/0x3d0
> > [ 1171.914140]  ? kthread_associate_blkcg+0x90/0x90
> > [ 1171.914152]  ret_from_fork+0x35/0x40
> > 
> > Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> Acked-by: Shrirang Bagul <shrirang.bagul@canonical.com>

Confirmed offline with Shrirang that this patch has been verified by
our QA and does not cause any regression. BugLink needs fixing though.

Acked-by: Anthony Wong <anthony.wong@canonical.com>
Khalid Elmously July 27, 2018, 5:26 a.m. UTC | #3
..to xenial master-next

On 2018-07-16 19:29:47 , Siva Rebbagondla wrote:
> From: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> 
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1773410
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1777850
> 
> Kernel panic is observed when network manager is stopped or Interface is
> is DOWN, while system is entering into hibernation. The root cause of the
> issue is scan work function keeps running even after cancel_hw_scan() call.
> Issue is resolved by calling cancel_work_sync().
> 
> ...skipping...
> [ 1171.913244] BUG: unable to handle page request at 00000000001067e38
> [ 1171.913248] IP: cfg80211_scan_done+0xb0/0xc0 [cfg80211]
> [ 1171.913554] Hardware name: Dell Inc. Edge Gateway 3003/      , BIOS 01.00.06 01/22/2018
> [ 1171.913668] Workqueue: phy1 ieee80211_scan_work [mac80211]
> [ 1171.913773] RIP: 0010:cfg80211_scan_done+0xb0/0xc0 [cfg80211]
> [ 1171.913780] RSP: 0018:ffffc1fe41b47dc8 EFLAGS: 00010286
> [ 1171.913789] RAX: 0000000000000001 RBX: ffffffffc0e60120 RCX: 0000000100080006
> [ 1171.913794] RDX: ffff9eeab7e3bc58 RSI: ffff9eeab0c69080 RDI: ffff9eeab7e3bc00
> [ 1171.913799] RBP: ffff9eeab7e3bc00 R08: 00000000b7e3b201 R09: 0000000100080006
> [ 1171.913805] R10: ffffc1fe41b47d20 R11: 0000000000000000 R12: ffff9eeab0c69080
> [ 1171.913810] R13: 0000000000000022 R14: ffff9eeab0c68760 R15: ffff9eeab7af3c00
> [ 1171.913817] FS:  0000000000000000(0000) GS:ffff9eeab0000000(0000) knlGS:0000000000000000
> [ 1171.913823] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 1171.913828] CR2: 00007f76c73ac190 CR3: 000000006e20a000 CR4: 00000000001006f0
> [ 1171.913833] Call Trace:
> [ 1171.913864]  ? rsi_mac80211_sta_remove+0x260/0x260 [rsi_91x]
> [ 1171.913971]  __ieee80211_scan_completed+0xb1/0x390 [mac80211]
> [ 1171.914078]  ieee80211_scan_work+0x7e/0x480 [mac80211]
> [ 1171.914098]  process_one_work+0x142/0x3d0
> [ 1171.914111]  worker_thread+0x229/0x440
> [ 1171.914122]  kthread+0xf5/0x130
> [ 1171.914132]  ? process_one_work+0x3d0/0x3d0
> [ 1171.914140]  ? kthread_associate_blkcg+0x90/0x90
> [ 1171.914152]  ret_from_fork+0x35/0x40
> 
> Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> ---
> v2: Added enhancement in case of AP mode.
> v3: Updated BugLink is in proper format.
> v4: Added enhancement for handling mutex_locks.
> ---
>  ubuntu/rsi/rsi_91x_mac80211.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/ubuntu/rsi/rsi_91x_mac80211.c b/ubuntu/rsi/rsi_91x_mac80211.c
> index 36c0cfd..727a754 100644
> --- a/ubuntu/rsi/rsi_91x_mac80211.c
> +++ b/ubuntu/rsi/rsi_91x_mac80211.c
> @@ -375,6 +375,7 @@ static int rsi_mac80211_hw_scan_start(struct ieee80211_hw *hw,
>  	if (common->bgscan_en || common->scan_in_prog)
>  		return -EBUSY;
>  
> +	cancel_work_sync(&common->scan_work);
>  	mutex_lock(&common->mutex);
>  
>  	if (!bss->assoc) {
> @@ -627,6 +628,7 @@ static void rsi_mac80211_stop(struct ieee80211_hw *hw)
>  
>  	ven_rsi_dbg(ERR_ZONE, "===> Interface DOWN <===\n");
>  
> +	cancel_work_sync(&common->scan_work);
>  	mutex_lock(&common->mutex);
>  	
>  	common->iface_down = true;
> @@ -2343,14 +2345,10 @@ void rsi_mac80211_rfkill_poll(struct ieee80211_hw *hw)
>  	struct rsi_hw *adapter = hw->priv;
>  	struct rsi_common *common = adapter->priv;
>  	
> -	mutex_lock(&common->mutex);
> -
>  	if (common->fsm_state != FSM_MAC_INIT_DONE)
>  		wiphy_rfkill_set_hw_state(hw->wiphy, true);
>  	else
>  		wiphy_rfkill_set_hw_state(hw->wiphy, false);
> -
> -	mutex_unlock(&common->mutex);
>  }
>  
>  #ifdef CONFIG_VEN_RSI_WOW
> -- 
> 2.5.5
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/ubuntu/rsi/rsi_91x_mac80211.c b/ubuntu/rsi/rsi_91x_mac80211.c
index 36c0cfd..727a754 100644
--- a/ubuntu/rsi/rsi_91x_mac80211.c
+++ b/ubuntu/rsi/rsi_91x_mac80211.c
@@ -375,6 +375,7 @@  static int rsi_mac80211_hw_scan_start(struct ieee80211_hw *hw,
 	if (common->bgscan_en || common->scan_in_prog)
 		return -EBUSY;
 
+	cancel_work_sync(&common->scan_work);
 	mutex_lock(&common->mutex);
 
 	if (!bss->assoc) {
@@ -627,6 +628,7 @@  static void rsi_mac80211_stop(struct ieee80211_hw *hw)
 
 	ven_rsi_dbg(ERR_ZONE, "===> Interface DOWN <===\n");
 
+	cancel_work_sync(&common->scan_work);
 	mutex_lock(&common->mutex);
 	
 	common->iface_down = true;
@@ -2343,14 +2345,10 @@  void rsi_mac80211_rfkill_poll(struct ieee80211_hw *hw)
 	struct rsi_hw *adapter = hw->priv;
 	struct rsi_common *common = adapter->priv;
 	
-	mutex_lock(&common->mutex);
-
 	if (common->fsm_state != FSM_MAC_INIT_DONE)
 		wiphy_rfkill_set_hw_state(hw->wiphy, true);
 	else
 		wiphy_rfkill_set_hw_state(hw->wiphy, false);
-
-	mutex_unlock(&common->mutex);
 }
 
 #ifdef CONFIG_VEN_RSI_WOW