2022-12-20 09:31:08

by Naresh Kamboju

[permalink] [raw]
Subject: next: kernel BUG at drivers/virtio/virtio.c:122!

The qemu-x86_64 and qemu-arm64 boot failed with Linux next-20221220 tag.
It is always reproducible with gcc-11/ gcc-12 and clang tool chains.

Reported-by: Linux Kernel Functional Testing <[email protected]>

<6>[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
<5>[ 0.000000] Linux version 6.1.0-next-20221220 (tuxmake@tuxmake)
(Debian clang version 16.0.0
(++20221218072110+9c1b82599dac-1~exp1~20221218072217.501), Debian LLD
16.0.0) #1 SMP PREEMPT @1671498176
<5>[ 0.000000] random: crng init done
<6>[ 0.000000] Machine model: linux,dummy-virt
....
<6>[ 3.571098] loop: module loaded
<6>[ 3.573410] virtio_blk virtio0: 1/0/0 default/read/poll queues
<5>[ 3.578816] virtio_blk virtio0: [vda] 2816420 512-byte logical
blocks (1.44 GB/1.34 GiB)
<4>[ 3.581234] ------------[ cut here ]------------
<2>[ 3.581595] kernel BUG at drivers/virtio/virtio.c:122!
<0>[ 3.582906] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
<4>[ 3.583672] Modules linked in:
<4>[ 3.584905] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
6.1.0-next-20221220 #1
<4>[ 3.585801] Hardware name: linux,dummy-virt (DT)
<4>[ 3.586591] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT
-SSBS BTYPE=--)
<4>[ 3.587349] pc : virtio_check_driver_offered_feature+0x60/0x6c
<4>[ 3.588613] lr : virtblk_probe+0x7cc/0x8f0
<4>[ 3.588915] sp : ffff80000802b840
<4>[ 3.589314] x29: ffff80000802b850 x28: 0000000000000000 x27:
0000000000000001
<4>[ 3.590509] x26: 0000000000000001 x25: 0000000000000200 x24:
ffff0000c1699b00
<4>[ 3.590832] x23: 00000000000000fe x22: ffff0000c0313c30 x21:
ffff0000c0313c00
<4>[ 3.591568] x20: ffff0000c02f4080 x19: 0000000000000000 x18:
ffffffffffffffff
<4>[ 3.592056] x17: 00000000ffffffea x16: 00000000fffffffe x15:
0000000000000004
<4>[ 3.592632] x14: 0000000000000fff x13: ffff800008028000 x12:
ffff80000802c000
<4>[ 3.593157] x11: 000000000000000f x10: 000000000000000f x9 :
ffffae66eee314d8
<4>[ 3.594048] x8 : 0000000000000000 x7 : 3631383837352e33 x6 :
202020205b3e353c
<4>[ 3.594429] x5 : 0000000000000001 x4 : 0000000000000000 x3 :
ffff80000802b780
<4>[ 3.594956] x2 : ffff80000802b6f8 x1 : 0000000000000011 x0 :
ffff0000c02f4080
<4>[ 3.595811] Call trace:
<4>[ 3.596120] virtio_check_driver_offered_feature+0x60/0x6c
<4>[ 3.596632] virtio_dev_probe+0x274/0x320
<4>[ 3.597064] really_probe+0x178/0x418
<4>[ 3.597547] __driver_probe_device+0x120/0x188
<4>[ 3.597820] driver_probe_device+0x48/0x22c
<4>[ 3.598189] __driver_attach+0xf8/0x250
<4>[ 3.598656] bus_for_each_dev+0x8c/0xd8
<4>[ 3.599151] driver_attach+0x30/0x3c
<4>[ 3.599321] bus_add_driver+0x11c/0x22c
<4>[ 3.599684] driver_register+0x84/0x120
<4>[ 3.600175] register_virtio_driver+0x38/0x48
<4>[ 3.600575] virtio_blk_init+0x6c/0xb4
<4>[ 3.600759] do_one_initcall+0xe0/0x2f8
<4>[ 3.601197] do_initcall_level+0xa8/0x150
<4>[ 3.601703] do_initcalls+0x60/0xa0
<4>[ 3.601892] do_basic_setup+0x28/0x34
<4>[ 3.602229] kernel_init_freeable+0x100/0x178
<4>[ 3.602706] kernel_init+0x2c/0x1b4
<4>[ 3.603162] ret_from_fork+0x10/0x20
<0>[ 3.604398] Code: 540000a0 91001129 f1000508 54ffff61 (d4210000)
<4>[ 3.606108] ---[ end trace 0000000000000000 ]---
<6>[ 3.606714] note: swapper/0[1] exited with preempt_count 1
<0>[ 3.608155] Kernel panic - not syncing: Attempted to kill init!
exitcode=0x0000000b
<2>[ 3.609173] SMP: stopping secondary CPUs
<0>[ 3.610506] Kernel Offset: 0x2e66e4800000 from 0xffff800008000000
<0>[ 3.610970] PHYS_OFFSET: 0x40000000
<0>[ 3.611428] CPU features: 0x00000,003a612f,cd22773f
<0>[ 3.612277] Memory Limit: none
<0>[ 3.613192] ---[ end Kernel panic - not syncing: Attempted to
kill init! exitcode=0x0000000b ]---

Ref Links,
https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13764099/suite/log-parser-test/test/check-kernel-bug/details/
https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13766814/suite/boot/test/clang-nightly-lkftconfig/details/
https://storage.tuxsuite.com/public/linaro/lkft/builds/2J9l3qxSBmPWVa1S2uWn0Xuwl1J/config


--
Linaro LKFT
https://lkft.linaro.org


2022-12-20 10:43:56

by Michael S. Tsirkin

[permalink] [raw]
Subject: Re: next: kernel BUG at drivers/virtio/virtio.c:122!

On Tue, Dec 20, 2022 at 02:51:54PM +0530, Naresh Kamboju wrote:
> The qemu-x86_64 and qemu-arm64 boot failed with Linux next-20221220 tag.
> It is always reproducible with gcc-11/ gcc-12 and clang tool chains.
>
> Reported-by: Linux Kernel Functional Testing <[email protected]>
>
> <6>[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
> <5>[ 0.000000] Linux version 6.1.0-next-20221220 (tuxmake@tuxmake)
> (Debian clang version 16.0.0
> (++20221218072110+9c1b82599dac-1~exp1~20221218072217.501), Debian LLD
> 16.0.0) #1 SMP PREEMPT @1671498176
> <5>[ 0.000000] random: crng init done
> <6>[ 0.000000] Machine model: linux,dummy-virt
> ....
> <6>[ 3.571098] loop: module loaded
> <6>[ 3.573410] virtio_blk virtio0: 1/0/0 default/read/poll queues
> <5>[ 3.578816] virtio_blk virtio0: [vda] 2816420 512-byte logical
> blocks (1.44 GB/1.34 GiB)
> <4>[ 3.581234] ------------[ cut here ]------------
> <2>[ 3.581595] kernel BUG at drivers/virtio/virtio.c:122!
> <0>[ 3.582906] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
> <4>[ 3.583672] Modules linked in:
> <4>[ 3.584905] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
> 6.1.0-next-20221220 #1
> <4>[ 3.585801] Hardware name: linux,dummy-virt (DT)
> <4>[ 3.586591] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT
> -SSBS BTYPE=--)
> <4>[ 3.587349] pc : virtio_check_driver_offered_feature+0x60/0x6c
> <4>[ 3.588613] lr : virtblk_probe+0x7cc/0x8f0
> <4>[ 3.588915] sp : ffff80000802b840
> <4>[ 3.589314] x29: ffff80000802b850 x28: 0000000000000000 x27:
> 0000000000000001
> <4>[ 3.590509] x26: 0000000000000001 x25: 0000000000000200 x24:
> ffff0000c1699b00
> <4>[ 3.590832] x23: 00000000000000fe x22: ffff0000c0313c30 x21:
> ffff0000c0313c00
> <4>[ 3.591568] x20: ffff0000c02f4080 x19: 0000000000000000 x18:
> ffffffffffffffff
> <4>[ 3.592056] x17: 00000000ffffffea x16: 00000000fffffffe x15:
> 0000000000000004
> <4>[ 3.592632] x14: 0000000000000fff x13: ffff800008028000 x12:
> ffff80000802c000
> <4>[ 3.593157] x11: 000000000000000f x10: 000000000000000f x9 :
> ffffae66eee314d8
> <4>[ 3.594048] x8 : 0000000000000000 x7 : 3631383837352e33 x6 :
> 202020205b3e353c
> <4>[ 3.594429] x5 : 0000000000000001 x4 : 0000000000000000 x3 :
> ffff80000802b780
> <4>[ 3.594956] x2 : ffff80000802b6f8 x1 : 0000000000000011 x0 :
> ffff0000c02f4080
> <4>[ 3.595811] Call trace:
> <4>[ 3.596120] virtio_check_driver_offered_feature+0x60/0x6c
> <4>[ 3.596632] virtio_dev_probe+0x274/0x320
> <4>[ 3.597064] really_probe+0x178/0x418
> <4>[ 3.597547] __driver_probe_device+0x120/0x188
> <4>[ 3.597820] driver_probe_device+0x48/0x22c
> <4>[ 3.598189] __driver_attach+0xf8/0x250
> <4>[ 3.598656] bus_for_each_dev+0x8c/0xd8
> <4>[ 3.599151] driver_attach+0x30/0x3c
> <4>[ 3.599321] bus_add_driver+0x11c/0x22c
> <4>[ 3.599684] driver_register+0x84/0x120
> <4>[ 3.600175] register_virtio_driver+0x38/0x48
> <4>[ 3.600575] virtio_blk_init+0x6c/0xb4
> <4>[ 3.600759] do_one_initcall+0xe0/0x2f8
> <4>[ 3.601197] do_initcall_level+0xa8/0x150
> <4>[ 3.601703] do_initcalls+0x60/0xa0
> <4>[ 3.601892] do_basic_setup+0x28/0x34
> <4>[ 3.602229] kernel_init_freeable+0x100/0x178
> <4>[ 3.602706] kernel_init+0x2c/0x1b4
> <4>[ 3.603162] ret_from_fork+0x10/0x20
> <0>[ 3.604398] Code: 540000a0 91001129 f1000508 54ffff61 (d4210000)
> <4>[ 3.606108] ---[ end trace 0000000000000000 ]---
> <6>[ 3.606714] note: swapper/0[1] exited with preempt_count 1
> <0>[ 3.608155] Kernel panic - not syncing: Attempted to kill init!
> exitcode=0x0000000b
> <2>[ 3.609173] SMP: stopping secondary CPUs
> <0>[ 3.610506] Kernel Offset: 0x2e66e4800000 from 0xffff800008000000
> <0>[ 3.610970] PHYS_OFFSET: 0x40000000
> <0>[ 3.611428] CPU features: 0x00000,003a612f,cd22773f
> <0>[ 3.612277] Memory Limit: none
> <0>[ 3.613192] ---[ end Kernel panic - not syncing: Attempted to
> kill init! exitcode=0x0000000b ]---
>
> Ref Links,
> https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13764099/suite/log-parser-test/test/check-kernel-bug/details/
> https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13766814/suite/boot/test/clang-nightly-lkftconfig/details/
> https://storage.tuxsuite.com/public/linaro/lkft/builds/2J9l3qxSBmPWVa1S2uWn0Xuwl1J/config
>
>
> --
> Linaro LKFT
> https://lkft.linaro.org

