input/psmouse: Don't hold the mutex while calling ->disconnect
PATCH 1/1 input/psmouse: Don't hold the mutex while calling ->disconnect
At least trackpoint_disconnect wants to remove some sysfs files, and we can't remove sysfs files while holding psmouse_mutex:
======================================================
WARNING: possible circular locking dependency detected
4.16.0-rc5-g613eb885b69e-drmtip_1+ #1 Tainted: G U
------------------------------------------------------
kworker/0:3/102 is trying to acquire lock:
(kn->count#130){++++}, at: [<000000009679748b>] kernfs_remove_by_name_ns+0x3b/0x80
but task is already holding lock:
(psmouse_mutex){+.+.}, at: [<0000000014f44bcc>] psmouse_disconnect+0x62/0x160
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (psmouse_mutex){+.+.}:
psmouse_attr_set_helper+0x28/0x140
kernfs_fop_write+0xfe/0x180
__vfs_write+0x1e/0x130
vfs_write+0xbd/0x1b0
SyS_write+0x40/0xa0
do_syscall_64+0x65/0x1a0
entry_SYSCALL_64_after_hwframe+0x42/0xb7-> #0 (kn->count#130){++++}:
__kernfs_remove+0x243/0x2b0
kernfs_remove_by_name_ns+0x3b/0x80
remove_files.isra.0+0x2b/0x60
sysfs_remove_group+0x38/0x80
sysfs_remove_groups+0x24/0x40
trackpoint_disconnect+0x2c/0x50
psmouse_disconnect+0x8f/0x160
serio_disconnect_driver+0x28/0x40
serio_driver_remove+0xc/0x10
device_release_driver_internal+0x15b/0x230
serio_handle_event+0x1c8/0x260
process_one_work+0x215/0x620
worker_thread+0x48/0x3a0
kthread+0xfb/0x130
ret_from_fork+0x3a/0x50other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(psmouse_mutex);
lock(kn->count#130);
lock(psmouse_mutex); lock(kn->count#130);
*** DEADLOCK ***
6 locks held by kworker/0:3/102:
#0: ((wq_completion)"events_long"){+.+.}, at: [<000000002e408bfa>] process_one_work+0x191/0x620
#1: (serio_event_work){+.+.}, at: [<000000002e408bfa>] process_one_work+0x191/0x620
#2: (serio_mutex){+.+.}, at: [<00000000c8a49847>] serio_handle_event+0x23/0x260
#3: (&dev->mutex){....}, at: [<00000000b55eee75>] device_release_driver_internal+0x2f/0x230
#4: (&serio->drv_mutex){+.+.}, at: [<000000009719f997>] serio_disconnect_driver+0x16/0x40
#5: (psmouse_mutex){+.+.}, at: [<0000000014f44bcc>] psmouse_disconnect+0x62/0x160stack backtrace: CPU: 0 PID: 102 Comm: kworker/0:3 Tainted: G U 4.16.0-rc5-g613eb885b69e-drmtip_1+ #1 Hardware name: LENOVO 74591P0/74591P0, BIOS 6DET28WW (1.05 ) 07/30/2008 Workqueue: events_long serio_handle_event Call Trace: dump_stack+0x5f/0x86 print_circular_bug.isra.18+0x1d0/0x2c0 __lock_acquire+0x14ae/0x1b60 ? kernfs_remove_by_name_ns+0x20/0x80 ? lock_acquire+0xaf/0x200 lock_acquire+0xaf/0x200 ? kernfs_remove_by_name_ns+0x3b/0x80 __kernfs_remove+0x243/0x2b0 ? kernfs_remove_by_name_ns+0x3b/0x80 ? kernfs_name_hash+0xd/0x70 ? kernfs_find_ns+0x7e/0x100 kernfs_remove_by_name_ns+0x3b/0x80 remove_files.isra.0+0x2b/0x60 sysfs_remove_group+0x38/0x80 sysfs_remove_groups+0x24/0x40 trackpoint_disconnect+0x2c/0x50 psmouse_disconnect+0x8f/0x160 serio_disconnect_driver+0x28/0x40 serio_driver_remove+0xc/0x10 device_release_driver_internal+0x15b/0x230 serio_handle_event+0x1c8/0x260 process_one_work+0x215/0x620 worker_thread+0x48/0x3a0 ? _raw_spin_unlock_irqrestore+0x4c/0x60 kthread+0xfb/0x130 ? process_one_work+0x620/0x620 ? _kthread_create_on_node+0x30/0x30 ret_from_fork+0x3a/0x50
--- drivers/input/mouse/psmouse-base.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/input/mouse/psmouse-base.c +2 -0
@@ -1467,8 +1467,10 @@ static void psmouse_disconnect(struct serio *serio)psmouse_deactivate (parent); } +mutex_unlock (&psmouse_mutex);if (psmouse->disconnect) psmouse->disconnect (psmouse); +mutex_lock (&psmouse_mutex);if (parent && parent->pt_deactivate) parent->pt_deactivate (parent);
Signature · 6 lines
2.16.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for input/psmouse: Don't hold the mutex while calling ->disconnect
== Series Details ==
== Series Details ==
Series: input/psmouse: Don't hold the mutex while calling ->disconnect
URL : https://patchwork.freedesktop.org/series/40259/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip
cc6c0846e22c input/psmouse: Don't hold the mutex while calling ->disconnect
-:18: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#18:
(psmouse_mutex){+.+.}, at: [<0000000014f44bcc>] psmouse_disconnect+0x62/0x160total: 0 errors, 1 warnings, 0 checks, 10 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for input/psmouse: Don't hold the mutex while calling ->disconnect
In reply to Daniel Vetter== Series Details ==
== Series Details ==
Series: input/psmouse: Don't hold the mutex while calling ->disconnect
URL : https://patchwork.freedesktop.org/series/40259/
State : success
== Summary ==
Series 40259v1 input/psmouse: Don't hold the mutex while calling ->disconnect
https://patchwork.freedesktop.org/api/1.0/series/40259/revisions/1/mbox/
---- Known issues:
Test gem_exec_suspend:
Subgroup basic-s3:
pass -> INCOMPLETE (fi-skl-6600u) fdo#104108
Test kms_flip:
Subgroup basic-flip-vs-modeset:
pass -> DMESG-WARN (fi-elk-e7500) fdo#103989 +1
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
incomplete -> PASS (fi-snb-2520m) fdo#103713fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fi-bdw-5557u total:285 pass:264 dwarn:0 dfail:0 fail:0 skip:21 time:433s fi-bdw-gvtdvm total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:440s fi-blb-e6850 total:285 pass:220 dwarn:1 dfail:0 fail:0 skip:64 time:380s fi-bsw-n3050 total:285 pass:239 dwarn:0 dfail:0 fail:0 skip:46 time:536s fi-bwr-2160 total:285 pass:180 dwarn:0 dfail:0 fail:0 skip:105 time:297s fi-bxt-dsi total:285 pass:255 dwarn:0 dfail:0 fail:0 skip:30 time:515s fi-bxt-j4205 total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:510s fi-byt-j1900 total:285 pass:250 dwarn:0 dfail:0 fail:0 skip:35 time:516s fi-byt-n2820 total:285 pass:246 dwarn:0 dfail:0 fail:0 skip:39 time:502s fi-cfl-8700k total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:407s fi-cfl-s2 total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:573s fi-cfl-u total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:510s fi-cnl-drrs total:285 pass:254 dwarn:3 dfail:0 fail:0 skip:28 time:532s fi-elk-e7500 total:285 pass:223 dwarn:3 dfail:0 fail:0 skip:59 time:511s fi-gdg-551 total:285 pass:176 dwarn:0 dfail:0 fail:1 skip:108 time:316s fi-glk-1 total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:537s fi-hsw-4770 total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:411s fi-ilk-650 total:285 pass:225 dwarn:0 dfail:0 fail:0 skip:60 time:421s fi-ivb-3520m total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:479s fi-ivb-3770 total:285 pass:252 dwarn:0 dfail:0 fail:0 skip:33 time:429s fi-kbl-7500u total:285 pass:260 dwarn:1 dfail:0 fail:0 skip:24 time:475s fi-kbl-7567u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:470s fi-kbl-r total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:510s fi-pnv-d510 total:285 pass:219 dwarn:1 dfail:0 fail:0 skip:65 time:658s fi-skl-6260u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:443s fi-skl-6600u total:108 pass:96 dwarn:0 dfail:0 fail:0 skip:11 fi-skl-6700hq total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:542s fi-skl-6700k2 total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:508s fi-skl-6770hq total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:503s fi-skl-guc total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:430s fi-skl-gvtdvm total:285 pass:262 dwarn:0 dfail:0 fail:0 skip:23 time:444s fi-snb-2520m total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:575s fi-snb-2600 total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:402s
141def2a45f4a3ad7c7e9144cd26e97bb1298397 drm-tip: 2018y-03m-19d-23h-48m-43s UTC integration manifest cc6c0846e22c input/psmouse: Don't hold the mutex while calling ->disconnect
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8411/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for input/psmouse: Don't hold the mutex while calling ->disconnect
In reply to Daniel Vetter== Series Details ==
== Series Details ==
Series: input/psmouse: Don't hold the mutex while calling ->disconnect
URL : https://patchwork.freedesktop.org/series/40259/
State : success
== Summary ==
---- Known issues:
Test gem_softpin:
Subgroup noreloc-s3:
dmesg-warn -> PASS (shard-snb) fdo#103375
Test kms_cursor_legacy:
Subgroup 2x-long-flip-vs-cursor-legacy:
incomplete -> PASS (shard-hsw) fdo#104873
Test kms_flip:
Subgroup dpms-vs-vblank-race:
fail -> PASS (shard-hsw) fdo#103060
Subgroup flip-vs-absolute-wf_vblank:
fail -> PASS (shard-hsw) fdo#100368
Test kms_flip_tiling:
Subgroup flip-x-tiled:
fail -> PASS (shard-apl) fdo#103822
Test kms_plane:
Subgroup plane-position-hole-pipe-c-planes:
fail -> PASS (shard-apl) fdo#103166
Test kms_rotation_crc:
Subgroup sprite-rotation-270:
pass -> FAIL (shard-apl) fdo#103356fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#104873 https://bugs.freedesktop.org/show_bug.cgi?id=104873
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103822 https://bugs.freedesktop.org/show_bug.cgi?id=103822
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103356 https://bugs.freedesktop.org/show_bug.cgi?id=103356
shard-apl total:3478 pass:1813 dwarn:1 dfail:0 fail:8 skip:1655 time:12951s shard-hsw total:3478 pass:1768 dwarn:1 dfail:0 fail:1 skip:1707 time:11762s shard-snb total:3478 pass:1356 dwarn:1 dfail:0 fail:2 skip:2119 time:7086s
Blacklisted hosts:
shard-kbl total:3478 pass:1931 dwarn:9 dfail:0 fail:10 skip:1528 time:9837s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8411/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ping.
-Daniel
Quoted 125 lines · Daniel Vetter
At least
trackpoint_disconnectwants to remove some sysfs files, and we can't remove sysfs files while holdingpsmouse_mutex:======================================================
WARNING: possible circular locking dependency detected
4.16.0-rc5-g613eb885b69e-drmtip_1+ #1 Tainted: G U
------------------------------------------------------
kworker/0:3/102 is trying to acquire lock:
(kn->count#130){++++}, at: [<000000009679748b>]kernfs_remove_by_name_ns+0x3b/0x80but task is already holding lock:
(psmouse_mutex){+.+.}, at: [<0000000014f44bcc>]psmouse_disconnect+0x62/0x160which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (psmouse_mutex){+.+.}:
psmouse_attr_set_helper+0x28/0x140 kernfs_fop_write+0xfe/0x180 __vfs_write+0x1e/0x130 vfs_write+0xbd/0x1b0 SyS_write+0x40/0xa0 do_syscall_64+0x65/0x1a0 entry_SYSCALL_64_after_hwframe+0x42/0xb7-> #0 (kn->count#130){++++}:
__kernfs_remove+0x243/0x2b0 kernfs_remove_by_name_ns+0x3b/0x80 remove_files.isra.0+0x2b/0x60 sysfs_remove_group+0x38/0x80 sysfs_remove_groups+0x24/0x40 trackpoint_disconnect+0x2c/0x50 psmouse_disconnect+0x8f/0x160 serio_disconnect_driver+0x28/0x40 serio_driver_remove+0xc/0x10 device_release_driver_internal+0x15b/0x230 serio_handle_event+0x1c8/0x260 process_one_work+0x215/0x620 worker_thread+0x48/0x3a0 kthread+0xfb/0x130 ret_from_fork+0x3a/0x50other info that might help us debug this:
Possible unsafe locking scenario:CPU0 CPU1 ---- ---- lock(psmouse_mutex); lock(kn->count#130); lock(psmouse_mutex);
lock(kn->count#130);*** DEADLOCK ***
6 locks held by kworker/0:3/102:
#0: ((wq_completion)"events_long"){+.+.}, at: [<000000002e408bfa>] process_one_work+0x191/0x620 #1: (serio_event_work){+.+.}, at: [<000000002e408bfa>] process_one_work+0x191/0x620 #2: (serio_mutex){+.+.}, at: [<00000000c8a49847>] serio_handle_event+0x23/0x260 #3: (&dev->mutex){....}, at: [<00000000b55eee75>] device_release_driver_internal+0x2f/0x230 #4: (&serio->drv_mutex){+.+.}, at: [<000000009719f997>] serio_disconnect_driver+0x16/0x40 #5: (psmouse_mutex){+.+.}, at: [<0000000014f44bcc>] psmouse_disconnect+0x62/0x160stack backtrace: CPU: 0 PID: 102 Comm: kworker/0:3 Tainted: G U 4.16.0-rc5-g613eb885b69e-drmtip_1+ #1 Hardware name: LENOVO 74591P0/74591P0, BIOS 6DET28WW (1.05 ) 07/30/2008 Workqueue: events_long serio_handle_event Call Trace: dump_stack+0x5f/0x86 print_circular_bug.isra.18+0x1d0/0x2c0 __lock_acquire+0x14ae/0x1b60 ? kernfs_remove_by_name_ns+0x20/0x80 ? lock_acquire+0xaf/0x200 lock_acquire+0xaf/0x200 ? kernfs_remove_by_name_ns+0x3b/0x80 __kernfs_remove+0x243/0x2b0 ? kernfs_remove_by_name_ns+0x3b/0x80 ? kernfs_name_hash+0xd/0x70 ? kernfs_find_ns+0x7e/0x100 kernfs_remove_by_name_ns+0x3b/0x80 remove_files.isra.0+0x2b/0x60 sysfs_remove_group+0x38/0x80 sysfs_remove_groups+0x24/0x40 trackpoint_disconnect+0x2c/0x50 psmouse_disconnect+0x8f/0x160 serio_disconnect_driver+0x28/0x40 serio_driver_remove+0xc/0x10 device_release_driver_internal+0x15b/0x230 serio_handle_event+0x1c8/0x260 process_one_work+0x215/0x620 worker_thread+0x48/0x3a0 ? _raw_spin_unlock_irqrestore+0x4c/0x60 kthread+0xfb/0x130 ? process_one_work+0x620/0x620 ? _kthread_create_on_node+0x30/0x30 ret_from_fork+0x3a/0x50Signed-off-by Daniel Vetter <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Benjamin Tissoires <[email protected]>Cc Daniel Vetter <[email protected]>Cc Arvind Yadav <[email protected]>--- drivers/input/mouse/psmouse-base.c | 2 ++ 1 file changed, 2 insertions(+)drivers/input/mouse/psmouse-base.c +2
-1@@ -1467,8 +1467,10 @@ static void psmouse_disconnect(struct serio *serio)psmouse_deactivate (parent); } +mutex_unlock (&psmouse_mutex);if (psmouse->disconnect) psmouse->disconnect (psmouse); +mutex_lock (&psmouse_mutex);if (parent && parent->pt_deactivate) parent->pt_deactivate (parent); --2.16.2
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx