[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug 2025586] Re: Align the iov length to the logical block size
From: |
ChengEn, Du |
Subject: |
[Bug 2025586] Re: Align the iov length to the logical block size |
Date: |
Mon, 03 Jul 2023 05:28:34 -0000 |
** Changed in: qemu
Assignee: (unassigned) => ChengEn, Du (chengendu)
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/2025586
Title:
Align the iov length to the logical block size
Status in QEMU:
New
Bug description:
[Impact]
When the logical block size of the virtual block device is smaller than the
block device it is backed by on the host,
qemu encounters a situation where it needs to bounce unaligned buffers during
the use of direct IO.
In the past, the logical block size happened to align with the memory page
offset, leading qemu to mistakenly use the memory offset as the block size.
However, a kernel commit b1a000d3b8ec resolved this issue by separating
memory alignment from the logical block size.
As a result, qemu now has an incorrect understanding of the minimum vector
size.
[Fix]
Upstream commit 25474d90aa50 fixed this issue.
==========
Author: Keith Busch <kbusch@kernel.org>
CommitDate: Fri Sep 30 18:43:44 2022 +0200
block: use the request length for iov alignment
An iov length needs to be aligned to the logical block size, which may
be larger than the memory alignment.
Tested-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Message-Id: <20220929200523.3218710-3-kbusch@meta.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
==========
[Test Plan]
1. Get a ubuntu image and convert it to RAW format
wget
https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64-disk-kvm.img
qemu-img convert jammy-server-cloudimg-amd64-disk-kvm.img
jammy-server-cloudimg-amd64-disk-kvm.raw
2. Set up a loop device with RAW image
losetup -b 4096 -f jammy-server-cloudimg-amd64-disk-kvm.raw
3. Get loop device number by `losetup -a` command
4. Start the virtual machine
qemu-system-x86_64 -enable-kvm -drive file=/dev/loopX,format=raw,cache=none
--nographic
[Where problems could occur]
The patch addressed the issue of misusing the memory offset as the block size.
This problem only occurred when the cache option was set to "none" and the
Linux kernel being used had the commit b1a000d3b8ec.
However, it is worth noting that the patch also worked effectively with older
kernels.
[Other Info]
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/2025586/+subscriptions