Could you post a bit more detail pls?
- qemu version and command line
- .config
- compiler / compiler flags if any

Thanks!

--
MST

2022-12-20 11:09:43

by Michael S. Tsirkin

[permalink] [raw]
Subject: Re: next: kernel BUG at drivers/virtio/virtio.c:122!

On Tue, Dec 20, 2022 at 04:12:05PM +0530, Naresh Kamboju wrote:
> On Tue, 20 Dec 2022 at 16:04, Xuan Zhuo <[email protected]> wrote:
> >
> > On Tue, 20 Dec 2022 14:51:54 +0530, Naresh Kamboju <[email protected]> wrote:
> > > The qemu-x86_64 and qemu-arm64 boot failed with Linux next-20221220 tag.
> > > It is always reproducible with gcc-11/ gcc-12 and clang tool chains.
> > >
> > > Reported-by: Linux Kernel Functional Testing <[email protected]>
> > >
> > > <6>[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
> > > <5>[ 0.000000] Linux version 6.1.0-next-20221220 (tuxmake@tuxmake)
> > > (Debian clang version 16.0.0
> > > (++20221218072110+9c1b82599dac-1~exp1~20221218072217.501), Debian LLD
> > > 16.0.0) #1 SMP PREEMPT @1671498176
> > > <5>[ 0.000000] random: crng init done
> > > <6>[ 0.000000] Machine model: linux,dummy-virt
> > > ....
> > > <6>[ 3.571098] loop: module loaded
> > > <6>[ 3.573410] virtio_blk virtio0: 1/0/0 default/read/poll queues
> > > <5>[ 3.578816] virtio_blk virtio0: [vda] 2816420 512-byte logical
> > > blocks (1.44 GB/1.34 GiB)
> > > <4>[ 3.581234] ------------[ cut here ]------------
> > > <2>[ 3.581595] kernel BUG at drivers/virtio/virtio.c:122!
> > > <0>[ 3.582906] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
> > > <4>[ 3.583672] Modules linked in:
> > > <4>[ 3.584905] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
> > > 6.1.0-next-20221220 #1
> > > <4>[ 3.585801] Hardware name: linux,dummy-virt (DT)
> > > <4>[ 3.586591] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT
> > > -SSBS BTYPE=--)
> > > <4>[ 3.587349] pc : virtio_check_driver_offered_feature+0x60/0x6c
> > > <4>[ 3.588613] lr : virtblk_probe+0x7cc/0x8f0
> > > <4>[ 3.588915] sp : ffff80000802b840
> > > <4>[ 3.589314] x29: ffff80000802b850 x28: 0000000000000000 x27:
> > > 0000000000000001
> > > <4>[ 3.590509] x26: 0000000000000001 x25: 0000000000000200 x24:
> > > ffff0000c1699b00
> > > <4>[ 3.590832] x23: 00000000000000fe x22: ffff0000c0313c30 x21:
> > > ffff0000c0313c00
> > > <4>[ 3.591568] x20: ffff0000c02f4080 x19: 0000000000000000 x18:
> > > ffffffffffffffff
> > > <4>[ 3.592056] x17: 00000000ffffffea x16: 00000000fffffffe x15:
> > > 0000000000000004
> > > <4>[ 3.592632] x14: 0000000000000fff x13: ffff800008028000 x12:
> > > ffff80000802c000
> > > <4>[ 3.593157] x11: 000000000000000f x10: 000000000000000f x9 :
> > > ffffae66eee314d8
> > > <4>[ 3.594048] x8 : 0000000000000000 x7 : 3631383837352e33 x6 :
> > > 202020205b3e353c
> > > <4>[ 3.594429] x5 : 0000000000000001 x4 : 0000000000000000 x3 :
> > > ffff80000802b780
> > > <4>[ 3.594956] x2 : ffff80000802b6f8 x1 : 0000000000000011 x0 :
> > > ffff0000c02f4080
> > > <4>[ 3.595811] Call trace:
> > > <4>[ 3.596120] virtio_check_driver_offered_feature+0x60/0x6c
> > > <4>[ 3.596632] virtio_dev_probe+0x274/0x320
> > > <4>[ 3.597064] really_probe+0x178/0x418
> > > <4>[ 3.597547] __driver_probe_device+0x120/0x188
> > > <4>[ 3.597820] driver_probe_device+0x48/0x22c
> > > <4>[ 3.598189] __driver_attach+0xf8/0x250
> > > <4>[ 3.598656] bus_for_each_dev+0x8c/0xd8
> > > <4>[ 3.599151] driver_attach+0x30/0x3c
> > > <4>[ 3.599321] bus_add_driver+0x11c/0x22c
> > > <4>[ 3.599684] driver_register+0x84/0x120
> > > <4>[ 3.600175] register_virtio_driver+0x38/0x48
> > > <4>[ 3.600575] virtio_blk_init+0x6c/0xb4
> > > <4>[ 3.600759] do_one_initcall+0xe0/0x2f8
> > > <4>[ 3.601197] do_initcall_level+0xa8/0x150
> > > <4>[ 3.601703] do_initcalls+0x60/0xa0
> > > <4>[ 3.601892] do_basic_setup+0x28/0x34
> > > <4>[ 3.602229] kernel_init_freeable+0x100/0x178
> > > <4>[ 3.602706] kernel_init+0x2c/0x1b4
> > > <4>[ 3.603162] ret_from_fork+0x10/0x20
> > > <0>[ 3.604398] Code: 540000a0 91001129 f1000508 54ffff61 (d4210000)
> > > <4>[ 3.606108] ---[ end trace 0000000000000000 ]---
> > > <6>[ 3.606714] note: swapper/0[1] exited with preempt_count 1
> > > <0>[ 3.608155] Kernel panic - not syncing: Attempted to kill init!
> > > exitcode=0x0000000b
> > > <2>[ 3.609173] SMP: stopping secondary CPUs
> > > <0>[ 3.610506] Kernel Offset: 0x2e66e4800000 from 0xffff800008000000
> > > <0>[ 3.610970] PHYS_OFFSET: 0x40000000
> > > <0>[ 3.611428] CPU features: 0x00000,003a612f,cd22773f
> > > <0>[ 3.612277] Memory Limit: none
> > > <0>[ 3.613192] ---[ end Kernel panic - not syncing: Attempted to
> > > kill init! exitcode=0x0000000b ]---
> > >
> > > Ref Links,
> > > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13764099/suite/log-parser-test/test/check-kernel-bug/details/
> > > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13766814/suite/boot/test/clang-nightly-lkftconfig/details/
> > > https://storage.tuxsuite.com/public/linaro/lkft/builds/2J9l3qxSBmPWVa1S2uWn0Xuwl1J/config
> > >
> >
> >
> > I think there is a bug, VIRTIO_BLK_F_ZONED depends the CONFIG_BLK_DEV_ZONE, but
> > checking its code in virtblk_probe does not depend on this config.
>
> I see this in my config,
> # CONFIG_BLK_DEV_ZONED is not set
>
> >
> > This option in your config file is indeed not opened.
> >
> > static int virtblk_probe(struct virtio_device *vdev){
> > .....
> > virtblk_update_capacity(vblk, false);
> > virtio_device_ready(vdev);
> >
> > if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
> > err = virtblk_probe_zoned_device(vdev, vblk, q);
> > if (err)
> > goto out_cleanup_disk;
> > }
> >
> > dev_info(&vdev->dev, "blk config size: %zu\n",
> > sizeof(struct virtio_blk_config));
> >
> > ....
> >
> > static unsigned int features[] = {
> > VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, VIRTIO_BLK_F_GEOMETRY,
> > VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
> > VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
> > VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
> > VIRTIO_BLK_F_SECURE_ERASE, VIRTIO_BLK_F_LIFETIME,
> > #ifdef CONFIG_BLK_DEV_ZONED
> > VIRTIO_BLK_F_ZONED,
> > #endif /* CONFIG_BLK_DEV_ZONED */
> > }
>
> I have attached config files to this email.
>
> >
> > Thanks.
> >
> >
> > >
> > > --
> > > Linaro LKFT
> > > https://lkft.linaro.org


Thanks a lot!

--
MST

2022-12-20 11:10:13

by Michael S. Tsirkin

[permalink] [raw]
Subject: Re: next: kernel BUG at drivers/virtio/virtio.c:122!

