Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1360925 > unrolled thread
| Started by | Tejun Heo <tj@kernel.org> |
|---|---|
| First post | 2016-03-18 22:00 +0100 |
| Last post | 2016-03-22 13:40 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: net/bluetooth: workqueue destruction WARNING in hci_unregister_dev Tejun Heo <tj@kernel.org> - 2016-03-18 22:00 +0100
Re: net/bluetooth: workqueue destruction WARNING in hci_unregister_dev Jiri Slaby <jslaby@suse.cz> - 2016-03-21 17:00 +0100
Re: net/bluetooth: workqueue destruction WARNING in hci_unregister_dev Jiri Slaby <jslaby@suse.cz> - 2016-03-22 09:20 +0100
Re: net/bluetooth: workqueue destruction WARNING in hci_unregister_dev Dmitry Vyukov <dvyukov@google.com> - 2016-03-22 13:40 +0100
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2016-03-18 22:00 +0100 |
| Subject | Re: net/bluetooth: workqueue destruction WARNING in hci_unregister_dev |
| Message-ID | <re9EZ-8dX-7@gated-at.bofh.it> |
Hello, Jiri. On Thu, Mar 17, 2016 at 01:00:13PM +0100, Jiri Slaby wrote: > >> I have not done that yet, but today, I see: > >> destroy_workqueue: name='req_hci0' pwq=ffff88002f590300 > >> wq->dfl_pwq=ffff88002f591e00 pwq->refcnt=2 pwq->nr_active=0 delayed_works: > >> pwq 12: cpus=0-1 node=0 flags=0x4 nice=-20 active=0/1 > >> in-flight: 18568:wq_barrier_func > > > > So, this means that there's flush_work() racing against workqueue > > destruction, which can't be safe. :( > > But I cannot trigger the WARN_ONs in the attached patch, so I am > confused how this can happen :(. (While I am still seeing the destroy > WARNINGs.) So, no operations should be in progress when destroy_workqueue() is called. If somebody was flushing a work item, the flush call must have returned before destroy_workqueue() was invoked, which doesn't seem to be the case here. Can you trigger BUG_ON() or sysrq-t when the above triggers? There must be a task which is flushing a work item there and it shouldn't be difficult to pinpoint what's going on from it. Thanks. -- tejun
[toc] | [next] | [standalone]
| From | Jiri Slaby <jslaby@suse.cz> |
|---|---|
| Date | 2016-03-21 17:00 +0100 |
| Message-ID | <rfapl-7MH-15@gated-at.bofh.it> |
| In reply to | #1360925 |
Hello,
On 03/18/2016, 09:52 PM, Tejun Heo wrote:
> On Thu, Mar 17, 2016 at 01:00:13PM +0100, Jiri Slaby wrote:
>>>> I have not done that yet, but today, I see:
>>>> destroy_workqueue: name='req_hci0' pwq=ffff88002f590300
>>>> wq->dfl_pwq=ffff88002f591e00 pwq->refcnt=2 pwq->nr_active=0 delayed_works:
>>>> pwq 12: cpus=0-1 node=0 flags=0x4 nice=-20 active=0/1
>>>> in-flight: 18568:wq_barrier_func
>>>
>>> So, this means that there's flush_work() racing against workqueue
>>> destruction, which can't be safe. :(
>>
>> But I cannot trigger the WARN_ONs in the attached patch, so I am
>> confused how this can happen :(. (While I am still seeing the destroy
>> WARNINGs.)
>
> So, no operations should be in progress when destroy_workqueue() is
> called. If somebody was flushing a work item, the flush call must
> have returned before destroy_workqueue() was invoked, which doesn't
> seem to be the case here. Can you trigger BUG_ON() or sysrq-t when
> the above triggers? There must be a task which is flushing a work
> item there and it shouldn't be difficult to pinpoint what's going on
> from it.
The output of sysrq-t is here (> 200k), but I cannot see anything
suspicious in it:
http://www.fi.muni.cz/~xslaby/sklad/panics/jctl.txt
This is what the code does now:
+ if ((pwq != wq->dfl_pwq) && (pwq->refcnt > 1)) {
+ pr_info("%s: name='%s' pwq=%p wq->dfl_pwq=%p
pwq->refcnt=%d pwq->nr_active=%d delayed_works:",
+ __func__, wq->name, pwq,
wq->dfl_pwq,
+ pwq->refcnt, pwq->nr_active);
+
+ show_pwq(pwq);
+
+ mutex_unlock(&wq->mutex);
+ show_state();
+ show_workqueue_state();
+ WARN_ON(1);
+ return;
+ }
thanks,
--
js
suse labs
[toc] | [prev] | [next] | [standalone]
| From | Jiri Slaby <jslaby@suse.cz> |
|---|---|
| Date | 2016-03-22 09:20 +0100 |
| Message-ID | <rfpHI-1Fu-9@gated-at.bofh.it> |
| In reply to | #1361953 |
On 03/21/2016, 04:58 PM, Jiri Slaby wrote:
> Hello,
>
> On 03/18/2016, 09:52 PM, Tejun Heo wrote:
>> On Thu, Mar 17, 2016 at 01:00:13PM +0100, Jiri Slaby wrote:
>>>>> I have not done that yet, but today, I see:
>>>>> destroy_workqueue: name='req_hci0' pwq=ffff88002f590300
>>>>> wq->dfl_pwq=ffff88002f591e00 pwq->refcnt=2 pwq->nr_active=0 delayed_works:
>>>>> pwq 12: cpus=0-1 node=0 flags=0x4 nice=-20 active=0/1
>>>>> in-flight: 18568:wq_barrier_func
>>>>
>>>> So, this means that there's flush_work() racing against workqueue
>>>> destruction, which can't be safe. :(
>>>
>>> But I cannot trigger the WARN_ONs in the attached patch, so I am
>>> confused how this can happen :(. (While I am still seeing the destroy
>>> WARNINGs.)
>>
>> So, no operations should be in progress when destroy_workqueue() is
>> called. If somebody was flushing a work item, the flush call must
>> have returned before destroy_workqueue() was invoked, which doesn't
>> seem to be the case here. Can you trigger BUG_ON() or sysrq-t when
>> the above triggers? There must be a task which is flushing a work
>> item there and it shouldn't be difficult to pinpoint what's going on
>> from it.
>
> The output of sysrq-t is here (> 200k), but I cannot see anything
> suspicious in it:
> http://www.fi.muni.cz/~xslaby/sklad/panics/jctl.txt
Hmm, so I seem I cannot reproduce with this hunk:
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3139,10 +3139,10 @@ void hci_unregister_dev(struct hci_dev *hdev)
list_del(&hdev->list);
write_unlock(&hci_dev_list_lock);
- hci_dev_do_close(hdev);
-
cancel_work_sync(&hdev->power_on);
+ hci_dev_do_close(hdev);
+
if (!test_bit(HCI_INIT, &hdev->flags) &&
!hci_dev_test_flag(hdev, HCI_SETUP) &&
!hci_dev_test_flag(hdev, HCI_CONFIG)) {
I cannot explain why though. I do not see how it matters in this
particular case...
Dmitry, could you apply it too? But I don't know how often you see the
warning.
PS. next on the table is the gsm tty warning.
thanks,
--
js
suse labs
[toc] | [prev] | [next] | [standalone]
| From | Dmitry Vyukov <dvyukov@google.com> |
|---|---|
| Date | 2016-03-22 13:40 +0100 |
| Subject | Re: net/bluetooth: workqueue destruction WARNING in hci_unregister_dev |
| Message-ID | <rftLl-4o3-21@gated-at.bofh.it> |
| In reply to | #1362414 |
On Tue, Mar 22, 2016 at 9:09 AM, Jiri Slaby <jslaby@suse.cz> wrote:
> On 03/21/2016, 04:58 PM, Jiri Slaby wrote:
>> Hello,
>>
>> On 03/18/2016, 09:52 PM, Tejun Heo wrote:
>>> On Thu, Mar 17, 2016 at 01:00:13PM +0100, Jiri Slaby wrote:
>>>>>> I have not done that yet, but today, I see:
>>>>>> destroy_workqueue: name='req_hci0' pwq=ffff88002f590300
>>>>>> wq->dfl_pwq=ffff88002f591e00 pwq->refcnt=2 pwq->nr_active=0 delayed_works:
>>>>>> pwq 12: cpus=0-1 node=0 flags=0x4 nice=-20 active=0/1
>>>>>> in-flight: 18568:wq_barrier_func
>>>>>
>>>>> So, this means that there's flush_work() racing against workqueue
>>>>> destruction, which can't be safe. :(
>>>>
>>>> But I cannot trigger the WARN_ONs in the attached patch, so I am
>>>> confused how this can happen :(. (While I am still seeing the destroy
>>>> WARNINGs.)
>>>
>>> So, no operations should be in progress when destroy_workqueue() is
>>> called. If somebody was flushing a work item, the flush call must
>>> have returned before destroy_workqueue() was invoked, which doesn't
>>> seem to be the case here. Can you trigger BUG_ON() or sysrq-t when
>>> the above triggers? There must be a task which is flushing a work
>>> item there and it shouldn't be difficult to pinpoint what's going on
>>> from it.
>>
>> The output of sysrq-t is here (> 200k), but I cannot see anything
>> suspicious in it:
>> http://www.fi.muni.cz/~xslaby/sklad/panics/jctl.txt
>
> Hmm, so I seem I cannot reproduce with this hunk:
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -3139,10 +3139,10 @@ void hci_unregister_dev(struct hci_dev *hdev)
> list_del(&hdev->list);
> write_unlock(&hci_dev_list_lock);
>
> - hci_dev_do_close(hdev);
> -
> cancel_work_sync(&hdev->power_on);
>
> + hci_dev_do_close(hdev);
> +
> if (!test_bit(HCI_INIT, &hdev->flags) &&
> !hci_dev_test_flag(hdev, HCI_SETUP) &&
> !hci_dev_test_flag(hdev, HCI_CONFIG)) {
>
>
>
> I cannot explain why though. I do not see how it matters in this
> particular case...
>
> Dmitry, could you apply it too? But I don't know how often you see the
> warning.
I've seen it only several times in several months, so I don't it will
be helpful.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web