몇 가지 성능 문제가 궁금합니다. 구현에 몇 가지 문제가 있지만 현재 초점은 그게 아닙니다. 나는 딸들이 동시에 마인크래프트를 플레이할 수 있도록 컴퓨터를 만들었습니다. 이를 달성하기 위해 Linux KVM을 사용합니다. 게스트는 Windows 10을 사용하고 있습니다.
저는 이 작업을 CLI를 사용하는 방법과 virt-manager를 사용하는 두 가지 방법으로 수행했습니다.
CLI 버전은 다음과 같습니다
qemu-system-x86_64 -enable-kvm -M q35 -m 3072 -cpu host \
-smp 2,sockets=1,cores=2,threads=1 \
-bios /usr/share/qemu/bios.bin -vga none \
-device virtio-scsi-pci,id=scsi \
-drive file=/srv/wip.img,format=raw,id=disk,if=none,cache=none,aio=native \
-device scsi-hd,drive=disk \
-cdrom /home/driz/win10.iso \
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
-device virtio-net-pci,mac=52:54:00:ea:c8:8d \
-usb -usbdevice host:040b:2000 -usbdevice host:046d:c01e -usbdevice host:0d8c:0014 \
-boot menu=on
지금은 그래픽 패스스루와 USB 패스스루를 무시할 수 있습니다(요소가 아닌 한). 내가 지금 하고 있는 일을 올바르게 이해하고 있다고 가정하면 virtio scsi 컨트롤러와 원시 스토리지를 사용하여 scsi 디스크가 연결되어 있습니다. Windows 10을 설치하기 위해 CD를 설치했습니다(설치하는 동안 qemu windows를 사용하여 디스크의 virtio 드라이버로 교체했습니다). 이 설치에는 시간이 오래 걸리고 디스크 성능도 좋지 않은 것 같습니다. 실제 Windows 설치에는 약 20분이 소요됩니다.
반면에 virt-manager에서 동일한 설정이라고 생각되는 머신을 생성합니다(아래는 ps에서 가져온 명령줄입니다).
qemu-system-x86_64 -enable-kvm -name guest=win10,debug-threads=on -S \
-object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-2-win10/master-key.aes \
-machine pc-q35-2.6,accel=kvm,usb=off \
-cpu host,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff \
-drive file=/srv/ovmf-x64/OVMF_CODE-pure-efi.fd,if=pflash,format=raw,unit=0,readonly=on \
-drive file=/var/lib/libvirt/qemu/nvram/win10_VARS.fd,if=pflash,format=raw,unit=1 \
-m 3072 -realtime mlock=off -smp 1,maxcpus=2,sockets=1,cores=1,threads=2 \
-uuid 6529c02d-b03f-4adf-8cbf-58dc9227e976 -no-user-config -nodefaults \
-chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-2-win10/monitor.sock,server,nowait \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=localtime,driftfix=slew \
-global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-boot strict=on \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,addr=0x1d \
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 \
-device virtio-scsi-pci,id=scsi0,bus=pci.2,addr=0x3 \
-device virtio-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x4 \
-drive file=/srv/wip.img,format=raw,if=none,id=drive-scsi0-0-0-0,cache=none,aio=native \
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 \
-drive file=/srv/win10.iso,format=raw,if=none,media=cdrom,id=drive-sata0-0-1,readonly=on \
-device ide-cd,bus=ide.1,drive=drive-sata0-0-1,id=sata0-0-1 \
-drive file=/srv/virtio-win.iso,format=raw,if=none,media=cdrom,id=drive-sata0-0-2,readonly=on \
-device ide-cd,bus=ide.2,drive=drive-sata0-0-2,id=sata0-0-2 \
-netdev tap,fd=26,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:2b:38:74,bus=pci.2,addr=0x1 -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 \
-device usb-tablet,id=input0,bus=usb.0,port=1 \
-spice port=5900,addr=127.0.0.1,disable-ticketing,image-compression=off,seamless-migration=on \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pcie.0,addr=0x1 \
-device intel-hda,id=sound0,bus=pci.2,addr=0x2 \
-device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \
-chardev spicevmc,id=charredir0,name=usbredir \
-device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=2 \
-chardev spicevmc,id=charredir1,name=usbredir \
-device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=3 \
-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x5 \
-msg timestamp=on
Windows를 설치하는 데 약 7분이 소요됩니다. 두 경우 모두 원본 디스크 이미지는 dd를 사용하여 새로 생성되며 동일한 크기와 사양을 갖습니다. 두 경우 모두 (virt-manager를 사용하는 대신) 명령줄에서 dd를 통해 생성했습니다. 제 질문은 virt-manager를 사용하여 빌드하는 것이 CLI 빌드에 비해 훨씬 빠르게 설치되는 이유입니다. virt-manager 설정에 몇 가지 추가 컨트롤러가 있는 것을 보았지만 실제로는 이해가 되지 않습니다. 내가 본 주요 차이점은 CLI의 최상위 시나리오가 seabios이고 virt-manager 빌드가 uefi라는 것입니다. 이상한 점은 Windows 부팅 중에 일반적으로 uefi에 제조업체 로고가 표시되지만 마치 BIOS 부팅인 것처럼 Windows 로고가 표시된다는 것입니다. 가상이라서 그럴지도 모르지만 uefi라서 윈도우 부팅시 tiano 로고가 보이도록 하고 싶습니다.
virsh의 xml에 더 많은 정보가 표시될 수 있으므로 아래에 추가했습니다.
<domain type='kvm' id='2'>
<name>win10</name>
<uuid>6529c02d-b03f-4adf-8cbf-58dc9227e976</uuid>
<memory unit='KiB'>3145728</memory>
<currentMemory unit='KiB'>3145728</currentMemory>
<vcpu placement='static' current='1'>2</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-q35-2.6'>hvm</type>
<loader readonly='yes' type='pflash'>/srv/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
<nvram>/var/lib/libvirt/qemu/nvram/win10_VARS.fd</nvram>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<hyperv>
<relaxed state='on'/>
<vapic state='on'/>
<spinlocks state='on' retries='8191'/>
</hyperv>
</features>
<cpu mode='host-passthrough'>
<topology sockets='1' cores='1' threads='2'/>
</cpu>
<clock offset='localtime'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
<timer name='hypervclock' present='yes'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/kvm-spice</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none' io='native'/>
<source file='/srv/wip.img'/>
<backingStore/>
<target dev='sda' bus='scsi'/>
<alias name='scsi0-0-0-0'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/srv/win10.iso'/>
<backingStore/>
<target dev='sdb' bus='sata'/>
<readonly/>
<alias name='sata0-0-1'/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/srv/virtio-win.iso'/>
<backingStore/>
<target dev='sdc' bus='sata'/>
<readonly/>
<alias name='sata0-0-2'/>
<address type='drive' controller='0' bus='0' target='0' unit='2'/>
</disk>
<controller type='usb' index='0' model='ich9-ehci1'>
<alias name='usb'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
<alias name='usb'/>
<master startport='0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
<alias name='usb'/>
<master startport='2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
<alias name='usb'/>
<master startport='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/>
</controller>
<controller type='scsi' index='0' model='virtio-scsi'>
<alias name='scsi0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
</controller>
<controller type='sata' index='0'>
<alias name='ide'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pcie-root'>
<alias name='pcie.0'/>
</controller>
<controller type='pci' index='1' model='dmi-to-pci-bridge'>
<model name='i82801b11-bridge'/>
<alias name='pci.1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
</controller>
<controller type='pci' index='2' model='pci-bridge'>
<model name='pci-bridge'/>
<target chassisNr='2'/>
<alias name='pci.2'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</controller>
<controller type='virtio-serial' index='0'>
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
</controller>
<interface type='direct'>
<mac address='52:54:00:2b:38:74'/>
<source dev='enp0s31f6' mode='bridge'/>
<target dev='macvtap0'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/2'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/2'>
<source path='/dev/pts/2'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0' state='disconnected'/>
<alias name='channel0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='tablet' bus='usb'>
<alias name='input0'/>
<address type='usb' bus='0' port='1'/>
</input>
<input type='mouse' bus='ps2'>
<alias name='input1'/>
</input>
<input type='keyboard' bus='ps2'>
<alias name='input2'/>
</input>
<graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
<image compression='off'/>
</graphics>
<sound model='ich6'>
<alias name='sound0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
</sound>
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>
<redirdev bus='usb' type='spicevmc'>
<alias name='redir0'/>
<address type='usb' bus='0' port='2'/>
</redirdev>
<redirdev bus='usb' type='spicevmc'>
<alias name='redir1'/>
<address type='usb' bus='0' port='3'/>
</redirdev>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
</memballoon>
</devices>
<seclabel type='dynamic' model='apparmor' relabel='yes'>
<label>libvirt-6529c02d-b03f-4adf-8cbf-58dc9227e976</label>
<imagelabel>libvirt-6529c02d-b03f-4adf-8cbf-58dc9227e976</imagelabel>
</seclabel>
<seclabel type='dynamic' model='dac' relabel='yes'>
<label>+110:+111</label>
<imagelabel>+110:+111</imagelabel>
</seclabel>
</domain>