On Tue, Dec 20, 2022 at 06:27:59PM +0800, Xuan Zhuo wrote:
> On Tue, 20 Dec 2022 14:51:54 +0530, Naresh Kamboju <[email protected]> wrote:
> > The qemu-x86_64 and qemu-arm64 boot failed with Linux next-20221220 tag.
> > It is always reproducible with gcc-11/ gcc-12 and clang tool chains.
> >
> > Reported-by: Linux Kernel Functional Testing <[email protected]>
> >
> > <6>[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
> > <5>[ 0.000000] Linux version 6.1.0-next-20221220 (tuxmake@tuxmake)
> > (Debian clang version 16.0.0
> > (++20221218072110+9c1b82599dac-1~exp1~20221218072217.501), Debian LLD
> > 16.0.0) #1 SMP PREEMPT @1671498176
> > <5>[ 0.000000] random: crng init done
> > <6>[ 0.000000] Machine model: linux,dummy-virt
> > ....
> > <6>[ 3.571098] loop: module loaded
> > <6>[ 3.573410] virtio_blk virtio0: 1/0/0 default/read/poll queues
> > <5>[ 3.578816] virtio_blk virtio0: [vda] 2816420 512-byte logical
> > blocks (1.44 GB/1.34 GiB)
> > <4>[ 3.581234] ------------[ cut here ]------------
> > <2>[ 3.581595] kernel BUG at drivers/virtio/virtio.c:122!
> > <0>[ 3.582906] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
> > <4>[ 3.583672] Modules linked in:
> > <4>[ 3.584905] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
> > 6.1.0-next-20221220 #1
> > <4>[ 3.585801] Hardware name: linux,dummy-virt (DT)
> > <4>[ 3.586591] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT
> > -SSBS BTYPE=--)
> > <4>[ 3.587349] pc : virtio_check_driver_offered_feature+0x60/0x6c
> > <4>[ 3.588613] lr : virtblk_probe+0x7cc/0x8f0
> > <4>[ 3.588915] sp : ffff80000802b840
> > <4>[ 3.589314] x29: ffff80000802b850 x28: 0000000000000000 x27:
> > 0000000000000001
> > <4>[ 3.590509] x26: 0000000000000001 x25: 0000000000000200 x24:
> > ffff0000c1699b00
> > <4>[ 3.590832] x23: 00000000000000fe x22: ffff0000c0313c30 x21:
> > ffff0000c0313c00
> > <4>[ 3.591568] x20: ffff0000c02f4080 x19: 0000000000000000 x18:
> > ffffffffffffffff
> > <4>[ 3.592056] x17: 00000000ffffffea x16: 00000000fffffffe x15:
> > 0000000000000004
> > <4>[ 3.592632] x14: 0000000000000fff x13: ffff800008028000 x12:
> > ffff80000802c000
> > <4>[ 3.593157] x11: 000000000000000f x10: 000000000000000f x9 :
> > ffffae66eee314d8
> > <4>[ 3.594048] x8 : 0000000000000000 x7 : 3631383837352e33 x6 :
> > 202020205b3e353c
> > <4>[ 3.594429] x5 : 0000000000000001 x4 : 0000000000000000 x3 :
> > ffff80000802b780
> > <4>[ 3.594956] x2 : ffff80000802b6f8 x1 : 0000000000000011 x0 :
> > ffff0000c02f4080
> > <4>[ 3.595811] Call trace:
> > <4>[ 3.596120] virtio_check_driver_offered_feature+0x60/0x6c
> > <4>[ 3.596632] virtio_dev_probe+0x274/0x320
> > <4>[ 3.597064] really_probe+0x178/0x418
> > <4>[ 3.597547] __driver_probe_device+0x120/0x188
> > <4>[ 3.597820] driver_probe_device+0x48/0x22c
> > <4>[ 3.598189] __driver_attach+0xf8/0x250
> > <4>[ 3.598656] bus_for_each_dev+0x8c/0xd8
> > <4>[ 3.599151] driver_attach+0x30/0x3c
> > <4>[ 3.599321] bus_add_driver+0x11c/0x22c
> > <4>[ 3.599684] driver_register+0x84/0x120
> > <4>[ 3.600175] register_virtio_driver+0x38/0x48
> > <4>[ 3.600575] virtio_blk_init+0x6c/0xb4
> > <4>[ 3.600759] do_one_initcall+0xe0/0x2f8
> > <4>[ 3.601197] do_initcall_level+0xa8/0x150
> > <4>[ 3.601703] do_initcalls+0x60/0xa0
> > <4>[ 3.601892] do_basic_setup+0x28/0x34
> > <4>[ 3.602229] kernel_init_freeable+0x100/0x178
> > <4>[ 3.602706] kernel_init+0x2c/0x1b4
> > <4>[ 3.603162] ret_from_fork+0x10/0x20
> > <0>[ 3.604398] Code: 540000a0 91001129 f1000508 54ffff61 (d4210000)
> > <4>[ 3.606108] ---[ end trace 0000000000000000 ]---
> > <6>[ 3.606714] note: swapper/0[1] exited with preempt_count 1
> > <0>[ 3.608155] Kernel panic - not syncing: Attempted to kill init!
> > exitcode=0x0000000b
> > <2>[ 3.609173] SMP: stopping secondary CPUs
> > <0>[ 3.610506] Kernel Offset: 0x2e66e4800000 from 0xffff800008000000
> > <0>[ 3.610970] PHYS_OFFSET: 0x40000000
> > <0>[ 3.611428] CPU features: 0x00000,003a612f,cd22773f
> > <0>[ 3.612277] Memory Limit: none
> > <0>[ 3.613192] ---[ end Kernel panic - not syncing: Attempted to
> > kill init! exitcode=0x0000000b ]---
> >
> > Ref Links,
> > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13764099/suite/log-parser-test/test/check-kernel-bug/details/
> > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13766814/suite/boot/test/clang-nightly-lkftconfig/details/
> > https://storage.tuxsuite.com/public/linaro/lkft/builds/2J9l3qxSBmPWVa1S2uWn0Xuwl1J/config
> >
>
>
> I think there is a bug, VIRTIO_BLK_F_ZONED depends the CONFIG_BLK_DEV_ZONE, but
> checking its code in virtblk_probe does not depend on this config.
>
> This option in your config file is indeed not opened.
>
>
> static int virtblk_probe(struct virtio_device *vdev){
> .....
> virtblk_update_capacity(vblk, false);
> virtio_device_ready(vdev);
>
> if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
> err = virtblk_probe_zoned_device(vdev, vblk, q);
> if (err)
> goto out_cleanup_disk;
> }
>
> dev_info(&vdev->dev, "blk config size: %zu\n",
> sizeof(struct virtio_blk_config));
>
> ....
>
> static unsigned int features[] = {
> VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, VIRTIO_BLK_F_GEOMETRY,
> VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
> VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
> VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
> VIRTIO_BLK_F_SECURE_ERASE, VIRTIO_BLK_F_LIFETIME,
> #ifdef CONFIG_BLK_DEV_ZONED
> VIRTIO_BLK_F_ZONED,
> #endif /* CONFIG_BLK_DEV_ZONED */
> }
>
>
> Thanks.

Oh you are right, I wanted to test it so of course I enabled it.

Testing this fixup now:

commit f9503d0fd839b59e0f48b00c20635437c41420ed
Author: Michael S. Tsirkin <[email protected]>
Date: Tue Dec 20 05:53:41 2022 -0500

fixup! virtio-blk: add support for zoned block devices

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index ff49052e26f7..d8cdaeb51d1c 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -775,6 +775,10 @@ static int virtblk_probe_zoned_device(struct virtio_device *vdev,
return ret;
}

+static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
+{
+ return virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED);
+}
#else

/*
@@ -790,6 +794,11 @@ static inline int virtblk_probe_zoned_device(struct virtio_device *vdev,
{
return -EOPNOTSUPP;
}
+
+static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
+{
+ return false;
+}
#endif /* CONFIG_BLK_DEV_ZONED */

