From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8qXv-0006cY-Ez for qemu-devel@nongnu.org; Thu, 30 Jan 2014 07:16:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8qXm-0002A8-Mz for qemu-devel@nongnu.org; Thu, 30 Jan 2014 07:16:39 -0500 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:52130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8qXm-000299-C1 for qemu-devel@nongnu.org; Thu, 30 Jan 2014 07:16:30 -0500 Received: by mail-pa0-f52.google.com with SMTP id bj1so3061606pad.11 for ; Thu, 30 Jan 2014 04:16:29 -0800 (PST) Message-ID: <52EA429A.6040305@gmail.com> Date: Thu, 30 Jan 2014 20:16:26 +0800 From: ching MIME-Version: 1.0 References: <42130e08.kqhkiG.143d8676094@gmail.com> <52E78A9C.2010903@redhat.com> <52E79FDF.6050502@gmail.com> In-Reply-To: <52E79FDF.6050502@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] check trim/unmap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org My updated config is Gentoo x64 stable branch, kernel 3.10, libvirt 1.2.1= , qemu 1.7.0, lvm2=EF=BC=88non-thin=EF=BC=89 on ssd i attach a lvm (non-thin) partition to a vm
and the qemu command line captured: LC_ALL=3DC PATH=3D/bin:/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin:/usr/= sbin:/usr/local/bin:/usr/local/sbin HOME=3D/ USER=3Droot QEMU_AUDIO_DRV=3D= spice /usr/bin/qemu-system-x86_64 -name Temp -S -machine pc-i440fx-1.7,ac= cel=3Dkvm,usb=3Doff -cpu SandyBridge,+osxsave,+pcid,+pdcm,+xtpr,+tm2,+est= ,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme -m 40= 96 -realtime mlock=3Doff -smp 1,sockets=3D1,cores=3D1,threads=3D1 -uuid 7= 9f72ed3-1e27-a518-4ea9-ec8385982af0 -no-user-config -nodefaults -chardev = socket,id=3Dcharmonitor,path=3D/var/lib/libvirt/qemu/Temp.monitor,server,= nowait -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol -rtc base=3D= utc,driftfix=3Dslew -global kvm-pit.lost_tick_policy=3Ddiscard -no-shutdo= wn -boot strict=3Don -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0= x1.0x2 -device virtio-scsi-pci,id=3Dscsi0,bus=3Dpci.0,addr=3D0x9 -device = ahci,id=3Dahci0,bus=3Dpci.0,addr=3D0x4 -device virtio-serial-pci,id=3Dvir= tio-serial0,bus=3Dpci.0,addr=3D0x5 -drive=20 file=3D/tmp/cdrom.iso,if=3Dnone,media=3Dcdrom,id=3Ddrive-sata0-0-0,readon= ly=3Don,format=3Draw,cache=3Dunsafe,aio=3Dnative -device ide-cd,bus=3Dahc= i0.0,drive=3Ddrive-sata0-0-0,id=3Dsata0-0-0,bootindex=3D1 -drive file=3D/= dev/volume_group/temp,if=3Dnone,id=3Ddrive-sata0-0-1,format=3Draw,cache=3D= none,discard=3Dunmap,aio=3Dnative -device ide-hd,bus=3Dahci0.1,drive=3Ddr= ive-sata0-0-1,id=3Dsata0-0-1,bootindex=3D2 -netdev tap,fd=3D19,id=3Dhostn= et0,vhost=3Don,vhostfd=3D20 -device virtio-net-pci,netdev=3Dhostnet0,id=3D= net0,mac=3D00:0c:29:09:8c:bc,bus=3Dpci.0,addr=3D0x3 -chardev pty,id=3Dcha= rserial0 -device isa-serial,chardev=3Dcharserial0,id=3Dserial0 -chardev s= picevmc,id=3Dcharchannel0,name=3Dvdagent -device virtserialport,bus=3Dvir= tio-serial0.0,nr=3D1,chardev=3Dcharchannel0,id=3Dchannel0,name=3Dcom.redh= at.spice.0 -spice port=3D5900,addr=3D127.0.0.1,disable-ticketing,seamless= -migration=3Don -device qxl-vga,id=3Dvideo0,ram_size=3D67108864,vram_size= =3D67108864,bus=3Dpci.0,addr=3D0x2 -device intel-hda,id=3Dsound0,bus=3Dpc= i.0,addr=3D0xb -device hda-micro,id=3Dsound0-codec0,bus=3Dsound0.0,cad=3D= 0=20 -chardev spicevmc,id=3Dcharredir0,name=3Dusbredir -device usb-redir,chard= ev=3Dcharredir0,id=3Dredir0 -device virtio-balloon-pci,id=3Dballoon0,bus=3D= pci.0,addr=3D0x6 In the linux guest, i try "hdparm -I /dev/sda | grep TRIM", but there is = no 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/traci= ng facility for this. This is useful for sysadmin to ensure the whole sto= rage 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, qe= mu 1.5, lvm2=EF=BC=88non-thin=EF=BC=89 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=3Don option for QEMU'= s -drive command-line option. You also need to use cache=3Dnone (because= of a Linux kernel bug, QEMU may disable thin provisioning in other cache= modes). >> >> In libvirt, this means adding cache=3D'none and discard=3D'on' like th= is: >> >> >> >> You can check if QEMU is punching a hole into a file using "qemu-img m= ap" 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 blo= ck devices yet. >> >> Paolo >