* [BUG] hwmon: (adt7470) warning when removing the module
@ 2022-04-07 3:17 Zheyu Ma
2022-04-07 5:01 ` Armin Wolf
0 siblings, 1 reply; 3+ messages in thread
From: Zheyu Ma @ 2022-04-07 3:17 UTC (permalink / raw)
To: jdelvare, linux; +Cc: linux-hwmon, Linux Kernel Mailing List
I found a bug when removing the adt7470 module.
The following log can reveal it:
[ 18.459479] ------------[ cut here ]------------
[ 18.459852] do not call blocking ops when !TASK_RUNNING; state=1
set at [<ffffffffa006052b>] adt7470_update_thread+0x7b/0x130 [adt7470]
[ 18.460857] WARNING: CPU: 7 PID: 365 at kernel/sched/core.c:9660
__might_sleep+0x96/0xb0
[ 18.461523] Modules linked in: adt7470(-)
[ 18.464568] RIP: 0010:__might_sleep+0x96/0xb0
[ 18.472577] Call Trace:
[ 18.472778] <TASK>
[ 18.472957] exit_signals+0x2f/0x3b0
[ 18.473251] do_exit+0xcd/0x18c0
[ 18.473534] ? __mutex_unlock_slowpath+0x1b8/0x740
[ 18.473927] kthread_exit+0x42/0x60
[ 18.474212] ? adt7470_detect+0x140/0x140 [adt7470]
[ 18.474622] kthread+0x272/0x2e0
[ 18.474885] ? adt7470_detect+0x140/0x140 [adt7470]
[ 18.475277] ? kthread_blkcg+0xa0/0xa0
[ 18.475601] ret_from_fork+0x22/0x30
[ 18.475901] </TASK>
Regards,
Zheyu Ma
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] hwmon: (adt7470) warning when removing the module
2022-04-07 3:17 [BUG] hwmon: (adt7470) warning when removing the module Zheyu Ma
@ 2022-04-07 5:01 ` Armin Wolf
2022-04-07 9:23 ` Guenter Roeck
0 siblings, 1 reply; 3+ messages in thread
From: Armin Wolf @ 2022-04-07 5:01 UTC (permalink / raw)
To: Zheyu Ma, jdelvare, linux; +Cc: linux-hwmon, Linux Kernel Mailing List
Am 07.04.22 um 05:17 schrieb Zheyu Ma:
> I found a bug when removing the adt7470 module.
>
> The following log can reveal it:
>
> [ 18.459479] ------------[ cut here ]------------
> [ 18.459852] do not call blocking ops when !TASK_RUNNING; state=1
> set at [<ffffffffa006052b>] adt7470_update_thread+0x7b/0x130 [adt7470]
> [ 18.460857] WARNING: CPU: 7 PID: 365 at kernel/sched/core.c:9660
> __might_sleep+0x96/0xb0
> [ 18.461523] Modules linked in: adt7470(-)
> [ 18.464568] RIP: 0010:__might_sleep+0x96/0xb0
> [ 18.472577] Call Trace:
> [ 18.472778] <TASK>
> [ 18.472957] exit_signals+0x2f/0x3b0
> [ 18.473251] do_exit+0xcd/0x18c0
> [ 18.473534] ? __mutex_unlock_slowpath+0x1b8/0x740
> [ 18.473927] kthread_exit+0x42/0x60
> [ 18.474212] ? adt7470_detect+0x140/0x140 [adt7470]
> [ 18.474622] kthread+0x272/0x2e0
> [ 18.474885] ? adt7470_detect+0x140/0x140 [adt7470]
> [ 18.475277] ? kthread_blkcg+0xa0/0xa0
> [ 18.475601] ret_from_fork+0x22/0x30
> [ 18.475901] </TASK>
>
> Regards,
> Zheyu Ma
Please correct me if i am wrong, but i think the issue lies in adt7470_update_thread()
leaving the kthread in TASK_INTERRUPTIBLE state when the second check for kthread_should_stop()
returns true and causes the kthread to exit. Since kthread_exit() might sleep in exit_signals(),
we get this warning.
Maybe moving set_current_state(TASK_INTERRUPTIBLE) below the second check for kthread_should_stop()
would fix the issue?
Armin Wolf
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] hwmon: (adt7470) warning when removing the module
2022-04-07 5:01 ` Armin Wolf
@ 2022-04-07 9:23 ` Guenter Roeck
0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2022-04-07 9:23 UTC (permalink / raw)
To: Armin Wolf, Zheyu Ma, jdelvare; +Cc: linux-hwmon, Linux Kernel Mailing List
On 4/6/22 22:01, Armin Wolf wrote:
> Am 07.04.22 um 05:17 schrieb Zheyu Ma:
>
>> I found a bug when removing the adt7470 module.
>>
>> The following log can reveal it:
>>
>> [ 18.459479] ------------[ cut here ]------------
>> [ 18.459852] do not call blocking ops when !TASK_RUNNING; state=1
>> set at [<ffffffffa006052b>] adt7470_update_thread+0x7b/0x130 [adt7470]
>> [ 18.460857] WARNING: CPU: 7 PID: 365 at kernel/sched/core.c:9660
>> __might_sleep+0x96/0xb0
>> [ 18.461523] Modules linked in: adt7470(-)
>> [ 18.464568] RIP: 0010:__might_sleep+0x96/0xb0
>> [ 18.472577] Call Trace:
>> [ 18.472778] <TASK>
>> [ 18.472957] exit_signals+0x2f/0x3b0
>> [ 18.473251] do_exit+0xcd/0x18c0
>> [ 18.473534] ? __mutex_unlock_slowpath+0x1b8/0x740
>> [ 18.473927] kthread_exit+0x42/0x60
>> [ 18.474212] ? adt7470_detect+0x140/0x140 [adt7470]
>> [ 18.474622] kthread+0x272/0x2e0
>> [ 18.474885] ? adt7470_detect+0x140/0x140 [adt7470]
>> [ 18.475277] ? kthread_blkcg+0xa0/0xa0
>> [ 18.475601] ret_from_fork+0x22/0x30
>> [ 18.475901] </TASK>
>>
>> Regards,
>> Zheyu Ma
>
> Please correct me if i am wrong, but i think the issue lies in adt7470_update_thread()
> leaving the kthread in TASK_INTERRUPTIBLE state when the second check for kthread_should_stop()
> returns true and causes the kthread to exit. Since kthread_exit() might sleep in exit_signals(),
> we get this warning.
> Maybe moving set_current_state(TASK_INTERRUPTIBLE) below the second check for kthread_should_stop()
> would fix the issue?
>
Agreed. Care to send a patch ?
Thanks,
Guenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-07 9:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 3:17 [BUG] hwmon: (adt7470) warning when removing the module Zheyu Ma
2022-04-07 5:01 ` Armin Wolf
2022-04-07 9:23 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.