/* return id (s/n) string for *disk to *id_str
@@ -1576,11 +1585,11 @@ static int virtblk_probe(struct virtio_device *vdev)
else
q->limits.discard_granularity = blk_size;
}

virtblk_update_capacity(vblk, false);
virtio_device_ready(vdev);

- if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
+ if (virtblk_has_zoned_feature(vdev)) {
err = virtblk_probe_zoned_device(vdev, vblk, q);
if (err)
goto out_cleanup_disk;
--
MST

2022-12-20 11:13:59

by Anders Roxell

[permalink] [raw]
Subject: Re: next: kernel BUG at drivers/virtio/virtio.c:122!

On Tue, 20 Dec 2022 at 11:44, Michael S. Tsirkin <[email protected]> wrote:
>
> On Tue, Dec 20, 2022 at 04:12:05PM +0530, Naresh Kamboju wrote:
> > On Tue, 20 Dec 2022 at 16:04, Xuan Zhuo <[email protected]> wrote:
> > >
> > > On Tue, 20 Dec 2022 14:51:54 +0530, Naresh Kamboju <[email protected]> wrote:
> > > > The qemu-x86_64 and qemu-arm64 boot failed with Linux next-20221220 tag.
> > > > It is always reproducible with gcc-11/ gcc-12 and clang tool chains.
> > > >
> > > > Reported-by: Linux Kernel Functional Testing <[email protected]>
> > > >
> > > > <6>[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
> > > > <5>[ 0.000000] Linux version 6.1.0-next-20221220 (tuxmake@tuxmake)
> > > > (Debian clang version 16.0.0
> > > > (++20221218072110+9c1b82599dac-1~exp1~20221218072217.501), Debian LLD
> > > > 16.0.0) #1 SMP PREEMPT @1671498176
> > > > <5>[ 0.000000] random: crng init done
> > > > <6>[ 0.000000] Machine model: linux,dummy-virt
> > > > ....
> > > > <6>[ 3.571098] loop: module loaded
> > > > <6>[ 3.573410] virtio_blk virtio0: 1/0/0 default/read/poll queues
> > > > <5>[ 3.578816] virtio_blk virtio0: [vda] 2816420 512-byte logical
> > > > blocks (1.44 GB/1.34 GiB)
> > > > <4>[ 3.581234] ------------[ cut here ]------------
> > > > <2>[ 3.581595] kernel BUG at drivers/virtio/virtio.c:122!
> > > > <0>[ 3.582906] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
> > > > <4>[ 3.583672] Modules linked in:
> > > > <4>[ 3.584905] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
> > > > 6.1.0-next-20221220 #1
> > > > <4>[ 3.585801] Hardware name: linux,dummy-virt (DT)
> > > > <4>[ 3.586591] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT
> > > > -SSBS BTYPE=--)
> > > > <4>[ 3.587349] pc : virtio_check_driver_offered_feature+0x60/0x6c
> > > > <4>[ 3.588613] lr : virtblk_probe+0x7cc/0x8f0

I bisected this problem down to this
patch 0562d7bf1604 ("virtio-blk: add support for zoned block devices")
see the full bisection log [1].

I built just a plain defconfig for an arm64 kernel.
I used tuxmake and tuxrun to do the bisection a commanline like this:
$ git bisect start next-20221220 next/stable \
&& git bisect run tuxmake --runtime podman \
--target-arch arm64 --toolchain gcc-12 \
--kconfig defconfig kernel @tuxrun-arm64

Pre-req: install tuxmake [2], tuxrun [3] and podman and store a tuxmake
result-hook in your $HOME/.config/tuxmake dir
$ mkdir -p ~/.config/tuxmake/
$ curl -sSL http://ix.io/4j6v -o ~/.config/tuxmake/tuxrun-arm64

I reverted the patch and the kernel booted fine.

Cheers,
Anders
[1] http://ix.io/4j6B
[2] https://tuxmake.org/
[3] https://tuxrun.org/
[4] http://ix.io/4j6v

2022-12-20 11:15:26

by Naresh Kamboju

[permalink] [raw]
Subject: Re: next: kernel BUG at drivers/virtio/virtio.c:122!

Hi Michael,

On Tue, 20 Dec 2022 at 15:20, Michael S. Tsirkin <[email protected]> wrote:
>
> On Tue, Dec 20, 2022 at 02:51:54PM +0530, Naresh Kamboju wrote:
> > The qemu-x86_64 and qemu-arm64 boot failed with Linux next-20221220 tag.
> > It is always reproducible with gcc-11/ gcc-12 and clang tool chains.
> >
> > Reported-by: Linux Kernel Functional Testing <[email protected]>
> >
> > <6>[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
> > <5>[ 0.000000] Linux version 6.1.0-next-20221220 (tuxmake@tuxmake)
> > (Debian clang version 16.0.0
> > (++20221218072110+9c1b82599dac-1~exp1~20221218072217.501), Debian LLD
> > 16.0.0) #1 SMP PREEMPT @1671498176
> > <5>[ 0.000000] random: crng init done
> > <6>[ 0.000000] Machine model: linux,dummy-virt
> > ....
> > <6>[ 3.571098] loop: module loaded
> > <6>[ 3.573410] virtio_blk virtio0: 1/0/0 default/read/poll queues
> > <5>[ 3.578816] virtio_blk virtio0: [vda] 2816420 512-byte logical
> > blocks (1.44 GB/1.34 GiB)
> > <4>[ 3.581234] ------------[ cut here ]------------
> > <2>[ 3.581595] kernel BUG at drivers/virtio/virtio.c:122!
> > <0>[ 3.582906] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
> > <4>[ 3.583672] Modules linked in:
> > <4>[ 3.584905] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
> > 6.1.0-next-20221220 #1
> > <4>[ 3.585801] Hardware name: linux,dummy-virt (DT)
> > <4>[ 3.586591] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT
> > -SSBS BTYPE=--)
> > <4>[ 3.587349] pc : virtio_check_driver_offered_feature+0x60/0x6c
> > <4>[ 3.588613] lr : virtblk_probe+0x7cc/0x8f0
> > <4>[ 3.588915] sp : ffff80000802b840
> > <4>[ 3.589314] x29: ffff80000802b850 x28: 0000000000000000 x27:
> > 0000000000000001
> > <4>[ 3.590509] x26: 0000000000000001 x25: 0000000000000200 x24:
> > ffff0000c1699b00
> > <4>[ 3.590832] x23: 00000000000000fe x22: ffff0000c0313c30 x21:
> > ffff0000c0313c00
> > <4>[ 3.591568] x20: ffff0000c02f4080 x19: 0000000000000000 x18:
> > ffffffffffffffff
> > <4>[ 3.592056] x17: 00000000ffffffea x16: 00000000fffffffe x15:
> > 0000000000000004
> > <4>[ 3.592632] x14: 0000000000000fff x13: ffff800008028000 x12:
> > ffff80000802c000
> > <4>[ 3.593157] x11: 000000000000000f x10: 000000000000000f x9 :
> > ffffae66eee314d8
> > <4>[ 3.594048] x8 : 0000000000000000 x7 : 3631383837352e33 x6 :
> > 202020205b3e353c
> > <4>[ 3.594429] x5 : 0000000000000001 x4 : 0000000000000000 x3 :
> > ffff80000802b780
> > <4>[ 3.594956] x2 : ffff80000802b6f8 x1 : 0000000000000011 x0 :
> > ffff0000c02f4080
> > <4>[ 3.595811] Call trace:
> > <4>[ 3.596120] virtio_check_driver_offered_feature+0x60/0x6c
> > <4>[ 3.596632] virtio_dev_probe+0x274/0x320
> > <4>[ 3.597064] really_probe+0x178/0x418
> > <4>[ 3.597547] __driver_probe_device+0x120/0x188
> > <4>[ 3.597820] driver_probe_device+0x48/0x22c
> > <4>[ 3.598189] __driver_attach+0xf8/0x250
> > <4>[ 3.598656] bus_for_each_dev+0x8c/0xd8
> > <4>[ 3.599151] driver_attach+0x30/0x3c
> > <4>[ 3.599321] bus_add_driver+0x11c/0x22c
> > <4>[ 3.599684] driver_register+0x84/0x120
> > <4>[ 3.600175] register_virtio_driver+0x38/0x48
> > <4>[ 3.600575] virtio_blk_init+0x6c/0xb4
> > <4>[ 3.600759] do_one_initcall+0xe0/0x2f8
> > <4>[ 3.601197] do_initcall_level+0xa8/0x150
> > <4>[ 3.601703] do_initcalls+0x60/0xa0
> > <4>[ 3.601892] do_basic_setup+0x28/0x34
> > <4>[ 3.602229] kernel_init_freeable+0x100/0x178
> > <4>[ 3.602706] kernel_init+0x2c/0x1b4
> > <4>[ 3.603162] ret_from_fork+0x10/0x20
> > <0>[ 3.604398] Code: 540000a0 91001129 f1000508 54ffff61 (d4210000)
> > <4>[ 3.606108] ---[ end trace 0000000000000000 ]---
> > <6>[ 3.606714] note: swapper/0[1] exited with preempt_count 1
> > <0>[ 3.608155] Kernel panic - not syncing: Attempted to kill init!
> > exitcode=0x0000000b
> > <2>[ 3.609173] SMP: stopping secondary CPUs
> > <0>[ 3.610506] Kernel Offset: 0x2e66e4800000 from 0xffff800008000000
> > <0>[ 3.610970] PHYS_OFFSET: 0x40000000
> > <0>[ 3.611428] CPU features: 0x00000,003a612f,cd22773f
> > <0>[ 3.612277] Memory Limit: none
> > <0>[ 3.613192] ---[ end Kernel panic - not syncing: Attempted to
> > kill init! exitcode=0x0000000b ]---
> >
> > Ref Links,
> > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13764099/suite/log-parser-test/test/check-kernel-bug/details/
> > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13766814/suite/boot/test/clang-nightly-lkftconfig/details/
> > https://storage.tuxsuite.com/public/linaro/lkft/builds/2J9l3qxSBmPWVa1S2uWn0Xuwl1J/config
> >

>
> Could you post a bit more detail pls?

I request you to refer above links for more details,

All the required details are here in those links,
> - qemu version and command line

5.2 and 7.1

> - .config

defconfig
and defconfig+

arch:
- arm64
- x86_64

> - compiler / compiler flags if any
gcc-11, gcc-12 and clang-15 and clang-nightly

It is always reproducible on Qemu versions 5.2 and 7.1

qemu-system-x86, installed at version: 1:5.2+dfsg-9~bpo10+1, host
architecture: amd64
qemu-system-arm, installed at version: 1:7.1+dfsg-2~bpo11+3, host
architecture: amd64

qemu command line:

Boot command:
/usr/bin/qemu-system-x86_64
-cpu host
-enable-kvm
-nographic
-net nic,model=virtio,macaddr=DE:AD:BE:EF:66:38
-net tap
-m 1024
-monitor none
-kernel kernel/bzImage
--append "root=/dev/sda rootwait console=ttyS0,115200"
-hda lkft-console-image-intel-core2-32-20221124230054.rootfs.ext4
-m 4096
-smp 4
-nographic
-drive format=qcow2,file=lava-guest.qcow2,media=disk,if=virtio,id=lavatest

metadata:
git_ref: master
git_repo: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next
git_sha: e45fb347b630ee76482fe938ba76cf8eab811290
git_describe: next-20221220
kernel_version: 6.1.0
kernel-config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2J9kbUD3iq8BS20NJ72fUupVavd/config
build-url: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next/-/pipelines/727258165
artifact-location:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2J9kbUD3iq8BS20NJ72fUupVavd
toolchain: gcc-11
build_name: gcc-11-lkftconfig


Test job running with qemu 5.2
https://lkft.validation.linaro.org/scheduler/job/5978795#L548

Test job running with qemu 7.2
https://lkft.validation.linaro.org/scheduler/job/5979229#L422

>
> Thanks!
>
> --
> MST

- Naresh

2022-12-20 11:16:28

by Naresh Kamboju

[permalink] [raw]
Subject: Re: next: kernel BUG at drivers/virtio/virtio.c:122!

On Tue, 20 Dec 2022 at 16:04, Xuan Zhuo <[email protected]> wrote:
>
> On Tue, 20 Dec 2022 14:51:54 +0530, Naresh Kamboju <[email protected]> wrote:
> > The qemu-x86_64 and qemu-arm64 boot failed with Linux next-20221220 tag.
> > It is always reproducible with gcc-11/ gcc-12 and clang tool chains.
> >
> > Reported-by: Linux Kernel Functional Testing <[email protected]>
> >
> > <6>[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
> > <5>[ 0.000000] Linux version 6.1.0-next-20221220 (tuxmake@tuxmake)
> > (Debian clang version 16.0.0
> > (++20221218072110+9c1b82599dac-1~exp1~20221218072217.501), Debian LLD
> > 16.0.0) #1 SMP PREEMPT @1671498176
> > <5>[ 0.000000] random: crng init done
> > <6>[ 0.000000] Machine model: linux,dummy-virt
> > ....
> > <6>[ 3.571098] loop: module loaded
> > <6>[ 3.573410] virtio_blk virtio0: 1/0/0 default/read/poll queues
> > <5>[ 3.578816] virtio_blk virtio0: [vda] 2816420 512-byte logical
> > blocks (1.44 GB/1.34 GiB)
> > <4>[ 3.581234] ------------[ cut here ]------------
> > <2>[ 3.581595] kernel BUG at drivers/virtio/virtio.c:122!
> > <0>[ 3.582906] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
> > <4>[ 3.583672] Modules linked in:
> > <4>[ 3.584905] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
> > 6.1.0-next-20221220 #1
> > <4>[ 3.585801] Hardware name: linux,dummy-virt (DT)
> > <4>[ 3.586591] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT
> > -SSBS BTYPE=--)
> > <4>[ 3.587349] pc : virtio_check_driver_offered_feature+0x60/0x6c
> > <4>[ 3.588613] lr : virtblk_probe+0x7cc/0x8f0
> > <4>[ 3.588915] sp : ffff80000802b840
> > <4>[ 3.589314] x29: ffff80000802b850 x28: 0000000000000000 x27:
> > 0000000000000001
> > <4>[ 3.590509] x26: 0000000000000001 x25: 0000000000000200 x24:
> > ffff0000c1699b00
> > <4>[ 3.590832] x23: 00000000000000fe x22: ffff0000c0313c30 x21:
> > ffff0000c0313c00
> > <4>[ 3.591568] x20: ffff0000c02f4080 x19: 0000000000000000 x18:
> > ffffffffffffffff
> > <4>[ 3.592056] x17: 00000000ffffffea x16: 00000000fffffffe x15:
> > 0000000000000004
> > <4>[ 3.592632] x14: 0000000000000fff x13: ffff800008028000 x12:
> > ffff80000802c000
> > <4>[ 3.593157] x11: 000000000000000f x10: 000000000000000f x9 :
> > ffffae66eee314d8
> > <4>[ 3.594048] x8 : 0000000000000000 x7 : 3631383837352e33 x6 :
> > 202020205b3e353c
> > <4>[ 3.594429] x5 : 0000000000000001 x4 : 0000000000000000 x3 :
> > ffff80000802b780
> > <4>[ 3.594956] x2 : ffff80000802b6f8 x1 : 0000000000000011 x0 :
> > ffff0000c02f4080
> > <4>[ 3.595811] Call trace:
> > <4>[ 3.596120] virtio_check_driver_offered_feature+0x60/0x6c
> > <4>[ 3.596632] virtio_dev_probe+0x274/0x320
> > <4>[ 3.597064] really_probe+0x178/0x418
> > <4>[ 3.597547] __driver_probe_device+0x120/0x188
> > <4>[ 3.597820] driver_probe_device+0x48/0x22c
> > <4>[ 3.598189] __driver_attach+0xf8/0x250
> > <4>[ 3.598656] bus_for_each_dev+0x8c/0xd8
> > <4>[ 3.599151] driver_attach+0x30/0x3c
> > <4>[ 3.599321] bus_add_driver+0x11c/0x22c
> > <4>[ 3.599684] driver_register+0x84/0x120
> > <4>[ 3.600175] register_virtio_driver+0x38/0x48
> > <4>[ 3.600575] virtio_blk_init+0x6c/0xb4
> > <4>[ 3.600759] do_one_initcall+0xe0/0x2f8
> > <4>[ 3.601197] do_initcall_level+0xa8/0x150
> > <4>[ 3.601703] do_initcalls+0x60/0xa0
> > <4>[ 3.601892] do_basic_setup+0x28/0x34
> > <4>[ 3.602229] kernel_init_freeable+0x100/0x178
> > <4>[ 3.602706] kernel_init+0x2c/0x1b4
> > <4>[ 3.603162] ret_from_fork+0x10/0x20
> > <0>[ 3.604398] Code: 540000a0 91001129 f1000508 54ffff61 (d4210000)
> > <4>[ 3.606108] ---[ end trace 0000000000000000 ]---
> > <6>[ 3.606714] note: swapper/0[1] exited with preempt_count 1
> > <0>[ 3.608155] Kernel panic - not syncing: Attempted to kill init!
> > exitcode=0x0000000b
> > <2>[ 3.609173] SMP: stopping secondary CPUs
> > <0>[ 3.610506] Kernel Offset: 0x2e66e4800000 from 0xffff800008000000
> > <0>[ 3.610970] PHYS_OFFSET: 0x40000000
> > <0>[ 3.611428] CPU features: 0x00000,003a612f,cd22773f
> > <0>[ 3.612277] Memory Limit: none
> > <0>[ 3.613192] ---[ end Kernel panic - not syncing: Attempted to
> > kill init! exitcode=0x0000000b ]---
> >
> > Ref Links,
> > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13764099/suite/log-parser-test/test/check-kernel-bug/details/
> > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13766814/suite/boot/test/clang-nightly-lkftconfig/details/
> > https://storage.tuxsuite.com/public/linaro/lkft/builds/2J9l3qxSBmPWVa1S2uWn0Xuwl1J/config
> >
>
>
> I think there is a bug, VIRTIO_BLK_F_ZONED depends the CONFIG_BLK_DEV_ZONE, but
> checking its code in virtblk_probe does not depend on this config.

I see this in my config,
# CONFIG_BLK_DEV_ZONED is not set

>
> This option in your config file is indeed not opened.
>
> static int virtblk_probe(struct virtio_device *vdev){
> .....
> virtblk_update_capacity(vblk, false);
> virtio_device_ready(vdev);
>
> if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
> err = virtblk_probe_zoned_device(vdev, vblk, q);
> if (err)
> goto out_cleanup_disk;
> }
>
> dev_info(&vdev->dev, "blk config size: %zu\n",
> sizeof(struct virtio_blk_config));
>
> ....
>
> static unsigned int features[] = {
> VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, VIRTIO_BLK_F_GEOMETRY,
> VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
> VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
> VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
> VIRTIO_BLK_F_SECURE_ERASE, VIRTIO_BLK_F_LIFETIME,
> #ifdef CONFIG_BLK_DEV_ZONED
> VIRTIO_BLK_F_ZONED,
> #endif /* CONFIG_BLK_DEV_ZONED */
> }

