From: Ioan-Adrian Ratiu <adi@adirat.com>
To: Jiri Kosina <jikos@kernel.org>
Cc: Josh Cartwright <joshc@ni.com>,
pinglinux@gmail.com, linux-usb@vger.kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hid: usbhid: hid-core: fix recursive deadlock
Date: Thu, 19 Nov 2015 18:33:25 +0200 [thread overview]
Message-ID: <20151119183325.265f02af@adipc> (raw)
In-Reply-To: <alpine.LNX.2.00.1511191005240.20111@pobox.suse.cz>
On Thu, 19 Nov 2015 10:10:19 +0100 (CET)
Jiri Kosina <jikos@kernel.org> wrote:
> On Thu, 19 Nov 2015, Ioan-Adrian Ratiu wrote:
>
> > First part of lockdep report:
> > http://imgur.com/clLsCWe
> >
> > Second part:
> > http://imgur.com/Wa2PzRl
> >
> > Here are some printk's of mine while reproducing + debugging the issue:
> > http://imgur.com/SETOHT7
>
> So the real problem is that Intuos driver is calling hid_hw_request()
> (which tries to grab the lock in usbhid_submit_report()) while handling
> the CTRL IRQ (lock gets acquired there).
>
> So the proper way to fix seems to be delaying the scheduling of the
> proximity read event in wacom_intuos_inout() to workqueue.
>
> > I'll continue to research this more in depth, but progress is slow
> > because I don't have much time, I'm doing this in my spare time because
> > it's my girlfriend's tablet.
>
> Oh, now I understand the level of severity of this bug! :-)
>
> Thanks,
>
Yes, exactly, you are beginning to understand! :) When I've put my 2 variants
above to solve this deadlock, by "removing the call from wacom" at 1) I was
trying to say exactly this, removing it from the irq to a workqueue.
But please understand further my reasoning for submitting this patch. Consider
if this is a bug in the wacom driver or in the usbhid core? IMO
this is a usbhid bug: the critical region in hid_ctrl() is too big, there
is no reason for the call to hid_input_report() to be protected by
usbhid->lock.
The correct way to fix this deadlock is to fix the critical section in
usbhid, not remove the call from the wacom irq. If wacom wants to
reschedule in the irq, it should not deadlock on usbhid. "Fixing" the wacom call
would just work around the critical region bug inside usbhid.
I hope I've made myself clear this time; I really needed to explain this
patch better :( sorry.
next prev parent reply other threads:[~2015-11-19 16:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-18 19:25 [PATCH] hid: usbhid: hid-core: fix recursive deadlock Ioan-Adrian Ratiu
2015-11-18 20:37 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1511182137020.20111-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2015-11-18 21:05 ` Ioan-Adrian Ratiu
2015-11-18 23:58 ` Josh Cartwright
2015-11-19 6:47 ` Ioan-Adrian Ratiu
2015-11-19 9:10 ` Jiri Kosina
2015-11-19 16:33 ` Ioan-Adrian Ratiu [this message]
2015-11-19 21:34 ` Jiri Kosina
2015-11-20 20:08 ` Ioan-Adrian Ratiu
2015-11-19 8:56 ` Jiri Kosina
2015-11-20 20:19 ` [PATCH v2] " Ioan-Adrian Ratiu
2015-11-29 10:29 ` Ioan-Adrian Ratiu
2016-01-21 1:28 ` Jason Gerecke
[not found] ` <CANRwn3SU4zsxLAHUh4EP=LsGj1d_0-YV=je-Jfut4VXX3faBZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-01-21 9:36 ` Jiri Kosina
2015-12-01 16:36 ` Jiri Kosina
2015-12-02 0:00 ` Ping Cheng
-- strict thread matches above, loose matches on Subject: below --
2015-11-18 19:46 [PATCH] " Ioan-Adrian Ratiu
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=20151119183325.265f02af@adipc \
--to=adi@adirat.com \
--cc=jikos@kernel.org \
--cc=joshc@ni.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pinglinux@gmail.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).