[Bug 2025591] Re: Align the iov length to the logical block size

Ubuntu Foundations Team Bug Bot 2025591 at bugs.launchpad.net
Mon Jul 3 08:16:43 UTC 2023


The attachment "jammy_use_the_request_length_for_iov_alignment.debdiff"
seems to be a debdiff.  The ubuntu-sponsors team has been subscribed to
the bug report so that they can review and hopefully sponsor the
debdiff.  If the attachment isn't a patch, please remove the "patch"
flag from the attachment, remove the "patch" tag, and if you are member
of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by
~brian-murray, for any issue please contact him.]

** Tags added: patch

-- 
You received this bug notification because you are a member of Ubuntu
Sponsors, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/2025591

Title:
  Align the iov length to the logical block size

Status in qemu package in Ubuntu:
  In Progress
Status in qemu source package in Jammy:
  In Progress

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 at 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 at kernel.dk>
      Signed-off-by: Keith Busch <kbusch at kernel.org>
      Message-Id: <20220929200523.3218710-3-kbusch at meta.com>
      Reviewed-by: Kevin Wolf <kwolf at redhat.com>
      Signed-off-by: Kevin Wolf <kwolf at 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/ubuntu/+source/qemu/+bug/2025591/+subscriptions




More information about the Ubuntu-sponsors mailing list