From: Tejun Heo <tj@kernel.org>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Jiri Slaby <jslaby@suse.cz>,
Marcel Holtmann <marcel@holtmann.org>,
Gustavo Padovan <gustavo@padovan.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
linux-bluetooth@vger.kernel.org, netdev <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
syzkaller <syzkaller@googlegroups.com>,
Kostya Serebryany <kcc@google.com>,
Alexander Potapenko <glider@google.com>,
Sasha Levin <sasha.levin@oracle.com>,
Eric Dumazet <edumazet@google.com>, Takashi Iwai <tiwai@suse.com>
Subject: Re: net/bluetooth: workqueue destruction WARNING in hci_unregister_dev
Date: Thu, 18 Feb 2016 12:44:27 -0500 [thread overview]
Message-ID: <20160218174427.GG13177@mtj.duckdns.org> (raw)
In-Reply-To: <CACT4Y+bVXfY=wBZ+08rq16tHFw9s3YDrE_LCS=to-GF70AffRQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 339 bytes --]
Hello,
Can you please do the followings?
1. Remove WQ_MEM_RECLAIM from the affected workqueue and see whether
the problem is reproducible. WQ_MEM_RECLAIM on anything bluetooth
doesn't make sense btw. Why is it there?
2. If WQ_MEM_RECLAIM makes the issue go away, see whether the attached
patch works too.
Thanks.
--
tejun
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1183 bytes --]
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 7ff5dc7..9824d4f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4012,7 +4012,7 @@ void destroy_workqueue(struct workqueue_struct *wq)
/* drain it before proceeding with destruction */
drain_workqueue(wq);
- /* sanity checks */
+ /* nothing should be in flight */
mutex_lock(&wq->mutex);
for_each_pwq(pwq, wq) {
int i;
@@ -4024,8 +4024,7 @@ void destroy_workqueue(struct workqueue_struct *wq)
}
}
- if (WARN_ON((pwq != wq->dfl_pwq) && (pwq->refcnt > 1)) ||
- WARN_ON(pwq->nr_active) ||
+ if (WARN_ON(pwq->nr_active) ||
WARN_ON(!list_empty(&pwq->delayed_works))) {
mutex_unlock(&wq->mutex);
return;
@@ -4046,6 +4045,13 @@ void destroy_workqueue(struct workqueue_struct *wq)
if (wq->rescuer)
kthread_stop(wq->rescuer->task);
+ /* rescuer is gone, everything should be quiescent now */
+ WARN_ON(!list_empty(&wq->maydays));
+ mutex_lock(&wq->mutex);
+ for_each_pwq(pwq, wq)
+ WARN_ON((pwq != wq->dfl_pwq) && (pwq->refcnt > 1));
+ mutex_unlock(&wq->mutex);
+
if (!(wq->flags & WQ_UNBOUND)) {
/*
* The base ref is never dropped on per-cpu pwqs. Directly
next prev parent reply other threads:[~2016-02-18 17:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-26 11:53 net/bluetooth: workqueue destruction WARNING in hci_unregister_dev Dmitry Vyukov
2016-01-26 12:29 ` Dmitry Vyukov
2016-02-18 14:00 ` Jiri Slaby
2016-02-18 14:22 ` Dmitry Vyukov
2016-02-18 17:44 ` Tejun Heo [this message]
[not found] ` <20160218174427.GG13177-qYNAdHglDFBN0TnZuCh8vA@public.gmane.org>
2016-02-19 10:20 ` Jiri Slaby
2016-02-19 12:10 ` Jiri Slaby
2016-03-02 15:45 ` Tejun Heo
[not found] ` <20160302154507.GC4282-qYNAdHglDFBN0TnZuCh8vA@public.gmane.org>
2016-03-03 9:12 ` Jiri Slaby
2016-03-11 17:12 ` Tejun Heo
[not found] ` <20160311171205.GB24046-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2016-03-17 12:00 ` Jiri Slaby
[not found] ` <56EA9C4D.2080803-AlSwsSmVLrQ@public.gmane.org>
2016-03-18 20:52 ` Tejun Heo
2016-03-21 15:58 ` Jiri Slaby
[not found] ` <56F01A1C.40208-AlSwsSmVLrQ@public.gmane.org>
2016-03-22 8:09 ` Jiri Slaby
[not found] ` <56F0FDCE.1040701-AlSwsSmVLrQ@public.gmane.org>
2016-03-22 12:32 ` Dmitry Vyukov
2016-09-03 10:58 ` Dmitry Vyukov
2016-09-05 13:08 ` Tejun Heo
2016-09-05 13:14 ` Dmitry Vyukov
2016-09-10 9:33 ` Dmitry Vyukov
2016-09-13 15:35 ` Tejun Heo
[not found] ` <20160913153520.GC21123-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2016-09-13 18:14 ` Jiri Slaby
2016-09-16 20:24 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160218174427.GG13177@mtj.duckdns.org \
--to=tj@kernel.org \
--cc=davem@davemloft.net \
--cc=dvyukov@google.com \
--cc=edumazet@google.com \
--cc=glider@google.com \
--cc=gustavo@padovan.org \
--cc=johan.hedberg@gmail.com \
--cc=jslaby@suse.cz \
--cc=kcc@google.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=netdev@vger.kernel.org \
--cc=sasha.levin@oracle.com \
--cc=syzkaller@googlegroups.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).