[SeaBIOS] [PATCH] virtio-blk: Fix incorrect type conversion in virtio_blk_op()

Xiaofei posted 1 patch 1 year, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/20221119074750.83531-1-hbuxiaofei@gmail.com
src/hw/virtio-blk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[SeaBIOS] [PATCH] virtio-blk: Fix incorrect type conversion in virtio_blk_op()
Posted by Xiaofei 1 year, 4 months ago
Fixes: a05af290bac5 ("virtio-blk: split large IO according to size_max")

When using spdk aio bdev driver, the qemu command line like this:
qemu-system-x86_64 \
    -chardev socket,id=char0,path=/tmp/vhost.0 \
    -device vhost-user-blk-pci,id=blk0,chardev=char0 \
    ...

Boot failure message as below:

e820 map has 7 items:
  0: 0000000000000000 - 000000000009fc00 = 1 RAM
  1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
  2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
  3: 0000000000100000 - 000000007ffdd000 = 1 RAM
  4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED
  5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED
  6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED
enter handle_19:
  NULL
Booting from Hard Disk...
Boot failed: could not read the boot disk

Signed-off-by: Xiaofei <hbuxiaofei@gmail.com>
---
 src/hw/virtio-blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c
index 9b4a05a..ce3265e 100644
--- a/src/hw/virtio-blk.c
+++ b/src/hw/virtio-blk.c
@@ -92,7 +92,7 @@ virtio_blk_op(struct disk_op_s *op, int write)
     u16 blk_num_max;
 
     if (vdrive->drive.blksize != 0 && max_io_size != 0)
-        blk_num_max = (u16)max_io_size / vdrive->drive.blksize;
+        blk_num_max = (u16)(max_io_size / vdrive->drive.blksize);
     else
         /* default blk_num_max if hardware doesnot advise a proper value */
         blk_num_max = 64;
-- 
2.27.0

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] virtio-blk: Fix incorrect type conversion in virtio_blk_op()
Posted by Paul Menzel 1 year, 4 months ago
Dear Xiaofei,


Thank you for the patch. Should you resent another version (`git 
format-patch --reroll-count 2`) you could fix two more nits.


Am 19.11.22 um 08:47 schrieb Xiaofei:
> Fixes: a05af290bac5 ("virtio-blk: split large IO according to size_max")
> 
> When using spdk aio bdev driver, the qemu command line like this:

You could add one blank line.

> qemu-system-x86_64 \
>      -chardev socket,id=char0,path=/tmp/vhost.0 \
>      -device vhost-user-blk-pci,id=blk0,chardev=char0 \
>      ...
> 
> Boot failure message as below:
> 
> e820 map has 7 items:
>    0: 0000000000000000 - 000000000009fc00 = 1 RAM
>    1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
>    2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
>    3: 0000000000100000 - 000000007ffdd000 = 1 RAM
>    4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED
>    5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED
>    6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED
> enter handle_19:
>    NULL
> Booting from Hard Disk...
> Boot failed: could not read the boot disk
> 
> Signed-off-by: Xiaofei <hbuxiaofei@gmail.com>

Is Xiaofei your full name or only your last name? Your email address has 
hbu prepended, so I am wondering.


Kind regards,

Paul


> ---
>   src/hw/virtio-blk.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c
> index 9b4a05a..ce3265e 100644
> --- a/src/hw/virtio-blk.c
> +++ b/src/hw/virtio-blk.c
> @@ -92,7 +92,7 @@ virtio_blk_op(struct disk_op_s *op, int write)
>       u16 blk_num_max;
>   
>       if (vdrive->drive.blksize != 0 && max_io_size != 0)
> -        blk_num_max = (u16)max_io_size / vdrive->drive.blksize;
> +        blk_num_max = (u16)(max_io_size / vdrive->drive.blksize);
>       else
>           /* default blk_num_max if hardware doesnot advise a proper value */
>           blk_num_max = 64;
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] virtio-blk: Fix incorrect type conversion in virtio_blk_op()
Posted by Xiaofei Lee 1 year, 4 months ago
On Mon, 21 Nov 2022 11:19:48 +0100
Paul Menzel <pmenzel@molgen.mpg.de> wrote:

> Dear Xiaofei,
> 
> 
> Thank you for the patch. Should you resent another version (`git 
> format-patch --reroll-count 2`) you could fix two more nits.
> 
> 
> Am 19.11.22 um 08:47 schrieb Xiaofei:
> > Fixes: a05af290bac5 ("virtio-blk: split large IO according to
> > size_max")
> > 
> > When using spdk aio bdev driver, the qemu command line like this:  
> 
> You could add one blank line.
> 
> > qemu-system-x86_64 \
> >      -chardev socket,id=char0,path=/tmp/vhost.0 \
> >      -device vhost-user-blk-pci,id=blk0,chardev=char0 \
> >      ...
> > 
> > Boot failure message as below:
> > 
> > e820 map has 7 items:
> >    0: 0000000000000000 - 000000000009fc00 = 1 RAM
> >    1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
> >    2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
> >    3: 0000000000100000 - 000000007ffdd000 = 1 RAM
> >    4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED
> >    5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED
> >    6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED
> > enter handle_19:
> >    NULL
> > Booting from Hard Disk...
> > Boot failed: could not read the boot disk
> > 
> > Signed-off-by: Xiaofei <hbuxiaofei@gmail.com>  
> 
> Is Xiaofei your full name or only your last name? Your email address
> has hbu prepended, so I am wondering.
> 
> 
> Kind regards,
> 
> Paul
> 
> 
> > ---
> >   src/hw/virtio-blk.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c
> > index 9b4a05a..ce3265e 100644
> > --- a/src/hw/virtio-blk.c
> > +++ b/src/hw/virtio-blk.c
> > @@ -92,7 +92,7 @@ virtio_blk_op(struct disk_op_s *op, int write)
> >       u16 blk_num_max;
> >   
> >       if (vdrive->drive.blksize != 0 && max_io_size != 0)
> > -        blk_num_max = (u16)max_io_size / vdrive->drive.blksize;
> > +        blk_num_max = (u16)(max_io_size / vdrive->drive.blksize);
> >       else
> >           /* default blk_num_max if hardware doesnot advise a
> > proper value */ blk_num_max = 64;  

Thanks for your suggestion. My full name is Xiaofei Lee, of course you
can call me Xiaofei.

Regards,
Xiaofei
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] virtio-blk: Fix incorrect type conversion in virtio_blk_op()
Posted by Paul Menzel 1 year, 4 months ago
Dear Xiaofei,


Am 21.11.22 um 15:08 schrieb Xiaofei Lee:

[…]

> Thanks for your suggestion. My full name is Xiaofei Lee, of course you
> can call me Xiaofei.

Thank you for the clarification. It’d be great if you used your full 
name in the Signed-off-by line.

     $ git config --global user.name "Xiaofei Lee"
     $ git commit --amend --author="Xiaofei Lee <hbuxiaofei@gmail.com>"


Kind regards,

Paul
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] virtio-blk: Fix incorrect type conversion in virtio_blk_op()
Posted by Xiaofei Lee 1 year, 4 months ago
On Mon, 21 Nov 2022 15:20:44 +0100
Paul Menzel <pmenzel@molgen.mpg.de> wrote:

> Dear Xiaofei,
> 
> 
> Am 21.11.22 um 15:08 schrieb Xiaofei Lee:
> 
> […]
> 
> > Thanks for your suggestion. My full name is Xiaofei Lee, of course
> > you can call me Xiaofei.  
> 
> Thank you for the clarification. It’d be great if you used your full 
> name in the Signed-off-by line.
> 
>      $ git config --global user.name "Xiaofei Lee"
>      $ git commit --amend --author="Xiaofei Lee
> <hbuxiaofei@gmail.com>"
> 
> 
> Kind regards,
> 
> Paul

