bisecting fixing commit since c9e6606c7fe92b50a02ce51dda82586ebdf99b48 building syzkaller on 0a2584dd6205f108e11a521809ce61263f98f15c testing commit c9e6606c7fe92b50a02ce51dda82586ebdf99b48 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 747412be719149a06f68dd39e895e4405b77b56b200467f4a0c39e70ac7b8dbf all runs: crashed: possible deadlock in io_poll_double_wake testing current HEAD f1baf68e1383f6ed93eb9cff2866d46562607a43 testing commit f1baf68e1383f6ed93eb9cff2866d46562607a43 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 1eca7d0673d5b2dcc2c635f442daaf6fa404585c028e4fbb759c86c21b02e025 all runs: OK # git bisect start f1baf68e1383f6ed93eb9cff2866d46562607a43 c9e6606c7fe92b50a02ce51dda82586ebdf99b48 Bisecting: 6423 revisions left to test after this (roughly 13 steps) [1dbfae0113f1423b42c304989a3cc8a7dd0ea53e] Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 testing commit 1dbfae0113f1423b42c304989a3cc8a7dd0ea53e compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: e1d14b4fb441eb0b0921820270b9699951c1572a37ddb4824c786102c0b2ccac all runs: crashed: possible deadlock in io_poll_double_wake # git bisect good 1dbfae0113f1423b42c304989a3cc8a7dd0ea53e Bisecting: 3165 revisions left to test after this (roughly 12 steps) [3bad80dab94a16c9b7991105e3bffd5fe5957e9a] Merge tag 'char-misc-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc testing commit 3bad80dab94a16c9b7991105e3bffd5fe5957e9a compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: b287dec887ec61a62dc4f2ba7f4e1f6c6b48e4e1dabc39d4e4c3a1184cf28a84 all runs: OK # git bisect bad 3bad80dab94a16c9b7991105e3bffd5fe5957e9a Bisecting: 1562 revisions left to test after this (roughly 11 steps) [455e73a07f6e288b0061dfcf4fcf54fa9fe06458] Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux testing commit 455e73a07f6e288b0061dfcf4fcf54fa9fe06458 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 886fa6c20feb623569ad79a131f1d8cb964b4663e4ae1eddd20931352ff2220f all runs: OK # git bisect bad 455e73a07f6e288b0061dfcf4fcf54fa9fe06458 Bisecting: 846 revisions left to test after this (roughly 10 steps) [22ef12195e13c5ec58320dbf99ef85059a2c0820] Merge tag 'staging-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging testing commit 22ef12195e13c5ec58320dbf99ef85059a2c0820 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 79b94c7d6b0a736c3c8ea4ec6e369358c46db3acb35fe9331f1d839d6315b5e4 all runs: OK # git bisect bad 22ef12195e13c5ec58320dbf99ef85059a2c0820 Bisecting: 458 revisions left to test after this (roughly 9 steps) [2ab9c9675fe892e7fe9fa8c0a6125e2b40d2889d] Merge tag 'media/v5.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media testing commit 2ab9c9675fe892e7fe9fa8c0a6125e2b40d2889d compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 6168dd9d5e0a9fffc15455033e375e2baffcaec136bf4bdb458ec32768a7a07d all runs: OK # git bisect bad 2ab9c9675fe892e7fe9fa8c0a6125e2b40d2889d Bisecting: 180 revisions left to test after this (roughly 8 steps) [42a7b4ed45e7667836fae4fb0e1ac6340588b1b0] Merge tag 'for-5.17/io_uring-2022-01-11' of git://git.kernel.dk/linux-block testing commit 42a7b4ed45e7667836fae4fb0e1ac6340588b1b0 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 96ea963ee42770941bab0a554072347d33b85cecc01ed18ecb9069a05c1b25d7 all runs: OK # git bisect bad 42a7b4ed45e7667836fae4fb0e1ac6340588b1b0 Bisecting: 96 revisions left to test after this (roughly 7 steps) [c1eb8f6cff3442b0b7eff5b801c9745ea9abcb14] Merge tag 'for-5.17/parisc-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux testing commit c1eb8f6cff3442b0b7eff5b801c9745ea9abcb14 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: d0ec6e084e46cb597d674bff93618b14d4e43fdf9601a7cbdbfc96a6fa0589c1 all runs: crashed: possible deadlock in io_poll_double_wake # git bisect good c1eb8f6cff3442b0b7eff5b801c9745ea9abcb14 Bisecting: 44 revisions left to test after this (roughly 6 steps) [daadb3bd0e8d3e317e36bc2c1542e86c528665e5] Merge tag 'locking_core_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip testing commit daadb3bd0e8d3e317e36bc2c1542e86c528665e5 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: bf82822512234f61701cd21a8b88cf413bf3256e410267d15e03f2120cef9ec6 all runs: crashed: possible deadlock in io_poll_double_wake # git bisect good daadb3bd0e8d3e317e36bc2c1542e86c528665e5 Bisecting: 22 revisions left to test after this (roughly 5 steps) [e840b4baf3cfb37e2ead4f649a45bb78178677ff] io_uring: remove double poll on poll update testing commit e840b4baf3cfb37e2ead4f649a45bb78178677ff compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: ab8b1d8f70d8f28a4f294919a9935b0836f026212a2608062282166fcc999d91 run #0: OK run #1: crashed: possible deadlock in io_poll_double_wake run #2: crashed: possible deadlock in io_poll_double_wake run #3: crashed: possible deadlock in io_poll_double_wake run #4: crashed: possible deadlock in io_poll_double_wake run #5: crashed: possible deadlock in io_poll_double_wake run #6: crashed: possible deadlock in io_poll_double_wake run #7: crashed: possible deadlock in io_poll_double_wake run #8: crashed: possible deadlock in io_poll_double_wake run #9: crashed: possible deadlock in io_poll_double_wake # git bisect good e840b4baf3cfb37e2ead4f649a45bb78178677ff Bisecting: 11 revisions left to test after this (roughly 4 steps) [28e4576d556bca543b0996e9edd4b767397e24c6] dma-direct: add a dma_direct_use_pool helper testing commit 28e4576d556bca543b0996e9edd4b767397e24c6 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: c2acc24cfb3772ec8f51e1c55348188d5d80ceda487031d307900c05f39416e3 all runs: crashed: possible deadlock in io_poll_double_wake # git bisect good 28e4576d556bca543b0996e9edd4b767397e24c6 Bisecting: 5 revisions left to test after this (roughly 3 steps) [cc8e9ba71a8626bd322d1945a8fc0c8a52131a63] io_uring: use completion batching for poll rem/upd testing commit cc8e9ba71a8626bd322d1945a8fc0c8a52131a63 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: fb8d7e65e7f4e30259e9f192819054f1f114ec307d8cd057f12993bcbd4701d3 all runs: OK # git bisect bad cc8e9ba71a8626bd322d1945a8fc0c8a52131a63 Bisecting: 2 revisions left to test after this (roughly 2 steps) [ab1dab960b8352cee082db0f8a54dc92a948bfd7] io_uring: kill poll linking optimisation testing commit ab1dab960b8352cee082db0f8a54dc92a948bfd7 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 7dac74a13535a21bb7304384347957b43c2f977a41c07f4074ed811841a4e1a2 all runs: crashed: possible deadlock in io_poll_double_wake # git bisect good ab1dab960b8352cee082db0f8a54dc92a948bfd7 Bisecting: 0 revisions left to test after this (roughly 1 step) [eb0089d629ba413ebf820733ad11b4b2bed45514] io_uring: single shot poll removal optimisation testing commit eb0089d629ba413ebf820733ad11b4b2bed45514 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: db4dea20a9d8853e3035c23ea52a68e0bcbceefc53b1ac246b71ddab2a6773c7 all runs: OK # git bisect bad eb0089d629ba413ebf820733ad11b4b2bed45514 Bisecting: 0 revisions left to test after this (roughly 0 steps) [aa43477b040251f451db0d844073ac00a8ab66ee] io_uring: poll rework testing commit aa43477b040251f451db0d844073ac00a8ab66ee compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 2b7dd075c489c4d66a30aceb7493ca9a435ba32c6c36501b314cb763d976f65f all runs: OK # git bisect bad aa43477b040251f451db0d844073ac00a8ab66ee aa43477b040251f451db0d844073ac00a8ab66ee is the first bad commit commit aa43477b040251f451db0d844073ac00a8ab66ee Author: Pavel Begunkov Date: Wed Dec 15 22:08:48 2021 +0000 io_uring: poll rework It's not possible to go forward with the current state of io_uring polling, we need a more straightforward and easier synchronisation. There are a lot of problems with how it is at the moment, including missing events on rewait. The main idea here is to introduce a notion of request ownership while polling, no one but the owner can modify any part but ->poll_refs of struct io_kiocb, that grants us protection against all sorts of races. Main users of such exclusivity are poll task_work handler, so before queueing a tw one should have/acquire ownership, which will be handed off to the tw handler. The other user is __io_arm_poll_handler() do initial poll arming. It starts taking the ownership, so tw handlers won't be run until it's released later in the function after vfs_poll. note: also prevents races in __io_queue_proc(). Poll wake/etc. may not be able to get ownership, then they need to increase the poll refcount and the task_work should notice it and retry if necessary, see io_poll_check_events(). There is also IO_POLL_CANCEL_FLAG flag to notify that we want to kill request. It makes cancellations more reliable, enables double multishot polling, fixes double poll rewait, fixes missing poll events and fixes another bunch of races. Even though it adds some overhead for new refcounting, and there are a couple of nice performance wins: - no req->refs refcounting for poll requests anymore - if the data is already there (once measured for some test to be 1-2% of all apoll requests), it removes it doesn't add atomics and removes spin_lock/unlock pair. - works well with multishots, we don't do remove from queue / add to queue for each new poll event. Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/6b652927c77ed9580ea4330ac5612f0e0848c946.1639605189.git.asml.silence@gmail.com Signed-off-by: Jens Axboe fs/io_uring.c | 526 +++++++++++++++++++++++++--------------------------------- 1 file changed, 227 insertions(+), 299 deletions(-) culprit signature: 2b7dd075c489c4d66a30aceb7493ca9a435ba32c6c36501b314cb763d976f65f parent signature: 7dac74a13535a21bb7304384347957b43c2f977a41c07f4074ed811841a4e1a2 revisions tested: 16, total time: 3h16m40.730603075s (build: 2h7m50.809841725s, test: 1h7m14.455849505s) first good commit: aa43477b040251f451db0d844073ac00a8ab66ee io_uring: poll rework recipients (to): ["asml.silence@gmail.com" "axboe@kernel.dk" "axboe@kernel.dk" "io-uring@vger.kernel.org"] recipients (cc): ["asml.silence@gmail.com" "linux-kernel@vger.kernel.org"]