> Without VIRTIO_RING_F_INDIRECT_DESC a request takes at least three ring
> descriptors: the header, one segment and the status. Nothing checks
> that the virtqueues hold that many, and a smaller one fails in a way
> that depends on the queue depth. With the default depth, num_free / 2,
> a virtqueue of one descriptor gives a depth of 0, which
> blk_mq_alloc_tag_set() refuses, and the probe fails without saying why:
> 
>   virtio_blk virtio0: probe with driver virtio_blk failed with error -22
> 
> With a depth of at least one, from a virtqueue of two or from
> virtio_blk.queue_depth, the probe succeeds and the first request never
> fits: virtqueue_add_split() warns and returns -ENOSPC, and the hardware
> queue is stopped to wait for descriptors that even an empty ring does
> not have.
> 
> Check the virtqueue sizes right after the virtqueues are set up, before
> the queue depth is derived from them, and fail the probe with a reason
> when the smallest one cannot hold a request:
> 
>   virtio_blk virtio0: virtqueue size 1 is too small for a request
> 
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Stjepan Poljak <[email protected]>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1


Reply via email to