Debian Bug report logs -
#757927
[qemu-kvm] TRIM (discard=unmap) broken in 2.1
Reported by: Roman Mamedov <rm@romanrm.net>
Date: Tue, 12 Aug 2014 13:45:01 UTC
Severity: normal
Tags: confirmed, patch, upstream
Found in version qemu/2.1+dfsg-2~bpo70+2
Fixed in version qemu/2.1+dfsg-3
Done: Michael Tokarev <mjt@tls.msk.ru>
Bug is archived. No further changes may be made.
Toggle useless messages
Report forwarded
to debian-bugs-dist@lists.debian.org, Michael Tokarev <mjt@tls.msk.ru>:
Bug#757927; Package qemu-kvm.
(Tue, 12 Aug 2014 13:45:06 GMT) (full text, mbox, link).
Acknowledgement sent
to Roman Mamedov <rm@romanrm.net>:
New Bug report received and forwarded. Copy sent to Michael Tokarev <mjt@tls.msk.ru>.
(Tue, 12 Aug 2014 13:45:06 GMT) (full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
Package: qemu-kvm
Version: 2.1+dfsg-2~bpo70+2
Severity: normal
Hello,
I was able to successfully use the passthrough TRIM support with an IDE
interface virtual disk in Qemu-KVM version 2.0.
However after upgrading to 2.1 and restarting my VM, TRIM now fails in it with
messages like those quoted below (dmesg from the guest). There are no messages
in dmesg related to that on the host.
I run two VMs, and the other has not been restarted yet (it's running with the
old 2.0 binaries), and there TRIM works without issue. So it clearly seems to
be due to some change in 2.1.
[ 63.096106] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 63.097698] ata1.00: BMDMA stat 0x4
[ 63.098470] ata1.00: failed command: DATA SET MANAGEMENT
[ 63.099245] ata1.00: cmd 06/01:01:00:00:00/00:00:00:00:00/a0 tag 0 dma 512 out
[ 63.099245] res 41/04:01:00:00:00/04:01:00:00:00/a0 Emask 0x1 (device error)
[ 63.100894] ata1.00: status: { DRDY ERR }
[ 63.101698] ata1.00: error: { ABRT }
[ 63.102465] ata1.00: device reported invalid CHS sector 0
[ 63.102471] sd 0:0:0:0: [sda]
[ 63.102473] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 63.102474] sd 0:0:0:0: [sda]
[ 63.102475] Sense Key : Aborted Command [current] [descriptor]
[ 63.102477] Descriptor sense data with sense descriptors (in hex):
[ 63.102478] 72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00
[ 63.102482] 00 00 00 00
[ 63.102484] sd 0:0:0:0: [sda]
[ 63.102485] Add. Sense: No additional sense information
[ 63.102486] sd 0:0:0:0: [sda] CDB:
[ 63.102487] Write same(16): 93 08 00 00 00 00 00 84 37 60 00 00 00 18 00 00
[ 63.102492] end_request: I/O error, dev sda, sector 8664928
[ 63.103438] EXT4-fs (sda1): discard request in group:33 block:1516 count:3 failed with -5
[ 63.256058] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 63.256897] ata1.00: BMDMA stat 0x4
[ 63.257697] ata1.00: failed command: DATA SET MANAGEMENT
[ 63.258479] ata1.00: cmd 06/01:01:00:00:00/00:00:00:00:00/a0 tag 0 dma 512 out
[ 63.258479] res 41/04:01:00:00:00/04:01:00:00:00/a0 Emask 0x1 (device error)
[ 63.260126] ata1.00: status: { DRDY ERR }
[ 63.260954] ata1.00: error: { ABRT }
[ 63.261731] ata1.00: device reported invalid CHS sector 0
[ 63.261737] sd 0:0:0:0: [sda]
[ 63.261738] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 63.261739] sd 0:0:0:0: [sda]
[ 63.261740] Sense Key : Aborted Command [current] [descriptor]
[ 63.261742] Descriptor sense data with sense descriptors (in hex):
[ 63.261743] 72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00
[ 63.261747] 00 00 00 00
[ 63.261749] sd 0:0:0:0: [sda]
[ 63.261750] Add. Sense: No additional sense information
[ 63.261751] sd 0:0:0:0: [sda] CDB:
[ 63.261752] Write same(16): 93 08 00 00 00 00 00 93 c8 08 00 00 00 38 00 00
[ 63.261757] end_request: I/O error, dev sda, sector 9685000
[ 63.262756] EXT4-fs (sda1): discard request in group:36 block:30721 count:7 failed with -5
[ 66.328099] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 66.328991] ata1.00: BMDMA stat 0x4
[ 66.329811] ata1.00: failed command: DATA SET MANAGEMENT
[ 66.330659] ata1.00: cmd 06/01:01:00:00:00/00:00:00:00:00/a0 tag 0 dma 512 out
[ 66.330659] res 41/04:01:00:00:00/04:01:00:00:00/a0 Emask 0x1 (device error)
[ 66.332307] ata1.00: status: { DRDY ERR }
[ 66.333122] ata1.00: error: { ABRT }
[ 66.333918] ata1.00: device reported invalid CHS sector 0
[ 66.333923] sd 0:0:0:0: [sda]
[ 66.333925] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 66.333926] sd 0:0:0:0: [sda]
[ 66.333927] Sense Key : Aborted Command [current] [descriptor]
[ 66.333929] Descriptor sense data with sense descriptors (in hex):
[ 66.333930] 72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00
[ 66.333934] 00 00 00 00
[ 66.333936] sd 0:0:0:0: [sda]
[ 66.333937] Add. Sense: No additional sense information
[ 66.333938] sd 0:0:0:0: [sda] CDB:
[ 66.333939] Write same(16): 93 08 00 00 00 00 00 84 48 60 00 00 00 08 00 00
[ 66.333944] end_request: I/O error, dev sda, sector 8669280
[ 66.335084] EXT4-fs (sda1): discard request in group:33 block:2060 count:1 failed with -5
[ 67.332057] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 67.332929] ata1.00: BMDMA stat 0x4
[ 67.333745] ata1.00: failed command: DATA SET MANAGEMENT
[ 67.334574] ata1.00: cmd 06/01:01:00:00:00/00:00:00:00:00/a0 tag 0 dma 512 out
[ 67.334574] res 41/04:01:00:00:00/04:01:00:00:00/a0 Emask 0x1 (device error)
[ 67.336264] ata1.00: status: { DRDY ERR }
[ 67.337114] ata1.00: error: { ABRT }
[ 67.337936] ata1.00: device reported invalid CHS sector 0
[ 67.337942] sd 0:0:0:0: [sda]
[ 67.337943] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 67.337945] sd 0:0:0:0: [sda]
[ 67.337946] Sense Key : Aborted Command [current] [descriptor]
[ 67.337948] Descriptor sense data with sense descriptors (in hex):
[ 67.337949] 72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00
[ 67.337953] 00 00 00 00
[ 67.337955] sd 0:0:0:0: [sda]
[ 67.337956] Add. Sense: No additional sense information
[ 67.337957] sd 0:0:0:0: [sda] CDB:
[ 67.337958] Write same(16): 93 08 00 00 00 00 00 01 32 40 00 00 00 10 00 00
[ 67.337963] end_request: I/O error, dev sda, sector 78400
--- System information. ---
Architecture: amd64
Kernel: Linux 3.14.14-rm1+
Debian Release: 7.6
990 stable www.emdebian.org
990 stable approx.home.romanrm.net
100 wheezy-backports approx.home.romanrm.net
--- Package information. ---
Depends (Version) | Installed
======================================-+-===================
qemu-system-x86 (>= 1.7.0+dfsg-2~) | 2.1+dfsg-2~bpo70+2
Package's Recommends field is empty.
Package's Suggests field is empty.
--
With respect,
Roman
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to debian-bugs-dist@lists.debian.org, Michael Tokarev <mjt@tls.msk.ru>:
Bug#757927; Package qemu-kvm.
(Tue, 12 Aug 2014 14:03:08 GMT) (full text, mbox, link).
Acknowledgement sent
to Roman Mamedov <rm@romanrm.net>:
Extra info received and forwarded to list. Copy sent to Michael Tokarev <mjt@tls.msk.ru>.
(Tue, 12 Aug 2014 14:03:08 GMT) (full text, mbox, link).
Message #10 received at 757927@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
Hello,
Just confirmed that downgrading the package "qemu-system-x86" from version
2.1+dfsg-2~bpo70+2 to 2.0.0+dfsg-4~bpo70+1 and restarting the affected VM
fixes this, TRIM starts working again without issue.
--
With respect,
Roman
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to debian-bugs-dist@lists.debian.org:
Bug#757927; Package qemu-kvm.
(Tue, 12 Aug 2014 14:51:04 GMT) (full text, mbox, link).
Acknowledgement sent
to Michael Tokarev <mjt@tls.msk.ru>:
Extra info received and forwarded to list.
(Tue, 12 Aug 2014 14:51:04 GMT) (full text, mbox, link).
Message #15 received at submit@bugs.debian.org (full text, mbox, reply):
12.08.2014 17:35, Roman Mamedov wrote:
> Package: qemu-kvm
> Version: 2.1+dfsg-2~bpo70+2
> Severity: normal
>
> Hello,
>
> I was able to successfully use the passthrough TRIM support with an IDE
> interface virtual disk in Qemu-KVM version 2.0.
>
> However after upgrading to 2.1 and restarting my VM, TRIM now fails in it with
> messages like those quoted below (dmesg from the guest). There are no messages
> in dmesg related to that on the host.
Please try a test binary I just built for you, here:
http://www.corpit.ru/mjt/tmp/qemu-system-x86_64-test-757927 .
It is signed with my usual debian gpg key, signature is here:
http://www.corpit.ru/mjt/tmp/qemu-system-x86_64-test-757927.sig
It is just one binary, -- the one which gets installed as
/usr/bin/qemu-system-x86_64. You may run it directly without
replacing your main binary.
It is the same as 2.1+dfsg-1~bpo70+2 but with a one-line patch
added:
diff --git a/hw/ide/core.c b/hw/ide/core.c
index db191a6..7256592 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -688,7 +688,8 @@ void ide_dma_cb(void *opaque, int ret)
sector_num, n, s->dma_cmd);
#endif
- if (!ide_sect_range_ok(s, sector_num, n)) {
+ if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) &&
+ !ide_sect_range_ok(s, sector_num, n)) {
dma_buf_commit(s);
ide_dma_error(s);
return;
The suspect is upstream commit 58ac3211 which introduced this very
check, which is okay for reads and writes but not for trim.
I can't easily verify this because I don't have a trim-capable
environment.
Thank you!
/mjt
Information forwarded
to debian-bugs-dist@lists.debian.org:
Bug#757927; Package qemu-kvm.
(Tue, 12 Aug 2014 14:51:19 GMT) (full text, mbox, link).
Acknowledgement sent
to Michael Tokarev <mjt@tls.msk.ru>:
Extra info received and forwarded to list.
(Tue, 12 Aug 2014 14:51:19 GMT) (full text, mbox, link).
Information forwarded
to debian-bugs-dist@lists.debian.org:
Bug#757927; Package qemu-kvm.
(Wed, 13 Aug 2014 06:09:04 GMT) (full text, mbox, link).
Acknowledgement sent
to Michael Tokarev <mjt@tls.msk.ru>:
Extra info received and forwarded to list.
(Wed, 13 Aug 2014 06:09:04 GMT) (full text, mbox, link).
Message #25 received at 757927@bugs.debian.org (full text, mbox, reply):
[This is http://bugs.debian.org/757927 -- trim stopped working in qemu 2.1]
12.08.2014 18:46, Michael Tokarev wrote:
> 12.08.2014 17:35, Roman Mamedov wrote:
>> Package: qemu-kvm
>> Version: 2.1+dfsg-2~bpo70+2
>> Severity: normal
>>
>> Hello,
>>
>> I was able to successfully use the passthrough TRIM support with an IDE
>> interface virtual disk in Qemu-KVM version 2.0.
>>
>> However after upgrading to 2.1 and restarting my VM, TRIM now fails in it with
>> messages like those quoted below (dmesg from the guest). There are no messages
>> in dmesg related to that on the host.
BTW, I found a system here with an SSD which supports discard, and tried my
guests against it -- everything works fine when I use sata/ahci, but it breaks
indeed when using the default IDE interface.
But applying the oneliner:
> It is the same as 2.1+dfsg-1~bpo70+2 but with a one-line patch
> added:
>
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index db191a6..7256592 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -688,7 +688,8 @@ void ide_dma_cb(void *opaque, int ret)
> sector_num, n, s->dma_cmd);
> #endif
>
> - if (!ide_sect_range_ok(s, sector_num, n)) {
> + if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) &&
> + !ide_sect_range_ok(s, sector_num, n)) {
> dma_buf_commit(s);
> ide_dma_error(s);
> return;
fixes the prob for me. So apparently kwolf was right pointing to that
commit 58ac3211.
I'll upload a new version soon.
Thanks,
/mjt
Information forwarded
to debian-bugs-dist@lists.debian.org, Michael Tokarev <mjt@tls.msk.ru>:
Bug#757927; Package qemu-kvm.
(Wed, 13 Aug 2014 06:21:05 GMT) (full text, mbox, link).
Acknowledgement sent
to Roman Mamedov <rm@romanrm.net>:
Extra info received and forwarded to list. Copy sent to Michael Tokarev <mjt@tls.msk.ru>.
(Wed, 13 Aug 2014 06:21:05 GMT) (full text, mbox, link).
Message #30 received at 757927@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
On Wed, 13 Aug 2014 10:05:51 +0400
Michael Tokarev <mjt@tls.msk.ru> wrote:
> BTW, I found a system here with an SSD which supports discard, and tried my
> guests against it -- everything works fine when I use sata/ahci, but it breaks
> indeed when using the default IDE interface.
Hello,
Thanks for working on this! Sorry for not being able to test an updated
version sooner.
Something to note, you do not need any TRIM-capable hardware such as SSD on the
host to take advantage of TRIM passthrough. Just place the RAW format VM disk
image on any filesystem which supports sparse files (e.g. Ext4 or Btrfs), and
when the guest system issues a TRIM, when using "discard=unmap" the VM image
file will be "re-sparsifyed" on the host filesystem, deallocating all the
TRIMed areas from disk storage, in effect it will take much less space on disk
than before:
http://s.lowendshare.com/7/1407910491.666.2014-07-16T130602Z-trim.png
I was only successful in using this with the virtual IDE interface disks on
Qemu/KVM 2.0, the virtio mode does not seem to support TRIM; did not try with
sata/ahci.
--
With respect,
Roman
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to debian-bugs-dist@lists.debian.org:
Bug#757927; Package qemu-kvm.
(Wed, 13 Aug 2014 06:27:04 GMT) (full text, mbox, link).
Acknowledgement sent
to Michael Tokarev <mjt@tls.msk.ru>:
Extra info received and forwarded to list.
(Wed, 13 Aug 2014 06:27:04 GMT) (full text, mbox, link).
Message #35 received at 757927@bugs.debian.org (full text, mbox, reply):
13.08.2014 10:16, Roman Mamedov wrote:
> Thanks for working on this! Sorry for not being able to test an updated
> version sooner.
You're welcome. I learned something too ;)
[]
> I was only successful in using this with the virtual IDE interface disks on
> Qemu/KVM 2.0, the virtio mode does not seem to support TRIM; did not try with
> sata/ahci.
virtio-scsi support trim, and also sata/ahci. virtio-blk does not, it is a
simple interface without fancy features.
Thanks,
/mjt
Added tag(s) upstream, confirmed, pending, and patch.
Request was from <mjt@tls.msk.ru>
to control@bugs.debian.org.
(Wed, 13 Aug 2014 18:06:05 GMT) (full text, mbox, link).
Reply sent
to Michael Tokarev <mjt@tls.msk.ru>:
You have taken responsibility.
(Thu, 14 Aug 2014 11:09:24 GMT) (full text, mbox, link).
Notification sent
to Roman Mamedov <rm@romanrm.net>:
Bug acknowledged by developer.
(Thu, 14 Aug 2014 11:09:24 GMT) (full text, mbox, link).
Message #42 received at 757927-close@bugs.debian.org (full text, mbox, reply):
Source: qemu
Source-Version: 2.1+dfsg-3
We believe that the bug you reported is fixed in the latest version of
qemu, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 757927@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Michael Tokarev <mjt@tls.msk.ru> (supplier of updated qemu package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Thu, 14 Aug 2014 14:30:24 +0400
Source: qemu
Binary: qemu qemu-system qemu-system-common qemu-system-misc qemu-system-arm qemu-system-mips qemu-system-ppc qemu-system-sparc qemu-system-x86 qemu-user qemu-user-static qemu-user-binfmt qemu-utils qemu-guest-agent qemu-kvm
Architecture: source amd64
Version: 2.1+dfsg-3
Distribution: unstable
Urgency: medium
Maintainer: Debian QEMU Team <pkg-qemu-devel@lists.alioth.debian.org>
Changed-By: Michael Tokarev <mjt@tls.msk.ru>
Description:
qemu - fast processor emulator
qemu-guest-agent - Guest-side qemu-system agent
qemu-kvm - QEMU Full virtualization on x86 hardware
qemu-system - QEMU full system emulation binaries
qemu-system-arm - QEMU full system emulation binaries (arm)
qemu-system-common - QEMU full system emulation binaries (common files)
qemu-system-mips - QEMU full system emulation binaries (mips)
qemu-system-misc - QEMU full system emulation binaries (miscelaneous)
qemu-system-ppc - QEMU full system emulation binaries (ppc)
qemu-system-sparc - QEMU full system emulation binaries (sparc)
qemu-system-x86 - QEMU full system emulation binaries (x86)
qemu-user - QEMU user mode emulation binaries
qemu-user-binfmt - QEMU user mode binfmt registration for qemu-user
qemu-user-static - QEMU user mode emulation binaries (static version)
qemu-utils - QEMU utilities
Closes: 691138 757927 757958
Changes:
qemu (2.1+dfsg-3) unstable; urgency=medium
.
* set SHELL = /bin/sh -e, so that more complex shell constructs
in d/rules will fail if any command fail inside
* check for pipe2() being a stub too, like utimensat() etc
* build-depend on gnutls-dev, not libgnutls*-dev, so the
buuld system will pick default gnutls impl (so it works for
backports and future versions)
* build-depend on libjpeg-dev not libjpeg8-dev
* minimum version of seabios is 1.7.5 (Closes: #757958)
* ide-only-constrain-read_write-requests-to-drive-size.diff
(Closes: #757927)
* added use-arch-data-path.patch, to be able to search for binary
blobs in several (arch-specific) data directories instead of just one.
* removed all blob/firmware symlinks from qemu-system-x86, using
arch-specific datapath instead (/usr/share/seabios:/usr/lib/ipxe/qemu)
* removed retry-pxe-after-efi.patch and depend on ipxe-qemu which
introduced efi boot roms. qemu should not try to load "wrong"
ROM, or else migration will fail due to rom size mismatch.
* include /usr/lib/qemu-bridge-helper binary, but not make it setuid
due to security concerns outlined in #691138 (Closes: #691138)
* make vnc-jpeg not debian-specific
* install kvm-spice symlinks on ubuntu
Checksums-Sha1:
cd64fd65bc994481fa4924153b10361548d39f6e 5100 qemu_2.1+dfsg-3.dsc
cfad227992bb322d00a13afa20ce0fba228594fc 58652 qemu_2.1+dfsg-3.debian.tar.xz
Checksums-Sha256:
469c03406d817ecbce23ad33bdb4f63dbf9b38e4d45f3c811b3c2459b9beeb49 5100 qemu_2.1+dfsg-3.dsc
76c9c0a0a10770ad4fef98972e7ea8e31abff373ee1526ce8f2b154268a8e4b9 58652 qemu_2.1+dfsg-3.debian.tar.xz
Files:
232004709e9f3c41f8561d7ed191f0cc 5100 otherosfs optional qemu_2.1+dfsg-3.dsc
b41dddb7a54544eb7fbfae10e32d7fe8 58652 otherosfs optional qemu_2.1+dfsg-3.debian.tar.xz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQEcBAEBAgAGBQJT7JWpAAoJEL7lnXSkw9fbFIIH/3YWNneuE+WCwNacCRfaOY8v
Em8hEBoiPKmYt1M9xe19wnG+s+UicaHAqQ2jS961cuNUYHWOI99TBylDWvmupbRc
BrR2bpYCs3Se1HE+bD3eKEcIvSQZUjw8QM1VtYOQVGWAjRTIU2Cvr4q1LIVuFWQc
rWeJaBZc3theK2vkqWBGcZXjcEY4TUhBteLp9vL+RmkhYmqq7SLgPjM8ybntgAFT
hcRwXfnv5mTmhMCGzyp82SIofo3lUmzyo1Q4e/5T7HXtRCEkyO7RikHtLbrt2hck
z59mGtxL89FQ3l391h/LfjYe8/LUGtO8pn3GNFQ4DHh8tLMKDNeWkMRkUQEz9ho=
=Hl3D
-----END PGP SIGNATURE-----
Bug archived.
Request was from Debbugs Internal Request <owner@bugs.debian.org>
to internal_control@bugs.debian.org.
(Fri, 12 Sep 2014 07:30:12 GMT) (full text, mbox, link).
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Thu Jul 23 22:39:43 2020;
Machine Name:
bembo
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.