Hi, On Sun, Dec 29, 2019 at 10:32:30AM +0800, Ming Lei wrote: > There are two issues in get_max_segment_size(): > > 1) the default segment boudary mask is bypassed, and some devices still > require segment to not cross the default 4G boundary > > 2) the segment start address isn't taken into account when checking > segment boundary limit > > Fixes the two issues. > > Fixes: dcebd755926b ("block: use bio_for_each_bvec() to compute multi-page bvec count") > Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> This patch, pushed into mainline as "block: fix splitting segments on boundary masks", results in the following crash when booting 'versatilepb' in qemu from disk. Bisect log is attached. Detailed log is at https://kerneltests.org/builders/qemu-arm-master/builds/1410/steps/qemubuildcommand/logs/stdio Guenter --- Crash: kernel BUG at block/bio.c:1885! Internal error: Oops - BUG: 0 [#1] ARM Modules linked in: CPU: 0 PID: 1 Comm: init Not tainted 5.5.0-rc5 #1 Hardware name: ARM-Versatile (Device Tree Support) PC is at bio_split+0x10c/0x15c LR is at __blk_queue_split+0x378/0x628 ... [<c03b716c>] (bio_split) from [<c03c24c8>] (__blk_queue_split+0x378/0x628) [<c03c24c8>] (__blk_queue_split) from [<c03c82cc>] (blk_mq_make_request+0x6c/0x7e4) [<c03c82cc>] (blk_mq_make_request) from [<c03bc7d0>] (generic_make_request+0xec/0x340) [<c03bc7d0>] (generic_make_request) from [<c03bca70>] (submit_bio+0x4c/0x170) [<c03bca70>] (submit_bio) from [<c020666c>] (ext4_mpage_readpages+0x54c/0x8e0) [<c020666c>] (ext4_mpage_readpages) from [<c01e1ec8>] (ext4_readpages+0x40/0x50) [<c01e1ec8>] (ext4_readpages) from [<c00df808>] (read_pages+0x50/0x13c) [<c00df808>] (read_pages) from [<c00dfd2c>] (__do_page_cache_readahead+0x1a8/0x1f0) [<c00dfd2c>] (__do_page_cache_readahead) from [<c00d500c>] (filemap_fault+0x440/0x8f4) [<c00d500c>] (filemap_fault) from [<c01ed494>] (ext4_filemap_fault+0x28/0x3c) [<c01ed494>] (ext4_filemap_fault) from [<c0100b88>] (__do_fault+0x3c/0x1c0) [<c0100b88>] (__do_fault) from [<c0105360>] (handle_mm_fault+0x284/0xaf4) [<c0105360>] (handle_mm_fault) from [<c001f01c>] (do_page_fault+0x114/0x2e0) [<c001f01c>] (do_page_fault) from [<c001f34c>] (do_DataAbort+0x38/0xbc) [<c001f34c>] (do_DataAbort) from [<c000a0dc>] (__dabt_svc+0x5c/0xa0) Exception stack(0xc783be28 to 0xc783be70) be20: b6f81898 00000760 00000000 00000055 00000051 c0af3068 be40: c71f7a00 c71f7800 b6f51000 c71df320 c7954c80 00000006 00000000 c783be78 be60: c01a099c c07a4bb4 20000153 ffffffff [<c000a0dc>] (__dabt_svc) from [<c07a4bb4>] (__clear_user_std+0x34/0x68) [<c07a4bb4>] (__clear_user_std) from [<c01a099c>] (clear_user+0x40/0x50) [<c01a099c>] (clear_user) from [<c019f204>] (load_elf_binary+0x1354/0x13c4) [<c019f204>] (load_elf_binary) from [<c013996c>] (search_binary_handler.part.4+0x58/0x1fc) [<c013996c>] (search_binary_handler.part.4) from [<c013b18c>] (__do_execve_file+0x780/0x9a4) [<c013b18c>] (__do_execve_file) from [<c013b54c>] (do_execve+0x28/0x30) [<c013b54c>] (do_execve) from [<c000af1c>] (try_to_run_init_process+0xc/0x3c) [<c000af1c>] (try_to_run_init_process) from [<c07c42fc>] (kernel_init+0x88/0xf0) [<c07c42fc>] (kernel_init) from [<c00090b0>] (ret_from_fork+0x14/0x24) ... WARNING: CPU: 0 PID: 1 at kernel/exit.c:719 do_exit+0x54/0xb5c Modules linked in: CPU: 0 PID: 1 Comm: init Tainted: G D 5.5.0-rc5 #1 Hardware name: ARM-Versatile (Device Tree Support) [<c001e8b0>] (unwind_backtrace) from [<c001a774>] (show_stack+0x10/0x14) [<c001a774>] (show_stack) from [<c0027dc4>] (__warn+0xe4/0x108) [<c0027dc4>] (__warn) from [<c0027e90>] (warn_slowpath_fmt+0xa8/0xb8) [<c0027e90>] (warn_slowpath_fmt) from [<c0029dfc>] (do_exit+0x54/0xb5c) [<c0029dfc>] (do_exit) from [<c001a918>] (die+0x1a0/0x274) [<c001a918>] (die) from [<c001abfc>] (do_undefinstr+0xac/0x258) [<c001abfc>] (do_undefinstr) from [<c000a238>] (__und_svc_finish+0x0/0x48) Exception stack(0xc783b950 to 0xc783b998) b940: c7226a80 00000000 00000c00 c7bebe00 b960: 00000000 c783b9e4 00000000 c7226a80 00007000 00000060 c7beb848 c783b9f0 b980: 00000060 c783b9a0 c03c24c8 c03b716c 60000153 ffffffff [<c000a238>] (__und_svc_finish) from [<c03b716c>] (bio_split+0x10c/0x15c) [<c03b716c>] (bio_split) from [<c03c24c8>] (__blk_queue_split+0x378/0x628) [<c03c24c8>] (__blk_queue_split) from [<c03c82cc>] (blk_mq_make_request+0x6c/0x7e4) [<c03c82cc>] (blk_mq_make_request) from [<c03bc7d0>] (generic_make_request+0xec/0x340) [<c03bc7d0>] (generic_make_request) from [<c03bca70>] (submit_bio+0x4c/0x170) [<c03bca70>] (submit_bio) from [<c020666c>] (ext4_mpage_readpages+0x54c/0x8e0) [<c020666c>] (ext4_mpage_readpages) from [<c01e1ec8>] (ext4_readpages+0x40/0x50) [<c01e1ec8>] (ext4_readpages) from [<c00df808>] (read_pages+0x50/0x13c) [<c00df808>] (read_pages) from [<c00dfd2c>] (__do_page_cache_readahead+0x1a8/0x1f0) [<c00dfd2c>] (__do_page_cache_readahead) from [<c00d500c>] (filemap_fault+0x440/0x8f4) [<c00d500c>] (filemap_fault) from [<c01ed494>] (ext4_filemap_fault+0x28/0x3c) [<c01ed494>] (ext4_filemap_fault) from [<c0100b88>] (__do_fault+0x3c/0x1c0) [<c0100b88>] (__do_fault) from [<c0105360>] (handle_mm_fault+0x284/0xaf4) [<c0105360>] (handle_mm_fault) from [<c001f01c>] (do_page_fault+0x114/0x2e0) [<c001f01c>] (do_page_fault) from [<c001f34c>] (do_DataAbort+0x38/0xbc) [<c001f34c>] (do_DataAbort) from [<c000a0dc>] (__dabt_svc+0x5c/0xa0) Exception stack(0xc783be28 to 0xc783be70) be20: b6f81898 00000760 00000000 00000055 00000051 c0af3068 be40: c71f7a00 c71f7800 b6f51000 c71df320 c7954c80 00000006 00000000 c783be78 be60: c01a099c c07a4bb4 20000153 ffffffff [<c000a0dc>] (__dabt_svc) from [<c07a4bb4>] (__clear_user_std+0x34/0x68) [<c07a4bb4>] (__clear_user_std) from [<c01a099c>] (clear_user+0x40/0x50) [<c01a099c>] (clear_user) from [<c019f204>] (load_elf_binary+0x1354/0x13c4) [<c019f204>] (load_elf_binary) from [<c013996c>] (search_binary_handler.part.4+0x58/0x1fc) [<c013996c>] (search_binary_handler.part.4) from [<c013b18c>] (__do_execve_file+0x780/0x9a4) [<c013b18c>] (__do_execve_file) from [<c013b54c>] (do_execve+0x28/0x30) [<c013b54c>] (do_execve) from [<c000af1c>] (try_to_run_init_process+0xc/0x3c) [<c000af1c>] (try_to_run_init_process) from [<c07c42fc>] (kernel_init+0x88/0xf0) [<c07c42fc>] (kernel_init) from [<c00090b0>] (ret_from_fork+0x14/0x24) Exception stack(0xc783bfb0 to 0xc783bff8) bfa0: 00000000 00000000 00000000 00000000 bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 irq event stamp: 159876 hardirqs last enabled at (159875): [<c009123c>] ktime_get+0x74/0x16c hardirqs last disabled at (159876): [<c000a21c>] __und_svc+0x5c/0x70 softirqs last enabled at (159728): [<c000aaf0>] __do_softirq+0x308/0x4bc softirqs last disabled at (159697): [<c002cf94>] irq_exit+0x150/0x178 ---[ end trace 42dd349d5c0726c1 ]--- BUG: sleeping function called from invalid context at ./include/linux/cgroup-defs.h:747 in_atomic(): 0, irqs_disabled(): 128, non_block: 0, pid: 1, name: init INFO: lockdep is turned off. irq event stamp: 159876 hardirqs last enabled at (159875): [<c009123c>] ktime_get+0x74/0x16c hardirqs last disabled at (159876): [<c000a21c>] __und_svc+0x5c/0x70 softirqs last enabled at (159728): [<c000aaf0>] __do_softirq+0x308/0x4bc softirqs last disabled at (159697): [<c002cf94>] irq_exit+0x150/0x178 CPU: 0 PID: 1 Comm: init Tainted: G D W 5.5.0-rc5 #1 Hardware name: ARM-Versatile (Device Tree Support) [<c001e8b0>] (unwind_backtrace) from [<c001a774>] (show_stack+0x10/0x14) [<c001a774>] (show_stack) from [<c004fc4c>] (___might_sleep+0x1a8/0x2bc) [<c004fc4c>] (___might_sleep) from [<c00380d0>] (exit_signals+0x28/0x134) [<c00380d0>] (exit_signals) from [<c0029e70>] (do_exit+0xc8/0xb5c) [<c0029e70>] (do_exit) from [<c001a918>] (die+0x1a0/0x274) [<c001a918>] (die) from [<c001abfc>] (do_undefinstr+0xac/0x258) [<c001abfc>] (do_undefinstr) from [<c000a238>] (__und_svc_finish+0x0/0x48) Exception stack(0xc783b950 to 0xc783b998) b940: c7226a80 00000000 00000c00 c7bebe00 b960: 00000000 c783b9e4 00000000 c7226a80 00007000 00000060 c7beb848 c783b9f0 b980: 00000060 c783b9a0 c03c24c8 c03b716c 60000153 ffffffff [<c000a238>] (__und_svc_finish) from [<c03b716c>] (bio_split+0x10c/0x15c) [<c03b716c>] (bio_split) from [<c03c24c8>] (__blk_queue_split+0x378/0x628) [<c03c24c8>] (__blk_queue_split) from [<c03c82cc>] (blk_mq_make_request+0x6c/0x7e4) [<c03c82cc>] (blk_mq_make_request) from [<c03bc7d0>] (generic_make_request+0xec/0x340) [<c03bc7d0>] (generic_make_request) from [<c03bca70>] (submit_bio+0x4c/0x170) [<c03bca70>] (submit_bio) from [<c020666c>] (ext4_mpage_readpages+0x54c/0x8e0) [<c020666c>] (ext4_mpage_readpages) from [<c01e1ec8>] (ext4_readpages+0x40/0x50) [<c01e1ec8>] (ext4_readpages) from [<c00df808>] (read_pages+0x50/0x13c) [<c00df808>] (read_pages) from [<c00dfd2c>] (__do_page_cache_readahead+0x1a8/0x1f0) [<c00dfd2c>] (__do_page_cache_readahead) from [<c00d500c>] (filemap_fault+0x440/0x8f4) [<c00d500c>] (filemap_fault) from [<c01ed494>] (ext4_filemap_fault+0x28/0x3c) [<c01ed494>] (ext4_filemap_fault) from [<c0100b88>] (__do_fault+0x3c/0x1c0) [<c0100b88>] (__do_fault) from [<c0105360>] (handle_mm_fault+0x284/0xaf4) [<c0105360>] (handle_mm_fault) from [<c001f01c>] (do_page_fault+0x114/0x2e0) [<c001f01c>] (do_page_fault) from [<c001f34c>] (do_DataAbort+0x38/0xbc) [<c001f34c>] (do_DataAbort) from [<c000a0dc>] (__dabt_svc+0x5c/0xa0) Exception stack(0xc783be28 to 0xc783be70) be20: b6f81898 00000760 00000000 00000055 00000051 c0af3068 be40: c71f7a00 c71f7800 b6f51000 c71df320 c7954c80 00000006 00000000 c783be78 be60: c01a099c c07a4bb4 20000153 ffffffff [<c000a0dc>] (__dabt_svc) from [<c07a4bb4>] (__clear_user_std+0x34/0x68) [<c07a4bb4>] (__clear_user_std) from [<c01a099c>] (clear_user+0x40/0x50) [<c01a099c>] (clear_user) from [<c019f204>] (load_elf_binary+0x1354/0x13c4) [<c019f204>] (load_elf_binary) from [<c013996c>] (search_binary_handler.part.4+0x58/0x1fc) [<c013996c>] (search_binary_handler.part.4) from [<c013b18c>] (__do_execve_file+0x780/0x9a4) [<c013b18c>] (__do_execve_file) from [<c013b54c>] (do_execve+0x28/0x30) [<c013b54c>] (do_execve) from [<c000af1c>] (try_to_run_init_process+0xc/0x3c) [<c000af1c>] (try_to_run_init_process) from [<c07c42fc>] (kernel_init+0x88/0xf0) [<c07c42fc>] (kernel_init) from [<c00090b0>] (ret_from_fork+0x14/0x24) Exception stack(0xc783bfb0 to 0xc783bff8) bfa0: 00000000 00000000 00000000 00000000 bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b --- bisect log: # bad: [ae6088216ce4b99b3a4aaaccd2eb2dd40d473d42] Merge tag 'trace-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace # good: [738d2902773e30939a982c8df7a7f94293659810] Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net git bisect start 'HEAD' '738d2902773e' # bad: [84029fd04c201a4c7e0b07ba262664900f47c6f5] memcg: account security cred as well to kmemcg git bisect bad 84029fd04c201a4c7e0b07ba262664900f47c6f5 # good: [e35d0165908ad2d2bdb76773ef77b551763eedbd] Merge tag 'sound-5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound git bisect good e35d0165908ad2d2bdb76773ef77b551763eedbd # bad: [3a562aee727a7bfbb3a37b1aa934118397dad701] Merge tag 'for-5.5-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux git bisect bad 3a562aee727a7bfbb3a37b1aa934118397dad701 # good: [bed723519a72c0f68fbfaf68ed5bf55d04e46566] Merge tag 'kbuild-fixes-v5.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild git bisect good bed723519a72c0f68fbfaf68ed5bf55d04e46566 # bad: [b6b4aafc99d7c8dbf7d9429bf054b591daab1ad0] Merge tag 'block-5.5-20200103' of git://git.kernel.dk/linux-block git bisect bad b6b4aafc99d7c8dbf7d9429bf054b591daab1ad0 # bad: [429120f3df2dba2bf3a4a19f4212a53ecefc7102] block: fix splitting segments on boundary masks git bisect bad 429120f3df2dba2bf3a4a19f4212a53ecefc7102 # good: [85a8ce62c2eabe28b9d76ca4eecf37922402df93] block: add bio_truncate to fix guard_bio_eod git bisect good 85a8ce62c2eabe28b9d76ca4eecf37922402df93 # first bad commit: [429120f3df2dba2bf3a4a19f4212a53ecefc7102] block: fix splitting segments on boundary masks