Thank you, I will.

Regards,
Xiaofei
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] virtio-blk: Fix incorrect type conversion in virtio_blk_op()
Posted by Gerd Hoffmann 1 year, 4 months ago
On Sat, Nov 19, 2022 at 03:47:50PM +0800, Xiaofei wrote:
> Fixes: a05af290bac5 ("virtio-blk: split large IO according to size_max")

That should be at the bottom of the commit message (next to the
signed-off-by line).

> When using spdk aio bdev driver, the qemu command line like this:
> qemu-system-x86_64 \
>     -chardev socket,id=char0,path=/tmp/vhost.0 \
>     -device vhost-user-blk-pci,id=blk0,chardev=char0 \
>     ...
> 
> Boot failure message as below:
> 
> e820 map has 7 items:
>   0: 0000000000000000 - 000000000009fc00 = 1 RAM
>   1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
>   2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
>   3: 0000000000100000 - 000000007ffdd000 = 1 RAM
>   4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED
>   5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED
>   6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED
> enter handle_19:
>   NULL
> Booting from Hard Disk...
> Boot failed: could not read the boot disk

Acked-by: Gerd Hoffmann <kraxel@redhat.com>

take care,
  Gerd

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] virtio-blk: Fix incorrect type conversion in virtio_blk_op()
Posted by Xiaofei Lee 1 year, 4 months ago
On Mon, 21 Nov 2022 11:14:35 +0100
Gerd Hoffmann <kraxel@redhat.com> wrote:

> On Sat, Nov 19, 2022 at 03:47:50PM +0800, Xiaofei wrote:
> > Fixes: a05af290bac5 ("virtio-blk: split large IO according to
> > size_max")  
> 
> That should be at the bottom of the commit message (next to the
> signed-off-by line).
> 
> > When using spdk aio bdev driver, the qemu command line like this:
> > qemu-system-x86_64 \
> >     -chardev socket,id=char0,path=/tmp/vhost.0 \
> >     -device vhost-user-blk-pci,id=blk0,chardev=char0 \
> >     ...
> > 
> > Boot failure message as below:
> > 
> > e820 map has 7 items:
> >   0: 0000000000000000 - 000000000009fc00 = 1 RAM
> >   1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
> >   2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
> >   3: 0000000000100000 - 000000007ffdd000 = 1 RAM
> >   4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED
> >   5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED
> >   6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED
> > enter handle_19:
> >   NULL
> > Booting from Hard Disk...
> > Boot failed: could not read the boot disk  
> 
> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
> 
> take care,
>   Gerd
> 

Thanks for your suggestion.

Regards,
Xiaofei

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] virtio-blk: Fix incorrect type conversion in virtio_blk_op()
Posted by Pei, Andy 1 year, 4 months ago
HI 

Thanks for your patch.

> -----Original Message-----
> From: Xiaofei <hbuxiaofei@gmail.com>
> Sent: Saturday, November 19, 2022 3:48 PM
> To: seabios@seabios.org
> Cc: pmenzel@molgen.mpg.de; Pei, Andy <andy.pei@intel.com>;
> mst@redhat.com; Xiaofei <hbuxiaofei@gmail.com>
> Subject: [SeaBIOS] [PATCH] virtio-blk: Fix incorrect type conversion in
> virtio_blk_op()
> 
> Fixes: a05af290bac5 ("virtio-blk: split large IO according to size_max")
> 
> When using spdk aio bdev driver, the qemu command line like this:
> qemu-system-x86_64 \
>     -chardev socket,id=char0,path=/tmp/vhost.0 \
>     -device vhost-user-blk-pci,id=blk0,chardev=char0 \
>     ...
> 
> Boot failure message as below:
> 
> e820 map has 7 items:
>   0: 0000000000000000 - 000000000009fc00 = 1 RAM
>   1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
>   2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
>   3: 0000000000100000 - 000000007ffdd000 = 1 RAM
>   4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED
>   5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED
>   6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED enter handle_19:
>   NULL
> Booting from Hard Disk...
> Boot failed: could not read the boot disk
> 
> Signed-off-by: Xiaofei <hbuxiaofei@gmail.com>

