From: ching <lsching17@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] check trim/unmap
Date: Thu, 30 Jan 2014 06:47:41 +0800 [thread overview]
Message-ID: <52E9850D.4040405@gmail.com> (raw)
In-Reply-To: <52E79FDF.6050502@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4085 bytes --]
My updated config is Gentoo x64 stable branch, kernel 3.10, libvirt 1.2.1, qemu 1.7.0, lvm2(non-thin) on ssd
i attach a lvm (non-thin) partition to a vm
<disk type='block' device='disk'>
<driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/>
<source dev='/dev/volume_group/temp'/>
<target dev='sdb' bus='sata'/>
<boot order='2'/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
and the qemu command line captured:
LC_ALL=C PATH=/bin:/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin HOME=/ USER=root QEMU_AUDIO_DRV=spice /usr/bin/qemu-system-x86_64 -name Temp -S -machine pc-i440fx-1.7,accel=kvm,usb=off -cpu SandyBridge,+osxsave,+pcid,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme -m 4096 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 79f72ed3-1e27-a518-4ea9-ec8385982af0 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/Temp.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x9 -device ahci,id=ahci0,bus=pci.0,addr=0x4 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive
file=/tmp/cdrom.iso,if=none,media=cdrom,id=drive-sata0-0-0,readonly=on,format=raw,cache=unsafe,aio=native -device ide-cd,bus=ahci0.0,drive=drive-sata0-0-0,id=sata0-0-0,bootindex=1 -drive file=/dev/volume_group/temp,if=none,id=drive-sata0-0-1,format=raw,cache=none,discard=unmap,aio=native -device ide-hd,bus=ahci0.1,drive=drive-sata0-0-1,id=sata0-0-1,bootindex=2 -netdev tap,fd=19,id=hostnet0,vhost=on,vhostfd=20 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:0c:29:09:8c:bc,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -spice port=5900,addr=127.0.0.1,disable-ticketing,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0xb -device hda-micro,id=sound0-codec0,bus=sound0.0,cad=0
-chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
In the linux guest, i try "hdparm -I /dev/sda", and there is trim feature listed.
is there any thing i am missing?
ching
On 28/01/2014 08:17 PM, ching wrote:
> Thanks for the information. Hopefully, there will be better debug/tracing facility for this. This is useful for sysadmin to ensure the whole storage stack is functioning as expected.
>
> ching
>
>
> On 28/01/2014 06:46 PM, Paolo Bonzini wrote:
>> Il 28/01/2014 11:31, ching ha scritto:
>>> My config is Gentoo x64 stable branch, kernel 3.10, libvirt 1.1.3, qemu 1.5, lvm2(non-thin) on ssd
>>>
>>> How can i check that if:
>>> 1. qemu receives trim/unmap from guest
>>> 2. qemu is punching hole/issue blkdiscards/writing zeros?
>>
>> First of all, I suggest that you use current QEMU git. The trim/unmap feature was completed after 1.7 was released.
>>
>> To use trim/discard, you need to use the discard=on option for QEMU's -drive command-line option. You also need to use cache=none (because of a Linux kernel bug, QEMU may disable thin provisioning in other cache modes).
>>
>> In libvirt, this means adding cache='none and discard='on' like this:
>>
>> <driver name='qemu' type='qcow2' cache='none' discard='on'/>
>>
>> You can check if QEMU is punching a hole into a file using "qemu-img map" on the file. You must not run "qemu-img map" while the VM is running though; that can give incorrect results. There is no equivalent for block devices yet.
>>
>> Paolo
>
[-- Attachment #2: Screenshot - 29012014 - 09:34:39 PM.png --]
[-- Type: image/png, Size: 69682 bytes --]
next prev parent reply other threads:[~2014-01-29 22:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-28 10:31 [Qemu-devel] check trim/unmap ching
2014-01-28 10:46 ` Paolo Bonzini
2014-01-28 12:17 ` ching
2014-01-29 22:47 ` ching [this message]
2014-01-30 12:16 ` ching
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=52E9850D.4040405@gmail.com \
--to=lsching17@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).