From da4b6c5e39b0a2d705bc158573c3841dab0e9496 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 15 Feb 2016 10:11:47 -0800 Subject: [PATCH] 4.4-stable patches added patches: hid-multitouch-fix-input-mode-switching-on-some-elan-panels.patch mm-vmstat-fix-wrong-wq-sleep-when-memory-reclaim-doesn-t-make-any-progress.patch --- ...t-mode-switching-on-some-elan-panels.patch | 95 +++++++++++++++++++ ...ry-reclaim-doesn-t-make-any-progress.patch | 52 ++++++++++ queue-4.4/series | 2 + 3 files changed, 149 insertions(+) create mode 100644 queue-4.4/hid-multitouch-fix-input-mode-switching-on-some-elan-panels.patch create mode 100644 queue-4.4/mm-vmstat-fix-wrong-wq-sleep-when-memory-reclaim-doesn-t-make-any-progress.patch diff --git a/queue-4.4/hid-multitouch-fix-input-mode-switching-on-some-elan-panels.patch b/queue-4.4/hid-multitouch-fix-input-mode-switching-on-some-elan-panels.patch new file mode 100644 index 00000000000..462aefe7932 --- /dev/null +++ b/queue-4.4/hid-multitouch-fix-input-mode-switching-on-some-elan-panels.patch @@ -0,0 +1,95 @@ +From 73e7d63efb4d774883a338997943bfa59e127085 Mon Sep 17 00:00:00 2001 +From: Benjamin Tissoires +Date: Tue, 1 Dec 2015 12:41:38 +0100 +Subject: HID: multitouch: fix input mode switching on some Elan panels + +From: Benjamin Tissoires + +commit 73e7d63efb4d774883a338997943bfa59e127085 upstream. + +as reported by https://bugzilla.kernel.org/show_bug.cgi?id=108481 + +This bug reports mentions 6d4f5440 ("HID: multitouch: Fetch feature +reports on demand for Win8 devices") as the origin of the problem but this +commit actually masked 2 firmware bugs that are annihilating each other: + +The report descriptor declares two features in reports 3 and 5: + +0x05, 0x0d, // Usage Page (Digitizers) 318 +0x09, 0x0e, // Usage (Device Configuration) 320 +0xa1, 0x01, // Collection (Application) 322 +0x85, 0x03, // Report ID (3) 324 +0x09, 0x22, // Usage (Finger) 326 +0xa1, 0x00, // Collection (Physical) 328 +0x09, 0x52, // Usage (Inputmode) 330 +0x15, 0x00, // Logical Minimum (0) 332 +0x25, 0x0a, // Logical Maximum (10) 334 +0x75, 0x08, // Report Size (8) 336 +0x95, 0x02, // Report Count (2) 338 +0xb1, 0x02, // Feature (Data,Var,Abs) 340 +0xc0, // End Collection 342 +0x09, 0x22, // Usage (Finger) 343 +0xa1, 0x00, // Collection (Physical) 345 +0x85, 0x05, // Report ID (5) 347 +0x09, 0x57, // Usage (Surface Switch) 349 +0x09, 0x58, // Usage (Button Switch) 351 +0x15, 0x00, // Logical Minimum (0) 353 +0x75, 0x01, // Report Size (1) 355 +0x95, 0x02, // Report Count (2) 357 +0x25, 0x03, // Logical Maximum (3) 359 +0xb1, 0x02, // Feature (Data,Var,Abs) 361 +0x95, 0x0e, // Report Count (14) 363 +0xb1, 0x03, // Feature (Cnst,Var,Abs) 365 +0xc0, // End Collection 367 + +The report ID 3 presents 2 input mode features, while only the first one +is handled by the device. Given that we did not checked if one was +previously assigned, we were dealing with the ignored featured and we +should never have been able to switch this panel into the multitouch mode. + +However, the firmware presents an other bugs which allowed 6d4f5440 +to counteract the faulty report descriptor. When we request the values +of the feature 5, the firmware answers "03 03 00". The fields are correct +but the report id is wrong. Before 6d4f5440, we retrieved all the features +and injected them in the system. So when we called report 5, we injected +in the system the report 3 with the values "03 00". +Setting the second input mode to 03 in this report changed it to "03 03" +and the touchpad switched to the mt mode. We could have set anything +in the second field because the actual value (the first 03 in this report) +was given by the query of report ID 5. + +To sum up: 2 bugs in the firmware were hiding that we were accessing the +wrong feature. + +Signed-off-by: Benjamin Tissoires +Signed-off-by: Jiri Kosina +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hid/hid-multitouch.c | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +--- a/drivers/hid/hid-multitouch.c ++++ b/drivers/hid/hid-multitouch.c +@@ -357,8 +357,19 @@ static void mt_feature_mapping(struct hi + break; + } + +- td->inputmode = field->report->id; +- td->inputmode_index = usage->usage_index; ++ if (td->inputmode < 0) { ++ td->inputmode = field->report->id; ++ td->inputmode_index = usage->usage_index; ++ } else { ++ /* ++ * Some elan panels wrongly declare 2 input mode ++ * features, and silently ignore when we set the ++ * value in the second field. Skip the second feature ++ * and hope for the best. ++ */ ++ dev_info(&hdev->dev, ++ "Ignoring the extra HID_DG_INPUTMODE\n"); ++ } + + break; + case HID_DG_CONTACTMAX: diff --git a/queue-4.4/mm-vmstat-fix-wrong-wq-sleep-when-memory-reclaim-doesn-t-make-any-progress.patch b/queue-4.4/mm-vmstat-fix-wrong-wq-sleep-when-memory-reclaim-doesn-t-make-any-progress.patch new file mode 100644 index 00000000000..94adfe4b20e --- /dev/null +++ b/queue-4.4/mm-vmstat-fix-wrong-wq-sleep-when-memory-reclaim-doesn-t-make-any-progress.patch @@ -0,0 +1,52 @@ +From 564e81a57f9788b1475127012e0fd44e9049e342 Mon Sep 17 00:00:00 2001 +From: Tetsuo Handa +Date: Fri, 5 Feb 2016 15:36:30 -0800 +Subject: mm, vmstat: fix wrong WQ sleep when memory reclaim doesn't make any progress + +From: Tetsuo Handa + +commit 564e81a57f9788b1475127012e0fd44e9049e342 upstream. + +Jan Stancek has reported that system occasionally hanging after "oom01" +testcase from LTP triggers OOM. Guessing from a result that there is a +kworker thread doing memory allocation and the values between "Node 0 +Normal free:" and "Node 0 Normal:" differs when hanging, vmstat is not +up-to-date for some reason. + +According to commit 373ccbe59270 ("mm, vmstat: allow WQ concurrency to +discover memory reclaim doesn't make any progress"), it meant to force +the kworker thread to take a short sleep, but it by error used +schedule_timeout(1). We missed that schedule_timeout() in state +TASK_RUNNING doesn't do anything. + +Fix it by using schedule_timeout_uninterruptible(1) which forces the +kworker thread to take a short sleep in order to make sure that vmstat +is up-to-date. + +Fixes: 373ccbe59270 ("mm, vmstat: allow WQ concurrency to discover memory reclaim doesn't make any progress") +Signed-off-by: Tetsuo Handa +Reported-by: Jan Stancek +Acked-by: Michal Hocko +Cc: Tejun Heo +Cc: Cristopher Lameter +Cc: Joonsoo Kim +Cc: Arkadiusz Miskiewicz +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/backing-dev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/mm/backing-dev.c ++++ b/mm/backing-dev.c +@@ -989,7 +989,7 @@ long wait_iff_congested(struct zone *zon + * here rather than calling cond_resched(). + */ + if (current->flags & PF_WQ_WORKER) +- schedule_timeout(1); ++ schedule_timeout_uninterruptible(1); + else + cond_resched(); + diff --git a/queue-4.4/series b/queue-4.4/series index b474adcc05e..292e936f41f 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -115,3 +115,5 @@ zram-zcomp-use-gfp_noio-to-allocate-streams.patch zram-try-vmalloc-after-kmalloc.patch zram-don-t-call-idr_remove-from-zram_remove.patch zsmalloc-fix-migrate_zspage-zs_free-race-condition.patch +mm-vmstat-fix-wrong-wq-sleep-when-memory-reclaim-doesn-t-make-any-progress.patch +hid-multitouch-fix-input-mode-switching-on-some-elan-panels.patch -- 2.47.3