I have attached config files to this email.

>
> Thanks.
>
>
> >
> > --
> > Linaro LKFT
> > https://lkft.linaro.org


Attachments:
arm64-linux-next-20221220.config (271.48 kB)
x86-linux-next-20221220.config (168.55 kB)
Download all attachments

2022-12-20 11:20:43

by Anders Roxell

[permalink] [raw]
Subject: Re: next: kernel BUG at drivers/virtio/virtio.c:122!

On Tue, 20 Dec 2022 at 11:54, Michael S. Tsirkin <[email protected]> wrote:
>
> On Tue, Dec 20, 2022 at 06:27:59PM +0800, Xuan Zhuo wrote:
> > On Tue, 20 Dec 2022 14:51:54 +0530, Naresh Kamboju <[email protected]> wrote:
> > > The qemu-x86_64 and qemu-arm64 boot failed with Linux next-20221220 tag.
> > > It is always reproducible with gcc-11/ gcc-12 and clang tool chains.
> > >
> > > Reported-by: Linux Kernel Functional Testing <[email protected]>

Thank you for the quick fix.

Tested-by: Anders Roxell <[email protected]>

Cheers,
Anders

> > >
> > > <6>[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
> > > <5>[ 0.000000] Linux version 6.1.0-next-20221220 (tuxmake@tuxmake)
> > > (Debian clang version 16.0.0
> > > (++20221218072110+9c1b82599dac-1~exp1~20221218072217.501), Debian LLD
> > > 16.0.0) #1 SMP PREEMPT @1671498176
> > > <5>[ 0.000000] random: crng init done
> > > <6>[ 0.000000] Machine model: linux,dummy-virt
> > > ....
> > > <6>[ 3.571098] loop: module loaded
> > > <6>[ 3.573410] virtio_blk virtio0: 1/0/0 default/read/poll queues
> > > <5>[ 3.578816] virtio_blk virtio0: [vda] 2816420 512-byte logical
> > > blocks (1.44 GB/1.34 GiB)
> > > <4>[ 3.581234] ------------[ cut here ]------------
> > > <2>[ 3.581595] kernel BUG at drivers/virtio/virtio.c:122!
> > > <0>[ 3.582906] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
> > > <4>[ 3.583672] Modules linked in:
> > > <4>[ 3.584905] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
> > > 6.1.0-next-20221220 #1
> > > <4>[ 3.585801] Hardware name: linux,dummy-virt (DT)
> > > <4>[ 3.586591] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT
> > > -SSBS BTYPE=--)
> > > <4>[ 3.587349] pc : virtio_check_driver_offered_feature+0x60/0x6c
> > > <4>[ 3.588613] lr : virtblk_probe+0x7cc/0x8f0
> > > <4>[ 3.588915] sp : ffff80000802b840
> > > <4>[ 3.589314] x29: ffff80000802b850 x28: 0000000000000000 x27:
> > > 0000000000000001
> > > <4>[ 3.590509] x26: 0000000000000001 x25: 0000000000000200 x24:
> > > ffff0000c1699b00
> > > <4>[ 3.590832] x23: 00000000000000fe x22: ffff0000c0313c30 x21:
> > > ffff0000c0313c00
> > > <4>[ 3.591568] x20: ffff0000c02f4080 x19: 0000000000000000 x18:
> > > ffffffffffffffff
> > > <4>[ 3.592056] x17: 00000000ffffffea x16: 00000000fffffffe x15:
> > > 0000000000000004
> > > <4>[ 3.592632] x14: 0000000000000fff x13: ffff800008028000 x12:
> > > ffff80000802c000
> > > <4>[ 3.593157] x11: 000000000000000f x10: 000000000000000f x9 :
> > > ffffae66eee314d8
> > > <4>[ 3.594048] x8 : 0000000000000000 x7 : 3631383837352e33 x6 :
> > > 202020205b3e353c
> > > <4>[ 3.594429] x5 : 0000000000000001 x4 : 0000000000000000 x3 :
> > > ffff80000802b780
> > > <4>[ 3.594956] x2 : ffff80000802b6f8 x1 : 0000000000000011 x0 :
> > > ffff0000c02f4080
> > > <4>[ 3.595811] Call trace:
> > > <4>[ 3.596120] virtio_check_driver_offered_feature+0x60/0x6c
> > > <4>[ 3.596632] virtio_dev_probe+0x274/0x320
> > > <4>[ 3.597064] really_probe+0x178/0x418
> > > <4>[ 3.597547] __driver_probe_device+0x120/0x188
> > > <4>[ 3.597820] driver_probe_device+0x48/0x22c
> > > <4>[ 3.598189] __driver_attach+0xf8/0x250
> > > <4>[ 3.598656] bus_for_each_dev+0x8c/0xd8
> > > <4>[ 3.599151] driver_attach+0x30/0x3c
> > > <4>[ 3.599321] bus_add_driver+0x11c/0x22c
> > > <4>[ 3.599684] driver_register+0x84/0x120
> > > <4>[ 3.600175] register_virtio_driver+0x38/0x48
> > > <4>[ 3.600575] virtio_blk_init+0x6c/0xb4
> > > <4>[ 3.600759] do_one_initcall+0xe0/0x2f8
> > > <4>[ 3.601197] do_initcall_level+0xa8/0x150
> > > <4>[ 3.601703] do_initcalls+0x60/0xa0
> > > <4>[ 3.601892] do_basic_setup+0x28/0x34
> > > <4>[ 3.602229] kernel_init_freeable+0x100/0x178
> > > <4>[ 3.602706] kernel_init+0x2c/0x1b4
> > > <4>[ 3.603162] ret_from_fork+0x10/0x20
> > > <0>[ 3.604398] Code: 540000a0 91001129 f1000508 54ffff61 (d4210000)
> > > <4>[ 3.606108] ---[ end trace 0000000000000000 ]---
> > > <6>[ 3.606714] note: swapper/0[1] exited with preempt_count 1
> > > <0>[ 3.608155] Kernel panic - not syncing: Attempted to kill init!
> > > exitcode=0x0000000b
> > > <2>[ 3.609173] SMP: stopping secondary CPUs
> > > <0>[ 3.610506] Kernel Offset: 0x2e66e4800000 from 0xffff800008000000
> > > <0>[ 3.610970] PHYS_OFFSET: 0x40000000
> > > <0>[ 3.611428] CPU features: 0x00000,003a612f,cd22773f
> > > <0>[ 3.612277] Memory Limit: none
> > > <0>[ 3.613192] ---[ end Kernel panic - not syncing: Attempted to
> > > kill init! exitcode=0x0000000b ]---
> > >
> > > Ref Links,
> > > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13764099/suite/log-parser-test/test/check-kernel-bug/details/
> > > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13766814/suite/boot/test/clang-nightly-lkftconfig/details/
> > > https://storage.tuxsuite.com/public/linaro/lkft/builds/2J9l3qxSBmPWVa1S2uWn0Xuwl1J/config
> > >
> >
> >
> > I think there is a bug, VIRTIO_BLK_F_ZONED depends the CONFIG_BLK_DEV_ZONE, but
> > checking its code in virtblk_probe does not depend on this config.
> >
> > This option in your config file is indeed not opened.
> >
> >
> > static int virtblk_probe(struct virtio_device *vdev){
> > .....
> > virtblk_update_capacity(vblk, false);
> > virtio_device_ready(vdev);
> >
> > if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
> > err = virtblk_probe_zoned_device(vdev, vblk, q);
> > if (err)
> > goto out_cleanup_disk;
> > }
> >
> > dev_info(&vdev->dev, "blk config size: %zu\n",
> > sizeof(struct virtio_blk_config));
> >
> > ....
> >
> > static unsigned int features[] = {
> > VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, VIRTIO_BLK_F_GEOMETRY,
> > VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
> > VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
> > VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
> > VIRTIO_BLK_F_SECURE_ERASE, VIRTIO_BLK_F_LIFETIME,
> > #ifdef CONFIG_BLK_DEV_ZONED
> > VIRTIO_BLK_F_ZONED,
> > #endif /* CONFIG_BLK_DEV_ZONED */
> > }
> >
> >
> > Thanks.
>
> Oh you are right, I wanted to test it so of course I enabled it.
>
> Testing this fixup now:
>
> commit f9503d0fd839b59e0f48b00c20635437c41420ed
> Author: Michael S. Tsirkin <[email protected]>
> Date: Tue Dec 20 05:53:41 2022 -0500
>
> fixup! virtio-blk: add support for zoned block devices
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index ff49052e26f7..d8cdaeb51d1c 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -775,6 +775,10 @@ static int virtblk_probe_zoned_device(struct virtio_device *vdev,
> return ret;
> }
>
> +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> +{
> + return virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED);
> +}
> #else
>
> /*
> @@ -790,6 +794,11 @@ static inline int virtblk_probe_zoned_device(struct virtio_device *vdev,
> {
> return -EOPNOTSUPP;
> }
> +
> +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> +{
> + return false;
> +}
> #endif /* CONFIG_BLK_DEV_ZONED */
>
> /* return id (s/n) string for *disk to *id_str
> @@ -1576,11 +1585,11 @@ static int virtblk_probe(struct virtio_device *vdev)
> else
> q->limits.discard_granularity = blk_size;
> }
>
> virtblk_update_capacity(vblk, false);
> virtio_device_ready(vdev);
>
> - if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
> + if (virtblk_has_zoned_feature(vdev)) {
> err = virtblk_probe_zoned_device(vdev, vblk, q);
> if (err)
> goto out_cleanup_disk;
> --
> MST
>

2022-12-20 13:42:48

by Michael S. Tsirkin

[permalink] [raw]
Subject: Re: next: kernel BUG at drivers/virtio/virtio.c:122!

On Tue, Dec 20, 2022 at 02:17:45PM +0100, Marek Szyprowski wrote:
> On 20.12.2022 11:54, Michael S. Tsirkin wrote:
> > On Tue, Dec 20, 2022 at 06:27:59PM +0800, Xuan Zhuo wrote:
> >> On Tue, 20 Dec 2022 14:51:54 +0530, Naresh Kamboju <[email protected]> wrote:
> >>> The qemu-x86_64 and qemu-arm64 boot failed with Linux next-20221220 tag.
> >>> It is always reproducible with gcc-11/ gcc-12 and clang tool chains.
> >>>
> >>> Reported-by: Linux Kernel Functional Testing <[email protected]>
> >>>
> >>> <6>[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
> >>> <5>[ 0.000000] Linux version 6.1.0-next-20221220 (tuxmake@tuxmake)
> >>> (Debian clang version 16.0.0
> >>> (++20221218072110+9c1b82599dac-1~exp1~20221218072217.501), Debian LLD
> >>> 16.0.0) #1 SMP PREEMPT @1671498176
> >>> <5>[ 0.000000] random: crng init done
> >>> <6>[ 0.000000] Machine model: linux,dummy-virt
> >>> ....
> >>> <6>[ 3.571098] loop: module loaded
> >>> <6>[ 3.573410] virtio_blk virtio0: 1/0/0 default/read/poll queues
> >>> <5>[ 3.578816] virtio_blk virtio0: [vda] 2816420 512-byte logical
> >>> blocks (1.44 GB/1.34 GiB)
> >>> <4>[ 3.581234] ------------[ cut here ]------------
> >>> <2>[ 3.581595] kernel BUG at drivers/virtio/virtio.c:122!
> >>> <0>[ 3.582906] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
> >>> <4>[ 3.583672] Modules linked in:
> >>> <4>[ 3.584905] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
> >>> 6.1.0-next-20221220 #1
> >>> <4>[ 3.585801] Hardware name: linux,dummy-virt (DT)
> >>> <4>[ 3.586591] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT
> >>> -SSBS BTYPE=--)
> >>> <4>[ 3.587349] pc : virtio_check_driver_offered_feature+0x60/0x6c
> >>> <4>[ 3.588613] lr : virtblk_probe+0x7cc/0x8f0
> >>> <4>[ 3.588915] sp : ffff80000802b840
> >>> <4>[ 3.589314] x29: ffff80000802b850 x28: 0000000000000000 x27:
> >>> 0000000000000001
> >>> <4>[ 3.590509] x26: 0000000000000001 x25: 0000000000000200 x24:
> >>> ffff0000c1699b00
> >>> <4>[ 3.590832] x23: 00000000000000fe x22: ffff0000c0313c30 x21:
> >>> ffff0000c0313c00
> >>> <4>[ 3.591568] x20: ffff0000c02f4080 x19: 0000000000000000 x18:
> >>> ffffffffffffffff
> >>> <4>[ 3.592056] x17: 00000000ffffffea x16: 00000000fffffffe x15:
> >>> 0000000000000004
> >>> <4>[ 3.592632] x14: 0000000000000fff x13: ffff800008028000 x12:
> >>> ffff80000802c000
> >>> <4>[ 3.593157] x11: 000000000000000f x10: 000000000000000f x9 :
> >>> ffffae66eee314d8
> >>> <4>[ 3.594048] x8 : 0000000000000000 x7 : 3631383837352e33 x6 :
> >>> 202020205b3e353c
> >>> <4>[ 3.594429] x5 : 0000000000000001 x4 : 0000000000000000 x3 :
> >>> ffff80000802b780
> >>> <4>[ 3.594956] x2 : ffff80000802b6f8 x1 : 0000000000000011 x0 :
> >>> ffff0000c02f4080
> >>> <4>[ 3.595811] Call trace:
> >>> <4>[ 3.596120] virtio_check_driver_offered_feature+0x60/0x6c
> >>> <4>[ 3.596632] virtio_dev_probe+0x274/0x320
> >>> <4>[ 3.597064] really_probe+0x178/0x418
> >>> <4>[ 3.597547] __driver_probe_device+0x120/0x188
> >>> <4>[ 3.597820] driver_probe_device+0x48/0x22c
> >>> <4>[ 3.598189] __driver_attach+0xf8/0x250
> >>> <4>[ 3.598656] bus_for_each_dev+0x8c/0xd8
> >>> <4>[ 3.599151] driver_attach+0x30/0x3c
> >>> <4>[ 3.599321] bus_add_driver+0x11c/0x22c
> >>> <4>[ 3.599684] driver_register+0x84/0x120
> >>> <4>[ 3.600175] register_virtio_driver+0x38/0x48
> >>> <4>[ 3.600575] virtio_blk_init+0x6c/0xb4
> >>> <4>[ 3.600759] do_one_initcall+0xe0/0x2f8
> >>> <4>[ 3.601197] do_initcall_level+0xa8/0x150
> >>> <4>[ 3.601703] do_initcalls+0x60/0xa0
> >>> <4>[ 3.601892] do_basic_setup+0x28/0x34
> >>> <4>[ 3.602229] kernel_init_freeable+0x100/0x178
> >>> <4>[ 3.602706] kernel_init+0x2c/0x1b4
> >>> <4>[ 3.603162] ret_from_fork+0x10/0x20
> >>> <0>[ 3.604398] Code: 540000a0 91001129 f1000508 54ffff61 (d4210000)
> >>> <4>[ 3.606108] ---[ end trace 0000000000000000 ]---
> >>> <6>[ 3.606714] note: swapper/0[1] exited with preempt_count 1
> >>> <0>[ 3.608155] Kernel panic - not syncing: Attempted to kill init!
> >>> exitcode=0x0000000b
> >>> <2>[ 3.609173] SMP: stopping secondary CPUs
> >>> <0>[ 3.610506] Kernel Offset: 0x2e66e4800000 from 0xffff800008000000
> >>> <0>[ 3.610970] PHYS_OFFSET: 0x40000000
> >>> <0>[ 3.611428] CPU features: 0x00000,003a612f,cd22773f
> >>> <0>[ 3.612277] Memory Limit: none
> >>> <0>[ 3.613192] ---[ end Kernel panic - not syncing: Attempted to
> >>> kill init! exitcode=0x0000000b ]---
> >>>
> >>> Ref Links,
> >>> https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13764099/suite/log-parser-test/test/check-kernel-bug/details/
> >>> https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13766814/suite/boot/test/clang-nightly-lkftconfig/details/
> >>> https://storage.tuxsuite.com/public/linaro/lkft/builds/2J9l3qxSBmPWVa1S2uWn0Xuwl1J/config
> >>>
> >>
> >> I think there is a bug, VIRTIO_BLK_F_ZONED depends the CONFIG_BLK_DEV_ZONE, but
> >> checking its code in virtblk_probe does not depend on this config.
> >>
> >> This option in your config file is indeed not opened.
> >>
> >>
> >> static int virtblk_probe(struct virtio_device *vdev){
> >> .....
> >> virtblk_update_capacity(vblk, false);
> >> virtio_device_ready(vdev);
> >>
> >> if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
> >> err = virtblk_probe_zoned_device(vdev, vblk, q);
> >> if (err)
> >> goto out_cleanup_disk;
> >> }
> >>
> >> dev_info(&vdev->dev, "blk config size: %zu\n",
> >> sizeof(struct virtio_blk_config));
> >>
> >> ....
> >>
> >> static unsigned int features[] = {
> >> VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, VIRTIO_BLK_F_GEOMETRY,
> >> VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
> >> VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
> >> VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
> >> VIRTIO_BLK_F_SECURE_ERASE, VIRTIO_BLK_F_LIFETIME,
> >> #ifdef CONFIG_BLK_DEV_ZONED
> >> VIRTIO_BLK_F_ZONED,
> >> #endif /* CONFIG_BLK_DEV_ZONED */
> >> }
> >>
> >>
> >> Thanks.
> > Oh you are right, I wanted to test it so of course I enabled it.
> >
> > Testing this fixup now:
> >
> > commit f9503d0fd839b59e0f48b00c20635437c41420ed
> > Author: Michael S. Tsirkin <[email protected]>
> > Date: Tue Dec 20 05:53:41 2022 -0500
> >
> > fixup! virtio-blk: add support for zoned block devices
>
> I also confirm that this patch fixes the issue with broken virtio block
> device observed on QEMU arm/arm64 'virt' machines and linux
> next-20221220. Thanks for the fix!
>
> Tested-by: Marek Szyprowski <[email protected]>

