* [pve-devel] [PATCH v2 qemu-server 1/2] enable io-uring support @ 2021-06-21 15:33 Stefan Reiter 2021-06-21 15:33 ` [pve-devel] [PATCH v2 qemu-server 2/2] cfg2cmd: make io_uring default Stefan Reiter 2021-06-23 10:06 ` [pve-devel] applied-series: [PATCH v2 qemu-server 1/2] enable io-uring support Thomas Lamprecht 0 siblings, 2 replies; 4+ messages in thread From: Stefan Reiter @ 2021-06-21 15:33 UTC (permalink / raw) To: pve-devel Note that the value in this enum directly represents the value passed to QEMU, so we need to use the underscore. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> --- same as v1, par the commit message PVE/QemuServer/Drive.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PVE/QemuServer/Drive.pm b/PVE/QemuServer/Drive.pm index 146a4ab..82a6bfe 100644 --- a/PVE/QemuServer/Drive.pm +++ b/PVE/QemuServer/Drive.pm @@ -116,7 +116,7 @@ my %drivedesc_base = ( }, aio => { type => 'string', - enum => [qw(native threads)], + enum => [qw(native threads io_uring)], description => 'AIO type to use.', optional => 1, }, -- 2.30.2 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] [PATCH v2 qemu-server 2/2] cfg2cmd: make io_uring default 2021-06-21 15:33 [pve-devel] [PATCH v2 qemu-server 1/2] enable io-uring support Stefan Reiter @ 2021-06-21 15:33 ` Stefan Reiter 2021-06-21 16:13 ` Stefan Reiter 2021-06-23 10:06 ` [pve-devel] applied-series: [PATCH v2 qemu-server 1/2] enable io-uring support Thomas Lamprecht 1 sibling, 1 reply; 4+ messages in thread From: Stefan Reiter @ 2021-06-21 15:33 UTC (permalink / raw) To: pve-devel The 'aio' setting is not visible to the guest, and so can be changed during migrations or snapshots without issue. It is thus only dependendent on the actual QEMU version being >= 6.0, not machine version. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> --- new in v2 tested migration from and to old, both worked without issue PVE/QemuServer.pm | 22 +++++++++++++------- test/cfg2cmd/pinned-version-pxe-pve.conf.cmd | 4 ++-- test/cfg2cmd/pinned-version-pxe.conf.cmd | 4 ++-- test/cfg2cmd/pinned-version.conf.cmd | 4 ++-- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index fe31741..07dd14a 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -1523,7 +1523,7 @@ sub get_initiator_name { } sub print_drive_commandline_full { - my ($storecfg, $vmid, $drive, $pbs_name) = @_; + my ($storecfg, $vmid, $drive, $pbs_name, $io_uring) = @_; my $path; my $volid = $drive->{file}; @@ -1599,12 +1599,17 @@ sub print_drive_commandline_full { $cache_direct = 1; } - # aio native works only with O_DIRECT if (!$drive->{aio}) { - if($cache_direct) { - $opts .= ",aio=native"; + if ($io_uring) { + # io_uring supports all cache modes + $opts .= ",aio=io_uring"; } else { - $opts .= ",aio=threads"; + # aio native works only with O_DIRECT + if($cache_direct) { + $opts .= ",aio=native"; + } else { + $opts .= ",aio=threads"; + } } } @@ -3667,7 +3672,8 @@ sub config_to_command { push @$devices, '-blockdev', print_pbs_blockdev($pbs_conf, $pbs_name); } - my $drive_cmd = print_drive_commandline_full($storecfg, $vmid, $drive, $pbs_name); + my $drive_cmd = print_drive_commandline_full( + $storecfg, $vmid, $drive, $pbs_name, min_version($kvmver, 6, 0)); # extra protection for templates, but SATA and IDE don't support it.. my $read_only = PVE::QemuConfig->is_template($conf) @@ -4081,7 +4087,9 @@ sub qemu_objectdel { sub qemu_driveadd { my ($storecfg, $vmid, $device) = @_; - my $drive = print_drive_commandline_full($storecfg, $vmid, $device); + my $kvmver = get_running_qemu_version($vmid); + my $io_uring = min_version($kvmver, 6, 0); + my $drive = print_drive_commandline_full($storecfg, $vmid, $device, undef, $io_uring); $drive =~ s/\\/\\\\/g; my $ret = PVE::QemuServer::Monitor::hmp_cmd($vmid, "drive_add auto \"$drive\""); diff --git a/test/cfg2cmd/pinned-version-pxe-pve.conf.cmd b/test/cfg2cmd/pinned-version-pxe-pve.conf.cmd index fd87f80..095b72e 100644 --- a/test/cfg2cmd/pinned-version-pxe-pve.conf.cmd +++ b/test/cfg2cmd/pinned-version-pxe-pve.conf.cmd @@ -23,10 +23,10 @@ -device 'virtio-rng-pci,rng=rng0,max-bytes=1024,period=1000,bus=pci.1,addr=0x1d' \ -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ - -drive 'if=none,id=drive-ide2,media=cdrom,aio=threads' \ + -drive 'if=none,id=drive-ide2,media=cdrom,aio=io_uring' \ -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' \ -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \ - -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=native,detect-zeroes=unmap' \ + -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=io_uring,detect-zeroes=unmap' \ -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100' \ -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \ -device 'virtio-net-pci,mac=A2:C0:43:77:08:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300,romfile=pxe-virtio.rom' \ diff --git a/test/cfg2cmd/pinned-version-pxe.conf.cmd b/test/cfg2cmd/pinned-version-pxe.conf.cmd index 215df3a..5f738f3 100644 --- a/test/cfg2cmd/pinned-version-pxe.conf.cmd +++ b/test/cfg2cmd/pinned-version-pxe.conf.cmd @@ -21,10 +21,10 @@ -device 'VGA,id=vga,bus=pcie.0,addr=0x1' \ -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ - -drive 'if=none,id=drive-ide2,media=cdrom,aio=threads' \ + -drive 'if=none,id=drive-ide2,media=cdrom,aio=io_uring' \ -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' \ -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \ - -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=native,detect-zeroes=unmap' \ + -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=io_uring,detect-zeroes=unmap' \ -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100' \ -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \ -device 'virtio-net-pci,mac=A2:C0:43:77:08:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300,romfile=pxe-virtio.rom' \ diff --git a/test/cfg2cmd/pinned-version.conf.cmd b/test/cfg2cmd/pinned-version.conf.cmd index 6b01dcf..e072491 100644 --- a/test/cfg2cmd/pinned-version.conf.cmd +++ b/test/cfg2cmd/pinned-version.conf.cmd @@ -21,10 +21,10 @@ -device 'VGA,id=vga,bus=pcie.0,addr=0x1' \ -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ - -drive 'if=none,id=drive-ide2,media=cdrom,aio=threads' \ + -drive 'if=none,id=drive-ide2,media=cdrom,aio=io_uring' \ -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' \ -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \ - -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=native,detect-zeroes=unmap' \ + -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=io_uring,detect-zeroes=unmap' \ -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100' \ -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \ -device 'virtio-net-pci,mac=A2:C0:43:77:08:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300' \ -- 2.30.2 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pve-devel] [PATCH v2 qemu-server 2/2] cfg2cmd: make io_uring default 2021-06-21 15:33 ` [pve-devel] [PATCH v2 qemu-server 2/2] cfg2cmd: make io_uring default Stefan Reiter @ 2021-06-21 16:13 ` Stefan Reiter 0 siblings, 0 replies; 4+ messages in thread From: Stefan Reiter @ 2021-06-21 16:13 UTC (permalink / raw) To: pve-devel Note: This does not work when you have the 6.0 QEMU from the staging repo installed, as it is built without io_uring - this patch is banking on us only releasing a QEMU 6.0 to public with io_uring already baked in, i.e. equating QEMU 6.0 with io_uring support enabled. Adding a +pve version or similar for a version that'll probably never leave staging seemed unnecessary. For testing, build pve-qemu-kvm from git, as io_uring is already enabled there. On 6/21/21 5:33 PM, Stefan Reiter wrote: > The 'aio' setting is not visible to the guest, and so can be changed > during migrations or snapshots without issue. It is thus only > dependendent on the actual QEMU version being >= 6.0, not machine > version. > > Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> > --- > > new in v2 > > tested migration from and to old, both worked without issue > > PVE/QemuServer.pm | 22 +++++++++++++------- > test/cfg2cmd/pinned-version-pxe-pve.conf.cmd | 4 ++-- > test/cfg2cmd/pinned-version-pxe.conf.cmd | 4 ++-- > test/cfg2cmd/pinned-version.conf.cmd | 4 ++-- > 4 files changed, 21 insertions(+), 13 deletions(-) > > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm > index fe31741..07dd14a 100644 > --- a/PVE/QemuServer.pm > +++ b/PVE/QemuServer.pm > @@ -1523,7 +1523,7 @@ sub get_initiator_name { > } > > sub print_drive_commandline_full { > - my ($storecfg, $vmid, $drive, $pbs_name) = @_; > + my ($storecfg, $vmid, $drive, $pbs_name, $io_uring) = @_; > > my $path; > my $volid = $drive->{file}; > @@ -1599,12 +1599,17 @@ sub print_drive_commandline_full { > $cache_direct = 1; > } > > - # aio native works only with O_DIRECT > if (!$drive->{aio}) { > - if($cache_direct) { > - $opts .= ",aio=native"; > + if ($io_uring) { > + # io_uring supports all cache modes > + $opts .= ",aio=io_uring"; > } else { > - $opts .= ",aio=threads"; > + # aio native works only with O_DIRECT > + if($cache_direct) { > + $opts .= ",aio=native"; > + } else { > + $opts .= ",aio=threads"; > + } > } > } > > @@ -3667,7 +3672,8 @@ sub config_to_command { > push @$devices, '-blockdev', print_pbs_blockdev($pbs_conf, $pbs_name); > } > > - my $drive_cmd = print_drive_commandline_full($storecfg, $vmid, $drive, $pbs_name); > + my $drive_cmd = print_drive_commandline_full( > + $storecfg, $vmid, $drive, $pbs_name, min_version($kvmver, 6, 0)); > > # extra protection for templates, but SATA and IDE don't support it.. > my $read_only = PVE::QemuConfig->is_template($conf) > @@ -4081,7 +4087,9 @@ sub qemu_objectdel { > sub qemu_driveadd { > my ($storecfg, $vmid, $device) = @_; > > - my $drive = print_drive_commandline_full($storecfg, $vmid, $device); > + my $kvmver = get_running_qemu_version($vmid); > + my $io_uring = min_version($kvmver, 6, 0); > + my $drive = print_drive_commandline_full($storecfg, $vmid, $device, undef, $io_uring); > $drive =~ s/\\/\\\\/g; > my $ret = PVE::QemuServer::Monitor::hmp_cmd($vmid, "drive_add auto \"$drive\""); > > diff --git a/test/cfg2cmd/pinned-version-pxe-pve.conf.cmd b/test/cfg2cmd/pinned-version-pxe-pve.conf.cmd > index fd87f80..095b72e 100644 > --- a/test/cfg2cmd/pinned-version-pxe-pve.conf.cmd > +++ b/test/cfg2cmd/pinned-version-pxe-pve.conf.cmd > @@ -23,10 +23,10 @@ > -device 'virtio-rng-pci,rng=rng0,max-bytes=1024,period=1000,bus=pci.1,addr=0x1d' \ > -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ > -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ > - -drive 'if=none,id=drive-ide2,media=cdrom,aio=threads' \ > + -drive 'if=none,id=drive-ide2,media=cdrom,aio=io_uring' \ > -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' \ > -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \ > - -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=native,detect-zeroes=unmap' \ > + -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=io_uring,detect-zeroes=unmap' \ > -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100' \ > -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \ > -device 'virtio-net-pci,mac=A2:C0:43:77:08:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300,romfile=pxe-virtio.rom' \ > diff --git a/test/cfg2cmd/pinned-version-pxe.conf.cmd b/test/cfg2cmd/pinned-version-pxe.conf.cmd > index 215df3a..5f738f3 100644 > --- a/test/cfg2cmd/pinned-version-pxe.conf.cmd > +++ b/test/cfg2cmd/pinned-version-pxe.conf.cmd > @@ -21,10 +21,10 @@ > -device 'VGA,id=vga,bus=pcie.0,addr=0x1' \ > -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ > -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ > - -drive 'if=none,id=drive-ide2,media=cdrom,aio=threads' \ > + -drive 'if=none,id=drive-ide2,media=cdrom,aio=io_uring' \ > -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' \ > -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \ > - -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=native,detect-zeroes=unmap' \ > + -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=io_uring,detect-zeroes=unmap' \ > -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100' \ > -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \ > -device 'virtio-net-pci,mac=A2:C0:43:77:08:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300,romfile=pxe-virtio.rom' \ > diff --git a/test/cfg2cmd/pinned-version.conf.cmd b/test/cfg2cmd/pinned-version.conf.cmd > index 6b01dcf..e072491 100644 > --- a/test/cfg2cmd/pinned-version.conf.cmd > +++ b/test/cfg2cmd/pinned-version.conf.cmd > @@ -21,10 +21,10 @@ > -device 'VGA,id=vga,bus=pcie.0,addr=0x1' \ > -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ > -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ > - -drive 'if=none,id=drive-ide2,media=cdrom,aio=threads' \ > + -drive 'if=none,id=drive-ide2,media=cdrom,aio=io_uring' \ > -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' \ > -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \ > - -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=native,detect-zeroes=unmap' \ > + -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.raw,if=none,id=drive-scsi0,discard=on,format=raw,cache=none,aio=io_uring,detect-zeroes=unmap' \ > -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100' \ > -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \ > -device 'virtio-net-pci,mac=A2:C0:43:77:08:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300' \ > ^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] applied-series: [PATCH v2 qemu-server 1/2] enable io-uring support 2021-06-21 15:33 [pve-devel] [PATCH v2 qemu-server 1/2] enable io-uring support Stefan Reiter 2021-06-21 15:33 ` [pve-devel] [PATCH v2 qemu-server 2/2] cfg2cmd: make io_uring default Stefan Reiter @ 2021-06-23 10:06 ` Thomas Lamprecht 1 sibling, 0 replies; 4+ messages in thread From: Thomas Lamprecht @ 2021-06-23 10:06 UTC (permalink / raw) To: Proxmox VE development discussion, Stefan Reiter On 21.06.21 17:33, Stefan Reiter wrote: > Note that the value in this enum directly represents the value passed to > QEMU, so we need to use the underscore. > > Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> > --- > > same as v1, par the commit message > > PVE/QemuServer/Drive.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > applied both patches, thanks! ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-23 10:06 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-06-21 15:33 [pve-devel] [PATCH v2 qemu-server 1/2] enable io-uring support Stefan Reiter 2021-06-21 15:33 ` [pve-devel] [PATCH v2 qemu-server 2/2] cfg2cmd: make io_uring default Stefan Reiter 2021-06-21 16:13 ` Stefan Reiter 2021-06-23 10:06 ` [pve-devel] applied-series: [PATCH v2 qemu-server 1/2] enable io-uring support Thomas Lamprecht
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox