Re: next: kernel BUG at drivers/virtio/virtio.c:122!

From: Naresh Kamboju
Date: Tue Dec 20 2022 - 08:47:29 EST


On Tue, 20 Dec 2022 at 18:56, Michael S. Tsirkin <mst@xxxxxxxxxx> 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 <naresh.kamboju@xxxxxxxxxx> 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 <lkft@xxxxxxxxxx>
> > >>>
> > >>> <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 <mst@xxxxxxxxxx>
> > > 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 <m.szyprowski@xxxxxxxxxxx>

Tested-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>

>
> 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