[pve-devel] [PATCH V2 qemu-server 0/2] enable balloon free-page-reporting

2022-03-06 Thread Alexandre Derumier
Hi,

Currently, if a guest vm allocate a memory page, and freed it later in the 
guest,
the memory is not freed on the host side.

Balloon device have a new option since qemu 5.1 "free-page-reporting" (and need 
host kernel 5.7)

https://events19.linuxfoundation.org/wp-content/uploads/2017/12/KVMForum2018.pdf
https://lwn.net/Articles/759413/

This is working like the discard option for disk, memory is freed async by the 
host when vm is freeing it.

I'm running it production since 1 month without any problem. With a lot of vms 
and spiky workload, the memory
freed is really huge.

Here an example of a host with 650GB+200GB ksm going down to 250GB memory
https://mutulin1.odiso.net/ballon-size.png
(around 400vms with 2GB max memory, previously always allocated)


This patch enabled it by default force machine version >= 6.2.


changelogv2:

- enabled it only for machine version > 6.2
- add test

Alexandre Derumier (2):
  enable balloon free-page-reporting
  add test for virtio-balloon free-page-reporting=on. (qemu 6.2)

 PVE/QemuServer.pm |  4 ++-
 test/cfg2cmd/q35-simple-7.0.conf.cmd  |  2 +-
 .../simple-balloon-free-page-reporting.conf   | 15 +
 ...imple-balloon-free-page-reporting.conf.cmd | 33 +++
 4 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 test/cfg2cmd/simple-balloon-free-page-reporting.conf
 create mode 100644 test/cfg2cmd/simple-balloon-free-page-reporting.conf.cmd

-- 
2.30.2


___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



[pve-devel] [PATCH V2 qemu-server 1/2] enable balloon free-page-reporting

2022-03-06 Thread Alexandre Derumier
Allow balloon device  driver to report hints of guest free pages to the host,
for auto memory reclaim