Merged the fix already so I'm not sure I can add this tag.
If I rebase before pull request I will, thanks!

> > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> > index ff49052e26f7..d8cdaeb51d1c 100644
> > --- a/drivers/block/virtio_blk.c
> > +++ b/drivers/block/virtio_blk.c
> > @@ -775,6 +775,10 @@ static int virtblk_probe_zoned_device(struct virtio_device *vdev,
> > return ret;
> > }
> >
> > +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> > +{
> > + return virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED);
> > +}
> > #else
> >
> > /*
> > @@ -790,6 +794,11 @@ static inline int virtblk_probe_zoned_device(struct virtio_device *vdev,
> > {
> > return -EOPNOTSUPP;
> > }
> > +
> > +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> > +{
> > + return false;
> > +}
> > #endif /* CONFIG_BLK_DEV_ZONED */
> >
> > /* return id (s/n) string for *disk to *id_str
> > @@ -1576,11 +1585,11 @@ static int virtblk_probe(struct virtio_device *vdev)
> > else
> > q->limits.discard_granularity = blk_size;
> > }
> >
> > virtblk_update_capacity(vblk, false);
> > virtio_device_ready(vdev);
> >
> > - if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
> > + if (virtblk_has_zoned_feature(vdev)) {
> > err = virtblk_probe_zoned_device(vdev, vblk, q);
> > if (err)
> > goto out_cleanup_disk;
>
> Best regards
> --
> Marek Szyprowski, PhD
> Samsung R&D Institute Poland

2022-12-20 13:43:41

by Marek Szyprowski

[permalink] [raw]
Subject: Re: next: kernel BUG at drivers/virtio/virtio.c:122!

On 20.12.2022 11:54, Michael S. Tsirkin wrote:
> On Tue, Dec 20, 2022 at 06:27:59PM +0800, Xuan Zhuo wrote:
>> On Tue, 20 Dec 2022 14:51:54 +0530, Naresh Kamboju <[email protected]> wrote:
>>> The qemu-x86_64 and qemu-arm64 boot failed with Linux next-20221220 tag.
>>> It is always reproducible with gcc-11/ gcc-12 and clang tool chains.
>>>
>>> Reported-by: Linux Kernel Functional Testing <[email protected]>
>>>
>>> <6>[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
>>> <5>[ 0.000000] Linux version 6.1.0-next-20221220 (tuxmake@tuxmake)
>>> (Debian clang version 16.0.0
>>> (++20221218072110+9c1b82599dac-1~exp1~20221218072217.501), Debian LLD
>>> 16.0.0) #1 SMP PREEMPT @1671498176
>>> <5>[ 0.000000] random: crng init done
>>> <6>[ 0.000000] Machine model: linux,dummy-virt
>>> ....
>>> <6>[ 3.571098] loop: module loaded
>>> <6>[ 3.573410] virtio_blk virtio0: 1/0/0 default/read/poll queues
>>> <5>[ 3.578816] virtio_blk virtio0: [vda] 2816420 512-byte logical
>>> blocks (1.44 GB/1.34 GiB)
>>> <4>[ 3.581234] ------------[ cut here ]------------
>>> <2>[ 3.581595] kernel BUG at drivers/virtio/virtio.c:122!
>>> <0>[ 3.582906] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
>>> <4>[ 3.583672] Modules linked in:
>>> <4>[ 3.584905] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
>>> 6.1.0-next-20221220 #1
>>> <4>[ 3.585801] Hardware name: linux,dummy-virt (DT)
>>> <4>[ 3.586591] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT
>>> -SSBS BTYPE=--)
>>> <4>[ 3.587349] pc : virtio_check_driver_offered_feature+0x60/0x6c
>>> <4>[ 3.588613] lr : virtblk_probe+0x7cc/0x8f0
>>> <4>[ 3.588915] sp : ffff80000802b840
>>> <4>[ 3.589314] x29: ffff80000802b850 x28: 0000000000000000 x27:
>>> 0000000000000001
>>> <4>[ 3.590509] x26: 0000000000000001 x25: 0000000000000200 x24:
>>> ffff0000c1699b00
>>> <4>[ 3.590832] x23: 00000000000000fe x22: ffff0000c0313c30 x21:
>>> ffff0000c0313c00
>>> <4>[ 3.591568] x20: ffff0000c02f4080 x19: 0000000000000000 x18:
>>> ffffffffffffffff
>>> <4>[ 3.592056] x17: 00000000ffffffea x16: 00000000fffffffe x15:
>>> 0000000000000004
>>> <4>[ 3.592632] x14: 0000000000000fff x13: ffff800008028000 x12:
>>> ffff80000802c000
>>> <4>[ 3.593157] x11: 000000000000000f x10: 000000000000000f x9 :
>>> ffffae66eee314d8
>>> <4>[ 3.594048] x8 : 0000000000000000 x7 : 3631383837352e33 x6 :
>>> 202020205b3e353c
>>> <4>[ 3.594429] x5 : 0000000000000001 x4 : 0000000000000000 x3 :
>>> ffff80000802b780
>>> <4>[ 3.594956] x2 : ffff80000802b6f8 x1 : 0000000000000011 x0 :
>>> ffff0000c02f4080
>>> <4>[ 3.595811] Call trace:
>>> <4>[ 3.596120] virtio_check_driver_offered_feature+0x60/0x6c
>>> <4>[ 3.596632] virtio_dev_probe+0x274/0x320
>>> <4>[ 3.597064] really_probe+0x178/0x418
>>> <4>[ 3.597547] __driver_probe_device+0x120/0x188
>>> <4>[ 3.597820] driver_probe_device+0x48/0x22c
>>> <4>[ 3.598189] __driver_attach+0xf8/0x250
>>> <4>[ 3.598656] bus_for_each_dev+0x8c/0xd8
>>> <4>[ 3.599151] driver_attach+0x30/0x3c
>>> <4>[ 3.599321] bus_add_driver+0x11c/0x22c
>>> <4>[ 3.599684] driver_register+0x84/0x120
>>> <4>[ 3.600175] register_virtio_driver+0x38/0x48
>>> <4>[ 3.600575] virtio_blk_init+0x6c/0xb4
>>> <4>[ 3.600759] do_one_initcall+0xe0/0x2f8
>>> <4>[ 3.601197] do_initcall_level+0xa8/0x150
>>> <4>[ 3.601703] do_initcalls+0x60/0xa0
>>> <4>[ 3.601892] do_basic_setup+0x28/0x34
>>> <4>[ 3.602229] kernel_init_freeable+0x100/0x178
>>> <4>[ 3.602706] kernel_init+0x2c/0x1b4
>>> <4>[ 3.603162] ret_from_fork+0x10/0x20
>>> <0>[ 3.604398] Code: 540000a0 91001129 f1000508 54ffff61 (d4210000)
>>> <4>[ 3.606108] ---[ end trace 0000000000000000 ]---
>>> <6>[ 3.606714] note: swapper/0[1] exited with preempt_count 1
>>> <0>[ 3.608155] Kernel panic - not syncing: Attempted to kill init!
>>> exitcode=0x0000000b
>>> <2>[ 3.609173] SMP: stopping secondary CPUs
>>> <0>[ 3.610506] Kernel Offset: 0x2e66e4800000 from 0xffff800008000000
>>> <0>[ 3.610970] PHYS_OFFSET: 0x40000000
>>> <0>[ 3.611428] CPU features: 0x00000,003a612f,cd22773f
>>> <0>[ 3.612277] Memory Limit: none
>>> <0>[ 3.613192] ---[ end Kernel panic - not syncing: Attempted to
>>> kill init! exitcode=0x0000000b ]---
>>>
>>> Ref Links,
>>> https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13764099/suite/log-parser-test/test/check-kernel-bug/details/
>>> https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20221220/testrun/13766814/suite/boot/test/clang-nightly-lkftconfig/details/
>>> https://storage.tuxsuite.com/public/linaro/lkft/builds/2J9l3qxSBmPWVa1S2uWn0Xuwl1J/config
>>>
>>
>> I think there is a bug, VIRTIO_BLK_F_ZONED depends the CONFIG_BLK_DEV_ZONE, but
>> checking its code in virtblk_probe does not depend on this config.
>>
>> This option in your config file is indeed not opened.
>>
>>
>> static int virtblk_probe(struct virtio_device *vdev){
>> .....
>> virtblk_update_capacity(vblk, false);
>> virtio_device_ready(vdev);
>>
>> if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
>> err = virtblk_probe_zoned_device(vdev, vblk, q);
>> if (err)
>> goto out_cleanup_disk;
>> }
>>
>> dev_info(&vdev->dev, "blk config size: %zu\n",
>> sizeof(struct virtio_blk_config));
>>
>> ....
>>
>> static unsigned int features[] = {
>> VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, VIRTIO_BLK_F_GEOMETRY,
>> VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
>> VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
>> VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
>> VIRTIO_BLK_F_SECURE_ERASE, VIRTIO_BLK_F_LIFETIME,
>> #ifdef CONFIG_BLK_DEV_ZONED
>> VIRTIO_BLK_F_ZONED,
>> #endif /* CONFIG_BLK_DEV_ZONED */
>> }
>>
>>
>> Thanks.
> Oh you are right, I wanted to test it so of course I enabled it.
>
> Testing this fixup now:
>
> commit f9503d0fd839b59e0f48b00c20635437c41420ed
> Author: Michael S. Tsirkin <[email protected]>
> Date: Tue Dec 20 05:53:41 2022 -0500
>
> fixup! virtio-blk: add support for zoned block devices

I also confirm that this patch fixes the issue with broken virtio block
device observed on QEMU arm/arm64 'virt' machines and linux
next-20221220. Thanks for the fix!

Tested-by: Marek Szyprowski <[email protected]>

> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index ff49052e26f7..d8cdaeb51d1c 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -775,6 +775,10 @@ static int virtblk_probe_zoned_device(struct virtio_device *vdev,
> return ret;
> }
>
> +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> +{
> + return virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED);
> +}
> #else
>
> /*
> @@ -790,6 +794,11 @@ static inline int virtblk_probe_zoned_device(struct virtio_device *vdev,
> {
> return -EOPNOTSUPP;
> }
> +
> +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> +{
> + return false;
> +}
> #endif /* CONFIG_BLK_DEV_ZONED */
>
> /* return id (s/n) string for *disk to *id_str
> @@ -1576,11 +1585,11 @@ static int virtblk_probe(struct virtio_device *vdev)
> else
> q->limits.discard_granularity = blk_size;
> }
>
> virtblk_update_capacity(vblk, false);
> virtio_device_ready(vdev);
>
> - if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
> + if (virtblk_has_zoned_feature(vdev)) {
> err = virtblk_probe_zoned_device(vdev, vblk, q);
> if (err)
> goto out_cleanup_disk;

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

2022-12-20 14:06:49

by Naresh Kamboju

[permalink] [raw]
Subject: Re: next: kernel BUG at drivers/virtio/virtio.c:122!

On Tue, 20 Dec 2022 at 18:56, Michael S. Tsirkin <[email protected]> wrote:
>
> On Tue, Dec 20, 2022 at 02:17:45PM +0100, Marek Szyprowski wrote:
> > On 20.12.2022 11:54, Michael S. Tsirkin wrote:
> > > On Tue, Dec 20, 2022 at 06:27:59PM +0800, Xuan Zhuo wrote:
> > >> On Tue, 20 Dec 2022 14:51:54 +0530, Naresh Kamboju <[email protected]> wrote:
> > >>> The qemu-x86_64 and qemu-arm64 boot failed with Linux next-20221220 tag.
> > >>> It is always reproducible with gcc-11/ gcc-12 and clang tool chains.
> > >>>
> > >>> Reported-by: Linux Kernel Functional Testing <[email protected]>
> > >>>
> > >>> <6>[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510]
> > >>> <5>[ 0.000000] Linux version 6.1.0-next-20221220 (tuxmake@tuxmake)
> > >>> (Debian clang version 16.0.0
> > >>> (++20221218072110+9c1b82599dac-1~exp1~20221218072217.501), Debian LLD
> > >>> 16.0.0) #1 SMP PREEMPT @1671498176
> > >>> <5>[ 0.000000] random: crng init done
> > >>> <6>[ 0.000000] Machine model: linux,dummy-virt
> > >>> ....
> > >>> <6>[ 3.571098] loop: module loaded
> > >>> <6>[ 3.573410] virtio_blk virtio0: 1/0/0 default/read/poll queues
> > >>> <5>[ 3.578816] virtio_blk virtio0: [vda] 2816420 512-byte logical
> > >>> blocks (1.44 GB/1.34 GiB)
> > >>> <4>[ 3.581234] ------------[ cut here ]------------
> > >>> <2>[ 3.581595] kernel BUG at drivers/virtio/virtio.c:122!
> > >>> <0>[ 3.582906] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP

<Trim>

> > > Testing this fixup now:

Thanks for providing a quick fix.

> > > commit f9503d0fd839b59e0f48b00c20635437c41420ed
> > > Author: Michael S. Tsirkin <[email protected]>
> > > Date: Tue Dec 20 05:53:41 2022 -0500
> > >
> > > fixup! virtio-blk: add support for zoned block devices
> >
> > I also confirm that this patch fixes the issue with broken virtio block
> > device observed on QEMU arm/arm64 'virt' machines and linux
> > next-20221220. Thanks for the fix!
> >
> > Tested-by: Marek Szyprowski <[email protected]>

Tested-by: Linux Kernel Functional Testing <[email protected]>

>
> Merged the fix already so I'm not sure I can add this tag.
> If I rebase before pull request I will, thanks!

[Sorry for delayed reply]

> > > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> > > index ff49052e26f7..d8cdaeb51d1c 100644
> > > --- a/drivers/block/virtio_blk.c
> > > +++ b/drivers/block/virtio_blk.c
> > > @@ -775,6 +775,10 @@ static int virtblk_probe_zoned_device(struct virtio_device *vdev,
> > > return ret;
> > > }
> > >
> > > +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> > > +{
> > > + return virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED);
> > > +}
> > > #else
> > >
> > > /*
> > > @@ -790,6 +794,11 @@ static inline int virtblk_probe_zoned_device(struct virtio_device *vdev,
> > > {
> > > return -EOPNOTSUPP;
> > > }
> > > +
> > > +static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> > > +{
> > > + return false;
> > > +}
> > > #endif /* CONFIG_BLK_DEV_ZONED */
> > >
> > > /* return id (s/n) string for *disk to *id_str
> > > @@ -1576,11 +1585,11 @@ static int virtblk_probe(struct virtio_device *vdev)
> > > else
> > > q->limits.discard_granularity = blk_size;
> > > }
> > >
> > > virtblk_update_capacity(vblk, false);
> > > virtio_device_ready(vdev);
> > >
> > > - if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) {
> > > + if (virtblk_has_zoned_feature(vdev)) {
> > > err = virtblk_probe_zoned_device(vdev, vblk, q);
> > > if (err)
> > > goto out_cleanup_disk;
> >
> > Best regards
> > --
> > Marek Szyprowski, PhD
> > Samsung R&D Institute Poland


--
Linaro LKFT
https://lkft.linaro.org