* [PATCH] HID: wacom: Fix deadlock on proximity in events with the Intuos Draw
@ 2015-12-30 17:08 Lyude
[not found] ` <CANRwn3SFCvZ+6EQ1D5az41oXfEXYKdPic2E+rzCpcZ4oo6X4UQ@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Lyude @ 2015-12-30 17:08 UTC (permalink / raw)
To: Jiri Kosina, linux-input, linux-kernel, Jason Gerecke, Ping Cheng; +Cc: Lyude
Unfortunately, when we have an Intuos Draw connected using a USB
connection, wacom's IRQ handler will be called while the lock for the
usbhid driver is held by hid_ctrl. This means when we try to schedule a
new proximity event in wacom_intuos_schedule_prox_event() by calling
hid_hw_request(), we'll try to take the lock a second time which
deadlocks the system. This patch fixes that behavior by initializing a
worker when we have a INTUOSHT2 device connected, and using that worker
to schedule the proximity event instead.
Signed-off-by: Lyude <cpaul@redhat.com>
---
drivers/hid/wacom_wac.c | 9 +++++++--
drivers/hid/wacom_wac.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 01a4f05..b59ded6 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -433,8 +433,10 @@ exit:
return retval;
}
-static void wacom_intuos_schedule_prox_event(struct wacom_wac *wacom_wac)
+static void wacom_intuos_schedule_prox_event(struct work_struct *work)
{
+ struct wacom_wac *wacom_wac =
+ container_of(work, struct wacom_wac, intuos_prox_event_worker);
struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac);
struct hid_report *r;
struct hid_report_enum *re;
@@ -624,7 +626,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
/* don't report other events if we don't know the ID */
if (!wacom->id[idx]) {
/* but reschedule a read of the current tool */
- wacom_intuos_schedule_prox_event(wacom);
+ schedule_work(&wacom->intuos_prox_event_worker);
return 1;
}
@@ -2675,6 +2677,9 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
if (features->type == INTUOSHT2) {
wacom_setup_basic_pro_pen(wacom_wac);
+
+ INIT_WORK(&wacom_wac->intuos_prox_event_worker,
+ wacom_intuos_schedule_prox_event);
} else {
__clear_bit(ABS_MISC, input_dev->absbit);
__set_bit(BTN_TOOL_PEN, input_dev->keybit);
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index 877c24a..c24cfdc 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -237,6 +237,7 @@ struct wacom_wac {
int ps_connected;
u8 bt_features;
u8 bt_high_speed;
+ struct work_struct intuos_prox_event_worker;
struct hid_data hid_data;
};
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <CANRwn3SFCvZ+6EQ1D5az41oXfEXYKdPic2E+rzCpcZ4oo6X4UQ@mail.gmail.com>]
* Re: [PATCH] HID: wacom: Fix deadlock on proximity in events with the Intuos Draw [not found] ` <CANRwn3SFCvZ+6EQ1D5az41oXfEXYKdPic2E+rzCpcZ4oo6X4UQ@mail.gmail.com> @ 2016-01-04 15:33 ` Lyude 0 siblings, 0 replies; 3+ messages in thread From: Lyude @ 2016-01-04 15:33 UTC (permalink / raw) To: Jason Gerecke; +Cc: Linux Input, Jiri Kosina, Ping Cheng, linux-kernel Yep! That's definitely the same as this one. Glad to hear it still was useful even if it's obsolete :). On Wed, 2015-12-30 at 12:39 -0800, Jason Gerecke wrote: > Is this a fix for the same bug addressed in http://linux.kernel.narkive.com/zU > Iw13xt/patch-hid-usbhid-hid-core-fix-recursive-deadlock > I think Ping was going to work on something similar to this for the "input- > wacom" backports (since we can't rely on a fixed hid_ctrl being present) after > returning from vacation, but if you've already written it... :) > On Dec 30, 2015 9:08 AM, "Lyude" <cpaul@redhat.com> wrote: > > Unfortunately, when we have an Intuos Draw connected using a USB > > connection, wacom's IRQ handler will be called while the lock for the > > usbhid driver is held by hid_ctrl. This means when we try to schedule a > > new proximity event in wacom_intuos_schedule_prox_event() by calling > > hid_hw_request(), we'll try to take the lock a second time which > > deadlocks the system. This patch fixes that behavior by initializing a > > worker when we have a INTUOSHT2 device connected, and using that worker > > to schedule the proximity event instead. > > > > Signed-off-by: Lyude <cpaul@redhat.com> > > --- > > drivers/hid/wacom_wac.c | 9 +++++++-- > > drivers/hid/wacom_wac.h | 1 + > > 2 files changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c > > index 01a4f05..b59ded6 100644 > > --- a/drivers/hid/wacom_wac.c > > +++ b/drivers/hid/wacom_wac.c > > @@ -433,8 +433,10 @@ exit: > > return retval; > > } > > > > -static void wacom_intuos_schedule_prox_event(struct wacom_wac *wacom_wac) > > +static void wacom_intuos_schedule_prox_event(struct work_struct *work) > > { > > + struct wacom_wac *wacom_wac = > > + container_of(work, struct wacom_wac, > > intuos_prox_event_worker); > > struct wacom *wacom = container_of(wacom_wac, struct wacom, > > wacom_wac); > > struct hid_report *r; > > struct hid_report_enum *re; > > @@ -624,7 +626,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) > > /* don't report other events if we don't know the ID */ > > if (!wacom->id[idx]) { > > /* but reschedule a read of the current tool */ > > - wacom_intuos_schedule_prox_event(wacom); > > + schedule_work(&wacom->intuos_prox_event_worker); > > return 1; > > } > > > > @@ -2675,6 +2677,9 @@ int wacom_setup_pen_input_capabilities(struct > > input_dev *input_dev, > > > > if (features->type == INTUOSHT2) { > > wacom_setup_basic_pro_pen(wacom_wac); > > + > > + INIT_WORK(&wacom_wac->intuos_prox_event_worker, > > + wacom_intuos_schedule_prox_event); > > } else { > > __clear_bit(ABS_MISC, input_dev->absbit); > > __set_bit(BTN_TOOL_PEN, input_dev->keybit); > > diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h > > index 877c24a..c24cfdc 100644 > > --- a/drivers/hid/wacom_wac.h > > +++ b/drivers/hid/wacom_wac.h > > @@ -237,6 +237,7 @@ struct wacom_wac { > > int ps_connected; > > u8 bt_features; > > u8 bt_high_speed; > > + struct work_struct intuos_prox_event_worker; > > struct hid_data hid_data; > > }; > > > > -- > > 2.5.0 > > > > -- Cheers, Lyude -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: wacom: Fix deadlock on proximity in events with the Intuos Draw @ 2016-01-04 15:33 ` Lyude 0 siblings, 0 replies; 3+ messages in thread From: Lyude @ 2016-01-04 15:33 UTC (permalink / raw) To: Jason Gerecke; +Cc: Linux Input, Jiri Kosina, Ping Cheng, linux-kernel Yep! That's definitely the same as this one. Glad to hear it still was useful even if it's obsolete :). On Wed, 2015-12-30 at 12:39 -0800, Jason Gerecke wrote: > Is this a fix for the same bug addressed in http://linux.kernel.narkive.com/zU > Iw13xt/patch-hid-usbhid-hid-core-fix-recursive-deadlock > I think Ping was going to work on something similar to this for the "input- > wacom" backports (since we can't rely on a fixed hid_ctrl being present) after > returning from vacation, but if you've already written it... :) > On Dec 30, 2015 9:08 AM, "Lyude" <cpaul@redhat.com> wrote: > > Unfortunately, when we have an Intuos Draw connected using a USB > > connection, wacom's IRQ handler will be called while the lock for the > > usbhid driver is held by hid_ctrl. This means when we try to schedule a > > new proximity event in wacom_intuos_schedule_prox_event() by calling > > hid_hw_request(), we'll try to take the lock a second time which > > deadlocks the system. This patch fixes that behavior by initializing a > > worker when we have a INTUOSHT2 device connected, and using that worker > > to schedule the proximity event instead. > > > > Signed-off-by: Lyude <cpaul@redhat.com> > > --- > > drivers/hid/wacom_wac.c | 9 +++++++-- > > drivers/hid/wacom_wac.h | 1 + > > 2 files changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c > > index 01a4f05..b59ded6 100644 > > --- a/drivers/hid/wacom_wac.c > > +++ b/drivers/hid/wacom_wac.c > > @@ -433,8 +433,10 @@ exit: > > return retval; > > } > > > > -static void wacom_intuos_schedule_prox_event(struct wacom_wac *wacom_wac) > > +static void wacom_intuos_schedule_prox_event(struct work_struct *work) > > { > > + struct wacom_wac *wacom_wac = > > + container_of(work, struct wacom_wac, > > intuos_prox_event_worker); > > struct wacom *wacom = container_of(wacom_wac, struct wacom, > > wacom_wac); > > struct hid_report *r; > > struct hid_report_enum *re; > > @@ -624,7 +626,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) > > /* don't report other events if we don't know the ID */ > > if (!wacom->id[idx]) { > > /* but reschedule a read of the current tool */ > > - wacom_intuos_schedule_prox_event(wacom); > > + schedule_work(&wacom->intuos_prox_event_worker); > > return 1; > > } > > > > @@ -2675,6 +2677,9 @@ int wacom_setup_pen_input_capabilities(struct > > input_dev *input_dev, > > > > if (features->type == INTUOSHT2) { > > wacom_setup_basic_pro_pen(wacom_wac); > > + > > + INIT_WORK(&wacom_wac->intuos_prox_event_worker, > > + wacom_intuos_schedule_prox_event); > > } else { > > __clear_bit(ABS_MISC, input_dev->absbit); > > __set_bit(BTN_TOOL_PEN, input_dev->keybit); > > diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h > > index 877c24a..c24cfdc 100644 > > --- a/drivers/hid/wacom_wac.h > > +++ b/drivers/hid/wacom_wac.h > > @@ -237,6 +237,7 @@ struct wacom_wac { > > int ps_connected; > > u8 bt_features; > > u8 bt_high_speed; > > + struct work_struct intuos_prox_event_worker; > > struct hid_data hid_data; > > }; > > > > -- > > 2.5.0 > > > > -- Cheers, Lyude ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-04 15:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-30 17:08 [PATCH] HID: wacom: Fix deadlock on proximity in events with the Intuos Draw Lyude
[not found] ` <CANRwn3SFCvZ+6EQ1D5az41oXfEXYKdPic2E+rzCpcZ4oo6X4UQ@mail.gmail.com>
2016-01-04 15:33 ` Lyude
2016-01-04 15:33 ` Lyude
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.