From: Dmitrii Tcvetkov <me@demsh.org>
To: Keith Busch <kbusch@kernel.org>
Cc: Keith Busch <kbusch@fb.com>, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [bisected] QEMU guest boot failure since 6.0 on x86_64 host
Date: Thu, 20 Oct 2022 13:48:18 +0300 [thread overview]
Message-ID: <20221020134818.30961090@xps.demsh.org> (raw)
In-Reply-To: <Y1CkMS+xbwbvn8My@kbusch-mbp.dhcp.thefacebook.com>
On Wed, 19 Oct 2022 19:28:17 -0600
Keith Busch <kbusch@kernel.org> wrote:
> On Thu, Oct 20, 2022 at 03:17:25AM +0300, Dmitrii Tcvetkov wrote:
> >
> > Bisect led me to commit b1a000d3b8ec5 ("block: relax direct io
> > memory alignment"). I was unable to resolve revert conflicts when
> > tried to revert b1a000d3b8ec5 ("block: relax direct io memory
> > alignment") as I lack necessary understanding of block subsystem.
>
> Background info: when your virtual block device's logical block size
> is smaller than the host's block device backing it, qemu needs to
> bounce unaligned buffers when using direct-io.
>
> Historically for direct-io, the logical block size happened to also be
> the memory page offset alignment. QEMU did this the other way around:
> it used the memory offset as the block size, and that was not
> intended:
>
> https://lore.kernel.org/lkml/32db4f89-a83f-aac4-5d27-0801bdca60bf@redhat.com/
>
> The kernel patch you bisected to detangled memory alignment from
> logical block size, so now older qemu versions have the wrong idea of
> the minimum vector size. That is fixed in the qemu repository here:
>
> https://git.qemu.org/?p=qemu.git;a=commitdiff;h=25474d90aa50bd32e0de395a33d8de42dd6f2aef
> >
> > This fails to boot on 6.0+ host:
> > # losetup -b 4096 -f image.raw
> > # qemu-system-x86_64 -enable-kvm -drive
> > file=/dev/loop0,format=raw,cache=none
>
> In the above, your backing storage is 4k, and the default virtual
> device block size is 512b, so qemu needs to bounce that, but older
> versions might not do that as intended.
>
> It should work if you include logical_block_size=4096 to the -drive
> parameters.
>
> > These boot fine on 6.0+ host:
> > # losetup -b 4096 -f image.raw
> > # qemu-system-x86_64 -enable-kvm -drive
> > file=/dev/loop0,format=raw
>
> The above is using cache, which doesn't have any alignment and size
> constraints, so works with anything sizes.
>
> > # losetup -f image.raw
> > # qemu-system-x86_64 -enable-kvm -drive
> > file=/dev/loop0,format=raw,cache=none
>
> The above is using a 512b formated backing store to a 512b emulated
> drive, so the matching means qemu never needs to bounce.
Thanks! Specifying logical_block_size=4096 indeed helps, guest still
doesn't boot but because it has partition table with an assumption of 512
sectors. After reinstall with logical_block_size=4096 specified it
boots.
prev parent reply other threads:[~2022-10-20 10:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 0:17 Dmitrii Tcvetkov
2022-10-20 1:28 ` Keith Busch
2022-10-20 10:48 ` Dmitrii Tcvetkov [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=20221020134818.30961090@xps.demsh.org \
--to=me@demsh.org \
--cc=axboe@kernel.dk \
--cc=kbusch@fb.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®