Re: [virtio-dev] [PATCH v2] Add lifetime metrics to virtio-blk

From
Enrico Granata <>
Date
2021-03-01T17:52:23+00:00
ID
Thread
Re: [virtio-dev] [PATCH v2] Add lifetime metrics to virtio-blk
Thanks for pointing this issue out :) I respun a v3 patch with a new value (10)

Please feel free to take a look when you get a chance.

- Enrico

On Mon, Mar 1, 2021 at 4:20 AM Stefan Hajnoczi <> wrote:
>
> On Thu, Feb 25, 2021 at 04:41:41PM -0700, Enrico Granata wrote:
> > @@ -4611,6 +4615,7 @@ \subsection{Device Operation}\label{sec:Device
> > Types / Block Device / Device Ope
> >  #define VIRTIO_BLK_T_GET_ID       8
> >  #define VIRTIO_BLK_T_DISCARD      11
> >  #define VIRTIO_BLK_T_WRITE_ZEROES 13
> > +#define VIRTIO_BLK_T_GET_LIFETIME 15
>
> Sorry I missed this in the previous revision:
>
> There is some funny business in the Linux drivers/block/virtio_blk.c
> driver and QEMU hw/block/virtio-blk.c device implementations where the
> least significant bit indicates a driver-to-device DMA transfer when
> set and a device-to-driver DMA transfer when clear. That's why
> DISCARD/WRITE_ZEROES have odd-numbered request types but GET_ID has an
> even-numbered request type.
>
> The implementations should probably be overhauled to stop doing this.
> There doesn't seem to be a good reason for it! :P
>
> To make life easy, please choose an even-numbered request type. That way
> these implementations will treat VIRTIO_BLK_T_GET_LIFETIME as a "read"
> instead of a "write". 10, 12, or 14 would work.
>
> Otherwise:
>
> Reviewed-by: Stefan Hajnoczi <>