Acked-by: Andy Pei < andy.pei@intel.com>

> ---
>  src/hw/virtio-blk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c index 9b4a05a..ce3265e
> 100644
> --- a/src/hw/virtio-blk.c
> +++ b/src/hw/virtio-blk.c
> @@ -92,7 +92,7 @@ virtio_blk_op(struct disk_op_s *op, int write)
>      u16 blk_num_max;
> 
>      if (vdrive->drive.blksize != 0 && max_io_size != 0)
> -        blk_num_max = (u16)max_io_size / vdrive->drive.blksize;
> +        blk_num_max = (u16)(max_io_size / vdrive->drive.blksize);
>      else
>          /* default blk_num_max if hardware doesnot advise a proper value */
>          blk_num_max = 64;
> --
> 2.27.0

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] [PATCH v2 1/1] virtio-blk: Fix incorrect type conversion in virtio_blk_op()
Posted by Xiaofei Li 1 year, 4 months ago
From: Xiaofei Lee <hbuxiaofei@gmail.com>

When using spdk aio bdev driver, the qemu command line like this:

qemu-system-x86_64 \
    -chardev socket,id=char0,path=/tmp/vhost.0 \
    -device vhost-user-blk-pci,id=blk0,chardev=char0 \
    ...

Boot failure message as below:

e820 map has 7 items:
  0: 0000000000000000 - 000000000009fc00 = 1 RAM
  1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
  2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
  3: 0000000000100000 - 000000007ffdd000 = 1 RAM
  4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED
  5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED
  6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED
enter handle_19:
  NULL
Booting from Hard Disk...
Boot failed: could not read the boot disk

Fixes: a05af290bac5 ("virtio-blk: split large IO according to size_max")
Signed-off-by: Xiaofei Lee <hbuxiaofei@gmail.com>
---
 src/hw/virtio-blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c
index 9b4a05a..ce3265e 100644
--- a/src/hw/virtio-blk.c
+++ b/src/hw/virtio-blk.c
@@ -92,7 +92,7 @@ virtio_blk_op(struct disk_op_s *op, int write)
     u16 blk_num_max;
 
     if (vdrive->drive.blksize != 0 && max_io_size != 0)
-        blk_num_max = (u16)max_io_size / vdrive->drive.blksize;
+        blk_num_max = (u16)(max_io_size / vdrive->drive.blksize);
     else
         /* default blk_num_max if hardware doesnot advise a proper value */
         blk_num_max = 64;
-- 
2.27.0

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH v2 1/1] virtio-blk: Fix incorrect type conversion in virtio_blk_op()
Posted by Kevin O'Connor 1 year, 4 months ago
On Mon, Nov 21, 2022 at 10:54:10PM +0800, Xiaofei Li wrote:
> From: Xiaofei Lee <hbuxiaofei@gmail.com>
> 
> When using spdk aio bdev driver, the qemu command line like this:
> 
> qemu-system-x86_64 \
>     -chardev socket,id=char0,path=/tmp/vhost.0 \
>     -device vhost-user-blk-pci,id=blk0,chardev=char0 \
>     ...
> 
> Boot failure message as below:
> 
> e820 map has 7 items:
>   0: 0000000000000000 - 000000000009fc00 = 1 RAM
>   1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
>   2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
>   3: 0000000000100000 - 000000007ffdd000 = 1 RAM
>   4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED
>   5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED
>   6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED
> enter handle_19:
>   NULL
> Booting from Hard Disk...
> Boot failed: could not read the boot disk
> 
> Fixes: a05af290bac5 ("virtio-blk: split large IO according to size_max")
> Signed-off-by: Xiaofei Lee <hbuxiaofei@gmail.com>

Thanks.  I committed this change.

-Kevin
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org