https://lwn.net/Articles/759413/
https://events19.linuxfoundation.org/wp-content/uploads/2017/12/KVMForum2018.pdf
Signed-off-by: Alexandre Derumier 
---
 PVE/QemuServer.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 42f0fbd..a9e86b3 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3846,7 +3846,9 @@ sub config_to_command {
 # enable balloon by default, unless explicitly disabled
 if (!defined($conf->{balloon}) || $conf->{balloon}) {
my $pciaddr = print_pci_addr("balloon0", $bridges, $arch, 
$machine_type);
-   push @$devices, '-device', "virtio-balloon-pci,id=balloon0$pciaddr";
+   my $ballooncmd = "virtio-balloon-pci,id=balloon0$pciaddr";
+   $ballooncmd .= ",free-page-reporting=on" if 
min_version($machine_version, 6, 2);
+   push @$devices, '-device', $ballooncmd;
 }
 
 if ($conf->{watchdog}) {
-- 
2.30.2


___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



[pve-devel] [PATCH V2 qemu-server 2/2] add test for virtio-balloon free-page-reporting=on. (qemu 6.2)

2022-03-06 Thread Alexandre Derumier
Signed-off-by: Alexandre Derumier 
---
 test/cfg2cmd/q35-simple-7.0.conf.cmd  |  2 +-
 .../simple-balloon-free-page-reporting.conf   | 15 +
 ...imple-balloon-free-page-reporting.conf.cmd | 33 +++
 3 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 test/cfg2cmd/simple-balloon-free-page-reporting.conf
 create mode 100644 test/cfg2cmd/simple-balloon-free-page-reporting.conf.cmd

diff --git a/test/cfg2cmd/q35-simple-7.0.conf.cmd 
b/test/cfg2cmd/q35-simple-7.0.conf.cmd
index 5045caf..be7a36c 100644
--- a/test/cfg2cmd/q35-simple-7.0.conf.cmd
+++ b/test/cfg2cmd/q35-simple-7.0.conf.cmd
@@ -21,7 +21,7 @@
   -device 'vmgenid,guid=54d1c06c-8f5b-440f-b5b2-6eab1380e13d' \
   -device 'usb-tablet,id=tablet,bus=ehci.0,port=1' \
   -device 'VGA,id=vga,bus=pcie.0,addr=0x1' \
-  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \
+  -device 
'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \
   -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
   -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=2E:01:68:F9:9C:87,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'
 \
diff --git a/test/cfg2cmd/simple-balloon-free-page-reporting.conf 
b/test/cfg2cmd/simple-balloon-free-page-reporting.conf
new file mode 100644
index 000..e7cd1e4
--- /dev/null
+++ b/test/cfg2cmd/simple-balloon-free-page-reporting.conf
@@ -0,0 +1,15 @@
+# TEST: Simple test for balloon free page reporting enabled by default on 6.2
+# QEMU_VERSION: 6.2
+bootdisk: scsi0
+cores: 3
+ide2: none,media=cdrom
+memory: 768
+name: simple
+net0: virtio=A2:C0:43:77:08:A0,bridge=vmbr0
+numa: 0
+ostype: l26
+scsi0: local:8006/vm-8006-disk-0.qcow2,discard=on,size=104858K
+scsihw: virtio-scsi-pci
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+sockets: 1
+vmgenid: c773c261-d800-4348-1010-1010add53cf8
diff --git a/test/cfg2cmd/simple-balloon-free-page-reporting.conf.cmd 
b/test/cfg2cmd/simple-balloon-free-page-reporting.conf.cmd
new file mode 100644
index 000..232e348
--- /dev/null
+++ b/test/cfg2cmd/simple-balloon-free-page-reporting.conf.cmd
@@ -0,0 +1,33 @@
+/usr/bin/kvm \
+  -id 8006 \
+  -name simple \
+  -no-shutdown \
+  -chardev 
'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -mon 'chardev=qmp,mode=control' \
+  -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' \
+  -mon 'chardev=qmp-event,mode=control' \
+  -pidfile /var/run/qemu-server/8006.pid \
+  -daemonize \
+  -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \
+  -smp '3,sockets=1,cores=3,maxcpus=3' \
+  -nodefaults \
+  -boot 
'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg'
 \
+  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
+  -m 768 \
+  -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \
+  -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \
+  -device 'vmgenid,guid=c773c261-d800-4348-1010-1010add53cf8' \
+  -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \
+  -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \
+  -device 'VGA,id=vga,bus=pci.0,addr=0x2' \
+  -device 
'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -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.qcow2,if=none,id=drive-scsi0,discard=on,format=qcow2,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:A0,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'
 \
+  -machine 'type=pc+pve0'
-- 
2.30.2


___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



[pve-devel] [PATCH docs] storage: rbd: add optional ceph client configuration

2022-03-06 Thread Alwin Antreich via pve-devel
--- Begin Message ---
Signed-off-by: Alwin Antreich 
---
 pve-storage-rbd.adoc | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/pve-storage-rbd.adoc b/pve-storage-rbd.adoc
index cd3fb2e..5f8619a 100644
--- a/pve-storage-rbd.adoc
+++ b/pve-storage-rbd.adoc
@@ -106,6 +106,25 @@ TIP: Creating a keyring with only the needed capabilities 
is recommend when
 connecting to an external cluster. For further information on Ceph user
 management, see the Ceph 
docs.footnoteref:[cephusermgmt,{cephdocs-url}/rados/operations/user-management/[Ceph
 User Management]]
 
+Ceph client configuration (optional)
+
+
+Connecting to an external ceph storage doesn't always allow setting
+client-specific options in the config DB on the external cluster. You can add a
+`ceph.conf` beside the ceph keyring to change the ceph client configuration for
+the storage.
+
+The ceph.conf needs to have the same name as the storage.
+
+
+# /etc/pve/priv/ceph/.conf
+
+
+See the RBD configuration reference footnote:[RBD configuration reference
+{cephdocs-url}/rbd/rbd-config-ref/] for possible settings.
+
+NOTE: Do not change these settings lightly. {PVE} is merging the
+.conf with the storage configuration.
 
 
 Storage Features
-- 
2.35.1


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH pve-manager v2] fix #3903: jobs: add remove vmid from jobs helper

2022-03-06 Thread Hannes Laimer
Signed-off-by: Hannes Laimer 
---
changed back to v1, but without the unnecessary stuff. Thanks for the
feedback @Fabian Ebner

 PVE/Jobs.pm | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/PVE/Jobs.pm b/PVE/Jobs.pm
index ba3685ec..db6fa97d 100644
--- a/PVE/Jobs.pm
+++ b/PVE/Jobs.pm
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use JSON;
 
-use PVE::Cluster qw(cfs_read_file cfs_lock_file);
+use PVE::Cluster qw(cfs_read_file cfs_lock_file cfs_write_file);
 use PVE::Jobs::Plugin;
 use PVE::Jobs::VZDump;
 use PVE::Tools;
@@ -274,6 +274,21 @@ sub synchronize_job_states_with_config {
 die $@ if $@;
 }
 
+sub remove_vmid_from_jobs {
+my ($vmid) = @_;
+
+cfs_lock_file('jobs.cfg', undef, sub {
+   my $jobs_data = cfs_read_file('jobs.cfg');
+   for my $id (keys %{$jobs_data->{ids}}) {
+   my $job = $jobs_data->{ids}->{$id};
+   next if !defined($job->{vmid});
+   $job->{vmid} = join(',', grep { $_ ne $vmid } 
PVE::Tools::split_list($job->{vmid}));
+   delete $jobs_data->{ids}->{$id} if $job->{vmid} eq '';
+   }
+cfs_write_file('jobs.cfg', $jobs_data);
+});
+}
+
 sub setup_dirs {
 mkdir $state_dir;
 mkdir $lock_dir;
-- 
2.30.2



___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel