All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Max Makarov <maxpain177@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
	Coiby Xu <Coiby.Xu@gmail.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>, Max Makarov <maxpain@linux.com>
Subject: Re: [PATCH] vhost-user-blk-server: fix size_max=0 breaking Windows guests
Date: Tue, 31 Mar 2026 14:51:04 +0200	[thread overview]
Message-ID: <acvDOFITDiEhO1ei@redhat.com> (raw)
In-Reply-To: <20260330151313.66318-1-maxpain@linux.com>

Am 30.03.2026 um 17:13 hat Max Makarov geschrieben:
> The QSD vhost-user-blk export sets size_max=0 in the virtio config,
> but the vhost-user-blk frontend unconditionally advertises
> VIRTIO_BLK_F_SIZE_MAX. This creates a spec-violating state: the
> feature bit tells the guest that size_max is valid, but the value
> is 0.
> 
> Native virtio-blk-pci does not advertise VIRTIO_BLK_F_SIZE_MAX when
> size_max=0, so guests never see this contradiction there.
> 
> The Windows viostor driver trusts the feature bit and uses size_max=0
> in its MaximumTransferLength calculation, producing malformed
> scatter-gather requests. The disk appears completely empty to Windows
> (no GPT, no partitions in diskpart), causing INACCESSIBLE_BOOT_DEVICE
> BSOD. Linux is unaffected because its virtio_blk driver falls back to
> PAGE_SIZE when size_max=0.

Where is this fallback to PAGE_SIZE?

I can see that in virtblk_read_limits(), not setting the flag would
leave lim->max_segment_size at max_dma_size (capped at U32_MAX, which I
think it will actually be in the normal case), whereas setting it makes
it 0. If it's 0, blk_validate_limits() later updates it to
BLK_MAX_SEGMENT_SIZE, which is 65536.

> Set size_max to 4096 (PAGE_SIZE) to provide a valid segment size limit
> that matches what Linux assumes as a fallback. This fixes Windows
> Server 2025 (and likely all Windows versions) booting from
> vhost-user-blk.

4096 is really small and doesn't feel very optimal.

Why don't we just do what the in-process virtio-blk device does and
clear the VIRTIO_BLK_F_SIZE_MAX flag?

> Buglink: https://github.com/spdk/spdk/issues/3199
> Buglink: https://github.com/virtio-win/kvm-guest-drivers-windows/issues/692
> Signed-off-by: Max Makarov <maxpain@linux.com>

The linked bug reports seems to be about a different bug, which has long
been addressed in both projects. Buglink should be used for bug reports
that are fixed with this patch (see docs/devel/submitting-a-patch.rst).

Kevin



      reply	other threads:[~2026-03-31 12:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30 15:13 [PATCH] vhost-user-blk-server: fix size_max=0 breaking Windows guests Max Makarov
2026-03-31 12:51 ` Kevin Wolf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acvDOFITDiEhO1ei@redhat.com \
    --to=kwolf@redhat.com \
    --cc=Coiby.Xu@gmail.com \
    --cc=hreitz@redhat.com \
    --cc=maxpain177@gmail.com \
    --cc=maxpain@linux.com \
    --cc=mst@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.