diff mbox series

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

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

Commit Message

Siva Rebbagondla June 20, 2018, 1:44 p.m. UTC
From: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>

Buglink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1777858

While running regressions, observed below kernel panic when sdio disconnect
called. The root cause of this issue is, kthread_stop() is taking care of
wait_for_completion() by default. Hence, removing wait_for_completion()
from rsi_disconnect().

... skipping ...
BUG: unable to handle kernel NULL pointer dereference at           (null)
IP: [<ffffffff810a63df>] exit_creds+0x1f/0x50
PGD 0
Oops: 0002 [#1] SMP
CPU: 0 PID: 6502 Comm: rmmod Tainted: G           OE   4.4.0-128-generic #154-Ubuntu
Hardware name: Dell Inc. Edge Gateway 3003/      , BIOS 01.00.00 04/17/2017
Stack:
ffff88007392e600 ffff880075847dc0 ffffffff8108160a 0000000000000000
ffff88007392e600 ffff880075847de8 ffffffff810a484b ffff880076127000
ffff88003cd3a800 ffff880074f12a00 ffff880075847e28 ffffffffc09bed15
Call Trace:
[<ffffffff8108160a>] __put_task_struct+0x5a/0x140
[<ffffffff810a484b>] kthread_stop+0x10b/0x110
[<ffffffffc09bed15>] rsi_disconnect+0x2f5/0x300 [ven_rsi_sdio]
[<ffffffff81578bcb>] ? __pm_runtime_resume+0x5b/0x80
[<ffffffff816f0918>] sdio_bus_remove+0x38/0x100
[<ffffffff8156cc64>] __device_release_driver+0xa4/0x150
[<ffffffff8156d7a5>] driver_detach+0xb5/0xc0
[<ffffffff8156c6c5>] bus_remove_driver+0x55/0xd0
[<ffffffff8156dfbc>] driver_unregister+0x2c/0x50
[<ffffffff816f0b8a>] sdio_unregister_driver+0x1a/0x20
[<ffffffffc09bf0f5>] rsi_module_exit+0x15/0x30 [ven_rsi_sdio]
[<ffffffff8110cad8>] SyS_delete_module+0x1b8/0x210
[<ffffffff81851dc8>] entry_SYSCALL_64_fastpath+0x1c/0xbb

Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
---
 ubuntu/rsi/rsi_common.h | 1 -
 1 file changed, 1 deletion(-)

Comments

Khalid Elmously June 27, 2018, 4:29 a.m. UTC | #1
On 2018-06-20 19:14:46 , Siva Rebbagondla wrote:
> From: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> 
> Buglink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1777858
> 
> While running regressions, observed below kernel panic when sdio disconnect
> called. The root cause of this issue is, kthread_stop() is taking care of
> wait_for_completion() by default. Hence, removing wait_for_completion()
> from rsi_disconnect().
> 
> ... skipping ...
> BUG: unable to handle kernel NULL pointer dereference at           (null)
> IP: [<ffffffff810a63df>] exit_creds+0x1f/0x50
> PGD 0
> Oops: 0002 [#1] SMP
> CPU: 0 PID: 6502 Comm: rmmod Tainted: G           OE   4.4.0-128-generic #154-Ubuntu
> Hardware name: Dell Inc. Edge Gateway 3003/      , BIOS 01.00.00 04/17/2017
> Stack:
> ffff88007392e600 ffff880075847dc0 ffffffff8108160a 0000000000000000
> ffff88007392e600 ffff880075847de8 ffffffff810a484b ffff880076127000
> ffff88003cd3a800 ffff880074f12a00 ffff880075847e28 ffffffffc09bed15
> Call Trace:
> [<ffffffff8108160a>] __put_task_struct+0x5a/0x140
> [<ffffffff810a484b>] kthread_stop+0x10b/0x110
> [<ffffffffc09bed15>] rsi_disconnect+0x2f5/0x300 [ven_rsi_sdio]
> [<ffffffff81578bcb>] ? __pm_runtime_resume+0x5b/0x80
> [<ffffffff816f0918>] sdio_bus_remove+0x38/0x100
> [<ffffffff8156cc64>] __device_release_driver+0xa4/0x150
> [<ffffffff8156d7a5>] driver_detach+0xb5/0xc0
> [<ffffffff8156c6c5>] bus_remove_driver+0x55/0xd0
> [<ffffffff8156dfbc>] driver_unregister+0x2c/0x50
> [<ffffffff816f0b8a>] sdio_unregister_driver+0x1a/0x20
> [<ffffffffc09bf0f5>] rsi_module_exit+0x15/0x30 [ven_rsi_sdio]
> [<ffffffff8110cad8>] SyS_delete_module+0x1b8/0x210
> [<ffffffff81851dc8>] entry_SYSCALL_64_fastpath+0x1c/0xbb
> 
> Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> ---
>  ubuntu/rsi/rsi_common.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/ubuntu/rsi/rsi_common.h b/ubuntu/rsi/rsi_common.h
> index e7f1240..f4f2a57 100644
> --- a/ubuntu/rsi/rsi_common.h
> +++ b/ubuntu/rsi/rsi_common.h
> @@ -90,7 +90,6 @@ static inline int rsi_kill_thread(struct rsi_thread *handle)
>  	atomic_inc(&handle->thread_done);
>  	rsi_set_event(&handle->event);
>  
> -	wait_for_completion(&handle->completion);
>  	return kthread_stop(handle->task);
>  }
> 

Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Kleber Sacilotto de Souza June 28, 2018, 8:44 a.m. UTC | #2
On 06/20/18 15:44, Siva Rebbagondla wrote:
> From: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> 
> Buglink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1777858

Applied to xenial/master-next branch, fixing the above Buglink with the
short form:

Buglink: https://bugs.launchpad.net/bugs/1777858

Thanks,
Kleber

> 
> While running regressions, observed below kernel panic when sdio disconnect
> called. The root cause of this issue is, kthread_stop() is taking care of
> wait_for_completion() by default. Hence, removing wait_for_completion()
> from rsi_disconnect().
> 
> ... skipping ...
> BUG: unable to handle kernel NULL pointer dereference at           (null)
> IP: [<ffffffff810a63df>] exit_creds+0x1f/0x50
> PGD 0
> Oops: 0002 [#1] SMP
> CPU: 0 PID: 6502 Comm: rmmod Tainted: G           OE   4.4.0-128-generic #154-Ubuntu
> Hardware name: Dell Inc. Edge Gateway 3003/      , BIOS 01.00.00 04/17/2017
> Stack:
> ffff88007392e600 ffff880075847dc0 ffffffff8108160a 0000000000000000
> ffff88007392e600 ffff880075847de8 ffffffff810a484b ffff880076127000
> ffff88003cd3a800 ffff880074f12a00 ffff880075847e28 ffffffffc09bed15
> Call Trace:
> [<ffffffff8108160a>] __put_task_struct+0x5a/0x140
> [<ffffffff810a484b>] kthread_stop+0x10b/0x110
> [<ffffffffc09bed15>] rsi_disconnect+0x2f5/0x300 [ven_rsi_sdio]
> [<ffffffff81578bcb>] ? __pm_runtime_resume+0x5b/0x80
> [<ffffffff816f0918>] sdio_bus_remove+0x38/0x100
> [<ffffffff8156cc64>] __device_release_driver+0xa4/0x150
> [<ffffffff8156d7a5>] driver_detach+0xb5/0xc0
> [<ffffffff8156c6c5>] bus_remove_driver+0x55/0xd0
> [<ffffffff8156dfbc>] driver_unregister+0x2c/0x50
> [<ffffffff816f0b8a>] sdio_unregister_driver+0x1a/0x20
> [<ffffffffc09bf0f5>] rsi_module_exit+0x15/0x30 [ven_rsi_sdio]
> [<ffffffff8110cad8>] SyS_delete_module+0x1b8/0x210
> [<ffffffff81851dc8>] entry_SYSCALL_64_fastpath+0x1c/0xbb
> 
> Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> ---
>  ubuntu/rsi/rsi_common.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/ubuntu/rsi/rsi_common.h b/ubuntu/rsi/rsi_common.h
> index e7f1240..f4f2a57 100644
> --- a/ubuntu/rsi/rsi_common.h
> +++ b/ubuntu/rsi/rsi_common.h
> @@ -90,7 +90,6 @@ static inline int rsi_kill_thread(struct rsi_thread *handle)
>  	atomic_inc(&handle->thread_done);
>  	rsi_set_event(&handle->event);
>  
> -	wait_for_completion(&handle->completion);
>  	return kthread_stop(handle->task);
>  }
>  
>
diff mbox series

Patch

diff --git a/ubuntu/rsi/rsi_common.h b/ubuntu/rsi/rsi_common.h
index e7f1240..f4f2a57 100644
--- a/ubuntu/rsi/rsi_common.h
+++ b/ubuntu/rsi/rsi_common.h
@@ -90,7 +90,6 @@  static inline int rsi_kill_thread(struct rsi_thread *handle)
 	atomic_inc(&handle->thread_done);
 	rsi_set_event(&handle->event);
 
-	wait_for_completion(&handle->completion);
 	return kthread_stop(handle->task);
 }