[pve-devel] [PATCH 5/9] cleanups 2

Stefan Priebe s.priebe at profihost.ag
Mon Feb 11 10:27:33 CET 2013


- remove old unused patches

Signed-off-by: Stefan Priebe <s.priebe at profihost.ag>
---
 debian/patches/ahci-add_migration-support.patch    |  154 ---------
 .../patches/always-update-expected-downtime.patch  |   13 -
 debian/patches/cpuid-fix.diff                      |   18 --
 debian/patches/live-migration-fixes.diff           |   48 ---
 debian/patches/multicore.diff                      |  201 ------------
 debian/patches/ps2-queue-size.diff                 |   20 --
 debian/patches/use-local-linux-kvm-h.diff          |   16 -
 debian/patches/virtio-balloon-document-stats.patch |  159 ----------
 .../virtio-balloon-drop-old-stats-code.patch       |   50 ---
 debian/patches/virtio-balloon-fix-query.patch      |  125 --------
 .../virtio-balloon-re-enable-balloon-stats.patch   |  333 --------------------
 debian/patches/vncticket.diff                      |  149 ---------
 12 files changed, 1286 deletions(-)
 delete mode 100644 debian/patches/ahci-add_migration-support.patch
 delete mode 100644 debian/patches/always-update-expected-downtime.patch
 delete mode 100644 debian/patches/cpuid-fix.diff
 delete mode 100644 debian/patches/live-migration-fixes.diff
 delete mode 100644 debian/patches/multicore.diff
 delete mode 100644 debian/patches/ps2-queue-size.diff
 delete mode 100644 debian/patches/use-local-linux-kvm-h.diff
 delete mode 100644 debian/patches/virtio-balloon-document-stats.patch
 delete mode 100644 debian/patches/virtio-balloon-drop-old-stats-code.patch
 delete mode 100644 debian/patches/virtio-balloon-fix-query.patch
 delete mode 100644 debian/patches/virtio-balloon-re-enable-balloon-stats.patch
 delete mode 100644 debian/patches/vncticket.diff

diff --git a/debian/patches/ahci-add_migration-support.patch b/debian/patches/ahci-add_migration-support.patch
deleted file mode 100644
index a5791f7..0000000
--- a/debian/patches/ahci-add_migration-support.patch
+++ /dev/null
@@ -1,154 +0,0 @@
-From: 	Jason Baron
-Subject: 	[Qemu-devel] [PATCH] ahci: add migration support
-Date: 	Thu, 30 Aug 2012 14:00:04 -0400
-
-Add support for ahci migration. This patch builds upon the patches posted
-previously by Andreas Faerber:
-
-http://lists.gnu.org/archive/html/qemu-devel/2012-08/msg01538.html
-
-(I hope I am giving Andreas proper credit for his work.)
-
-I've tested these patches by migrating Windows 7 and Fedora 16 guests on
-both piix with ahci attached and on q35 (which has a built-in ahci controller).
-
-Signed-off-by: Jason Baron <address at hidden>
----
- hw/ide/ahci.c |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
- hw/ide/ahci.h |   10 +++++++++
- hw/ide/ich.c  |   11 +++++++--
- 3 files changed, 81 insertions(+), 4 deletions(-)
-
-Index: new/hw/ide/ahci.c
-===================================================================
---- new.orig/hw/ide/ahci.c	2012-09-24 07:15:00.000000000 +0200
-+++ new/hw/ide/ahci.c	2012-09-24 07:15:28.000000000 +0200
-@@ -1203,6 +1203,65 @@
-     }
- }
- 
-+static const VMStateDescription vmstate_ahci_device = {
-+    .name = "ahci port",
-+    .version_id = 1,
-+    .fields = (VMStateField []) {
-+        VMSTATE_IDE_BUS(port, AHCIDevice),
-+        VMSTATE_UINT32(port_state, AHCIDevice),
-+        VMSTATE_UINT32(finished, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.lst_addr, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.lst_addr_hi, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.fis_addr, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.fis_addr_hi, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.irq_stat, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.irq_mask, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.cmd, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.tfdata, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.sig, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.scr_stat, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.scr_ctl, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.scr_err, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.scr_act, AHCIDevice),
-+        VMSTATE_UINT32(port_regs.cmd_issue, AHCIDevice),
-+        VMSTATE_END_OF_LIST()
-+    },
-+};
-+
-+static int ahci_state_post_load(void *opaque, int version_id)
-+{
-+    int i;
-+    AHCIState *s = opaque;
-+
-+    for (i = 0; i < s->ports; i++) {
-+        AHCIPortRegs *pr = &s->dev[i].port_regs;
-+
-+        map_page(&s->dev[i].lst,
-+                 ((uint64_t)pr->lst_addr_hi << 32) | pr->lst_addr, 1024);
-+        map_page(&s->dev[i].res_fis,
-+                 ((uint64_t)pr->fis_addr_hi << 32) | pr->fis_addr, 256);
-+    }
-+
-+    return 0;
-+}
-+
-+const VMStateDescription vmstate_ahci = {
-+    .name = "ahci",
-+    .version_id = 1,
-+    .post_load = ahci_state_post_load,
-+    .fields = (VMStateField []) {
-+        VMSTATE_STRUCT_VARRAY_POINTER_INT32(dev, AHCIState, ports,
-+                                     vmstate_ahci_device, AHCIDevice),
-+        VMSTATE_UINT32(control_regs.cap, AHCIState),
-+        VMSTATE_UINT32(control_regs.ghc, AHCIState),
-+        VMSTATE_UINT32(control_regs.irqstatus, AHCIState),
-+        VMSTATE_UINT32(control_regs.impl, AHCIState),
-+        VMSTATE_UINT32(control_regs.version, AHCIState),
-+        VMSTATE_UINT32(idp_index, AHCIState),
-+        VMSTATE_END_OF_LIST()
-+    },
-+};
-+
- typedef struct SysbusAHCIState {
-     SysBusDevice busdev;
-     AHCIState ahci;
-@@ -1211,7 +1270,10 @@
- 
- static const VMStateDescription vmstate_sysbus_ahci = {
-     .name = "sysbus-ahci",
--    .unmigratable = 1,
-+    .fields = (VMStateField []) {
-+        VMSTATE_AHCI(ahci, AHCIPCIState),
-+        VMSTATE_END_OF_LIST()
-+    },
- };
- 
- static void sysbus_ahci_reset(DeviceState *dev)
-Index: new/hw/ide/ahci.h
-===================================================================
---- new.orig/hw/ide/ahci.h	2012-09-24 07:15:00.000000000 +0200
-+++ new/hw/ide/ahci.h	2012-09-24 07:15:28.000000000 +0200
-@@ -307,6 +307,16 @@
-     AHCIState ahci;
- } AHCIPCIState;
- 
-+extern const VMStateDescription vmstate_ahci;
-+
-+#define VMSTATE_AHCI(_field, _state) {                               \
-+    .name       = (stringify(_field)),                               \
-+    .size       = sizeof(AHCIState),                                 \
-+    .vmsd       = &vmstate_ahci,                                     \
-+    .flags      = VMS_STRUCT,                                        \
-+    .offset     = vmstate_offset_value(_state, _field, AHCIState),   \
-+}
-+
- typedef struct NCQFrame {
-     uint8_t fis_type;
-     uint8_t c;
-Index: new/hw/ide/ich.c
-===================================================================
---- new.orig/hw/ide/ich.c	2012-09-24 07:15:00.000000000 +0200
-+++ new/hw/ide/ich.c	2012-09-24 07:15:28.000000000 +0200
-@@ -79,9 +79,14 @@
- #define ICH9_IDP_INDEX          0x10
- #define ICH9_IDP_INDEX_LOG2     0x04
- 
--static const VMStateDescription vmstate_ahci = {
-+static const VMStateDescription vmstate_ich9_ahci = {
-     .name = "ahci",
--    .unmigratable = 1,
-+    .version_id = 1,
-+    .fields = (VMStateField []) {
-+        VMSTATE_PCI_DEVICE(card, AHCIPCIState),
-+        VMSTATE_AHCI(ahci, AHCIPCIState),
-+        VMSTATE_END_OF_LIST()
-+    },
- };
- 
- static void pci_ich9_reset(DeviceState *dev)
-@@ -152,7 +157,7 @@
-     k->device_id = PCI_DEVICE_ID_INTEL_82801IR;
-     k->revision = 0x02;
-     k->class_id = PCI_CLASS_STORAGE_SATA;
--    dc->vmsd = &vmstate_ahci;
-+    dc->vmsd = &vmstate_ich9_ahci;
-     dc->reset = pci_ich9_reset;
- }
- 
diff --git a/debian/patches/always-update-expected-downtime.patch b/debian/patches/always-update-expected-downtime.patch
deleted file mode 100644
index 015c912..0000000
--- a/debian/patches/always-update-expected-downtime.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: new/arch_init.c
-===================================================================
---- new.orig/arch_init.c	2012-12-27 12:28:50.000000000 +0100
-+++ new/arch_init.c	2012-12-27 12:29:24.000000000 +0100
-@@ -662,6 +662,8 @@
-     DPRINTF("ram_save_live: expected(%" PRIu64 ") <= max(" PRIu64 ")?\n",
-             expected_downtime, migrate_max_downtime());
- 
-+    s->expected_downtime = expected_downtime / 1000000; /* ns -> ms */
-+
-     if (expected_downtime <= migrate_max_downtime()) {
-         migration_bitmap_sync();
-         expected_downtime = ram_save_remaining() * TARGET_PAGE_SIZE / bwidth;
diff --git a/debian/patches/cpuid-fix.diff b/debian/patches/cpuid-fix.diff
deleted file mode 100644
index 1052ad5..0000000
--- a/debian/patches/cpuid-fix.diff
+++ /dev/null
@@ -1,18 +0,0 @@
-see http://git.kernel.org/?p=virt/kvm/qemu-kvm.git;a=commitdiff;h=8fa3b3ce6e#patch1
-
-KVM_GET_SUPPORTED_CPUID has been known to fail to return -E2BIG
-when it runs out of entries. Detect this by always trying again
-with a bigger table if the ioctl() fills the table.
-
---- a/kvm/libkvm/libkvm-x86.c
-+++ b/kvm/libkvm/libkvm-x86.c
-@@ -575,6 +575,8 @@ static struct kvm_cpuid2 *try_get_cpuid(kvm_context_t kvm, int max)
- 	r = ioctl(kvm->fd, KVM_GET_SUPPORTED_CPUID, cpuid);
- 	if (r == -1)
- 		r = -errno;
-+	else if (r == 0 && cpuid->nent >= max)
-+		r = -E2BIG;
- 	if (r < 0) {
- 		if (r == -E2BIG) {
- 			free(cpuid);
-
diff --git a/debian/patches/live-migration-fixes.diff b/debian/patches/live-migration-fixes.diff
deleted file mode 100644
index a7a2729..0000000
--- a/debian/patches/live-migration-fixes.diff
+++ /dev/null
@@ -1,48 +0,0 @@
-Index: new/arch_init.c
-===================================================================
---- new.orig/arch_init.c	2012-02-09 13:15:26.000000000 +0100
-+++ new/arch_init.c	2012-02-09 13:22:53.000000000 +0100
-@@ -264,6 +264,8 @@
-     uint64_t bytes_transferred_last;
-     double bwidth = 0;
-     uint64_t expected_time = 0;
-+    static int64_t starttime = 0;
-+    double timediff;
-     int ret;
- 
-     if (stage < 0) {
-@@ -299,10 +301,10 @@
-             qemu_put_buffer(f, (uint8_t *)block->idstr, strlen(block->idstr));
-             qemu_put_be64(f, block->length);
-         }
-+
-+	starttime = qemu_get_clock_ns(rt_clock);
-     }
- 
--    bytes_transferred_last = bytes_transferred;
--    bwidth = qemu_get_clock_ns(rt_clock);
- 
-     while ((ret = qemu_file_rate_limit(f)) == 0) {
-         int bytes_sent;
-@@ -318,8 +320,8 @@
-         return ret;
-     }
- 
--    bwidth = qemu_get_clock_ns(rt_clock) - bwidth;
--    bwidth = (bytes_transferred - bytes_transferred_last) / bwidth;
-+    timediff = qemu_get_clock_ns(rt_clock) - starttime;
-+    bwidth = bytes_transferred / timediff;
- 
-     /* if we haven't transferred anything this round, force expected_time to a
-      * a very high value, but without crashing */
-@@ -340,6 +342,10 @@
- 
-     qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
- 
-+    if ((stage == 2) && (bytes_transferred > 2*ram_bytes_total())) {
-+        return 1;
-+    }
-+
-     expected_time = ram_save_remaining() * TARGET_PAGE_SIZE / bwidth;
- 
-     return (stage == 2) && (expected_time <= migrate_max_downtime());
diff --git a/debian/patches/multicore.diff b/debian/patches/multicore.diff
deleted file mode 100644
index f4a4674..0000000
--- a/debian/patches/multicore.diff
+++ /dev/null
@@ -1,201 +0,0 @@
-Index: kvm-86/cpu-defs.h
-===================================================================
---- kvm-86.orig/cpu-defs.h	2009-09-24 14:19:14.000000000 +0200
-+++ kvm-86/cpu-defs.h	2009-09-24 14:47:00.000000000 +0200
-@@ -194,6 +194,8 @@
-     int cpu_index; /* CPU index (informative) */                        \
-     uint32_t host_tid; /* host thread ID */                             \
-     int numa_node; /* NUMA node this cpu is belonging to  */            \
-+    int nr_cores;  /* number of cores within this CPU package */        \
-+    int nr_threads;/* number of threads within this CPU */              \
-     int running; /* Nonzero if cpu is currently running(usermode).  */  \
-     int thread_id;							\
-     /* user data */                                                     \
-Index: kvm-86/target-i386/helper.c
-===================================================================
---- kvm-86.orig/target-i386/helper.c	2009-09-24 14:19:14.000000000 +0200
-+++ kvm-86/target-i386/helper.c	2009-09-24 14:50:18.000000000 +0200
-@@ -121,7 +121,7 @@
- #ifdef TARGET_X86_64
-     {
-         .name = "qemu64",
--        .level = 2,
-+        .level = 4,
-         .vendor1 = CPUID_VENDOR_AMD_1,
-         .vendor2 = CPUID_VENDOR_AMD_2,
-         .vendor3 = CPUID_VENDOR_AMD_3,
-@@ -192,7 +192,7 @@
- #endif
-     {
-         .name = "qemu32",
--        .level = 2,
-+        .level = 4,
-         .family = 6,
-         .model = 3,
-         .stepping = 3,
-@@ -1638,6 +1638,12 @@
-         *ebx = (env->cpuid_apic_id << 24) | 8 << 8; /* CLFLUSH size in quad words, Linux wants it. */
-         *ecx = env->cpuid_ext_features;
-         *edx = env->cpuid_features;
-+
-+        if (env->nr_cores * env->nr_threads > 1) {
-+	    *ebx |= (env->nr_cores * env->nr_threads) << 16;
-+	    *edx |= 1 << 28;    /* HTT bit */
-+        }
-+
-         break;
-     case 2:
-         /* cache info: needed for Pentium Pro compatibility */
-@@ -1648,21 +1654,29 @@
-         break;
-     case 4:
-         /* cache info: needed for Core compatibility */
-+        if (env->nr_cores > 1) {
-+        	*eax = (env->nr_cores - 1) << 26;
-+        } else {
-+        	*eax = 0;
-+        }
-         switch (count) {
-             case 0: /* L1 dcache info */
--                *eax = 0x0000121;
-+                *eax |= 0x0000121;
-                 *ebx = 0x1c0003f;
-                 *ecx = 0x000003f;
-                 *edx = 0x0000001;
-                 break;
-             case 1: /* L1 icache info */
--                *eax = 0x0000122;
-+                *eax |= 0x0000122;
-                 *ebx = 0x1c0003f;
-                 *ecx = 0x000003f;
-                 *edx = 0x0000001;
-                 break;
-             case 2: /* L2 cache info */
--                *eax = 0x0000143;
-+                *eax |= 0x0000143;
-+                if (env->nr_threads > 1) {
-+                    *eax |= (env->nr_threads - 1) << 14;
-+                }
-                 *ebx = 0x3c0003f;
-                 *ecx = 0x0000fff;
-                 *edx = 0x0000001;
-@@ -1715,6 +1729,16 @@
-         *ecx = env->cpuid_ext3_features;
-         *edx = env->cpuid_ext2_features;
- 
-+        if (env->nr_cores * env->nr_threads > 1) {
-+            uint32_t teax, tebx, tecx, tedx;
-+            cpu_x86_cpuid(env, 0, 0, &teax, &tebx, &tecx, &tedx);
-+            if ( tebx == CPUID_VENDOR_AMD_1 &&
-+                tedx == CPUID_VENDOR_AMD_2 &&
-+                tecx == CPUID_VENDOR_AMD_3) {
-+                *ecx |= 1 << 1;    /* CmpLegacy bit */
-+            }
-+	}
-+
-         if (kvm_enabled()) {
-             uint32_t h_eax, h_edx;
- 
-@@ -1790,6 +1814,9 @@
-         *ebx = 0;
-         *ecx = 0;
-         *edx = 0;
-+        if (env->nr_cores * env->nr_threads > 1) {
-+            *ecx |= (env->nr_cores * env->nr_threads) - 1;
-+        }
-         break;
-     case 0x8000000A:
-         *eax = 0x00000001; /* SVM Revision */
-Index: kvm-86/vl.c
-===================================================================
---- kvm-86.orig/vl.c	2009-09-24 14:30:14.000000000 +0200
-+++ kvm-86/vl.c	2009-09-24 14:47:00.000000000 +0200
-@@ -230,6 +230,8 @@
- const char *assigned_devices[MAX_DEV_ASSIGN_CMDLINE];
- int assigned_devices_index;
- int smp_cpus = 1;
-+int smp_cores = 1;
-+int smp_threads = 1;
- int fairsched_id = 0;
- const char *vnc_display;
- int acpi_enabled = 1;
-@@ -2499,6 +2501,52 @@
-     return;
- }
- 
-+static void smp_parse(const char *optarg)
-+{
-+    int smp, sockets = 0, threads = 0, cores = 0;
-+    char *endptr;
-+    char option[128];
-+
-+    smp = strtoul(optarg, &endptr, 10);
-+    if (endptr != optarg) {
-+        if (*endptr == ',') {
-+            endptr++;
-+        }
-+    }
-+    if (get_param_value(option, 128, "sockets", endptr) != 0)
-+        sockets = strtoull(option, NULL, 10);
-+    if (get_param_value(option, 128, "cores", endptr) != 0)
-+        cores = strtoull(option, NULL, 10);
-+    if (get_param_value(option, 128, "threads", endptr) != 0)
-+        threads = strtoull(option, NULL, 10);
-+
-+    /* compute missing values, prefer sockets over cores over threads */
-+    if (smp == 0 || sockets == 0) {
-+        sockets = sockets > 0 ? sockets : 1;
-+        cores = cores > 0 ? cores : 1;
-+        threads = threads > 0 ? threads : 1;
-+        if (smp == 0) {
-+            smp = cores * threads * sockets;
-+        } else {
-+            sockets = smp / (cores * threads);
-+        }
-+    } else {
-+        if (cores == 0) {
-+            threads = threads > 0 ? threads : 1;
-+            cores = smp / (sockets * threads);
-+        } else {
-+            if (sockets == 0) {
-+                sockets = smp / (cores * threads);
-+            } else {
-+                threads = smp / (cores * sockets);
-+            }
-+        }
-+    }
-+    smp_cpus = smp;
-+    smp_cores = cores > 0 ? cores : 1;
-+    smp_threads = threads > 0 ? threads : 1;
-+}
-+
- /***********************************************************/
- /* USB devices */
- 
-@@ -3727,6 +3775,8 @@
- 
-     if (kvm_enabled())
-         kvm_init_vcpu(env);
-+    env->nr_cores = smp_cores;
-+    env->nr_threads = smp_threads;
-     return;
- }
- 
-@@ -4060,6 +4110,8 @@
-         kvm_start_vcpu(env);
-     else
-         tcg_init_vcpu(env);
-+    env->nr_cores = smp_cores;
-+    env->nr_threads = smp_threads;
- }
- 
- void qemu_notify_event(void)
-@@ -5560,7 +5612,7 @@
-                 usb_devices_index++;
-                 break;
-             case QEMU_OPTION_smp:
--                smp_cpus = atoi(optarg);
-+                smp_parse(optarg);
-                 if (smp_cpus < 1) {
-                     fprintf(stderr, "Invalid number of CPUs\n");
-                     exit(1);
diff --git a/debian/patches/ps2-queue-size.diff b/debian/patches/ps2-queue-size.diff
deleted file mode 100644
index 58564bc..0000000
--- a/debian/patches/ps2-queue-size.diff
+++ /dev/null
@@ -1,20 +0,0 @@
-
-bug description: boot a guest, open VNC console, and when it's still in BIOS / bootloader sequence, type as many keys as you can, move your mouse as much as you can. If needed, just reboot the guest.
-
-Linux guest will boot with "i8042.c: No controller found" and no keyboard.
-
-Further discussion seem to lead to a conclusion that there is some obscure bug in Qemu BIOS which makes this problem visible.
-
-Index: kvm-86/hw/ps2.c
-===================================================================
---- kvm-86.orig/hw/ps2.c	2009-06-15 13:31:24.000000000 +0200
-+++ kvm-86/hw/ps2.c	2009-06-15 13:31:50.000000000 +0200
-@@ -70,7 +70,7 @@
- #define MOUSE_STATUS_ENABLED    0x20
- #define MOUSE_STATUS_SCALE21    0x10
- 
--#define PS2_QUEUE_SIZE 256
-+#define PS2_QUEUE_SIZE 15
- 
- typedef struct {
-     uint8_t data[PS2_QUEUE_SIZE];
diff --git a/debian/patches/use-local-linux-kvm-h.diff b/debian/patches/use-local-linux-kvm-h.diff
deleted file mode 100644
index 6990382..0000000
--- a/debian/patches/use-local-linux-kvm-h.diff
+++ /dev/null
@@ -1,16 +0,0 @@
-
-Alway use our own version.
-
-Index: new/kvm/libkvm/libkvm.h
-===================================================================
---- new.orig/kvm/libkvm/libkvm.h	2011-08-11 10:04:51.000000000 +0200
-+++ new/kvm/libkvm/libkvm.h	2011-08-11 10:10:13.000000000 +0200
-@@ -15,7 +15,7 @@
- #define __user /* temporary, until installed via make headers_install */
- #endif
- 
--#include <linux/kvm.h>
-+#include "linux/kvm.h"
- 
- #include <signal.h>
- 
diff --git a/debian/patches/virtio-balloon-document-stats.patch b/debian/patches/virtio-balloon-document-stats.patch
deleted file mode 100644
index aeebf38..0000000
--- a/debian/patches/virtio-balloon-document-stats.patch
+++ /dev/null
@@ -1,159 +0,0 @@
-From lcapitulino at redhat.com Fri Dec 14 16:49:59 2012
-Received: from rt.proxmox.com (192.168.2.18) by lisa.maurer-it.com
- (192.168.2.121) with Microsoft SMTP Server id 14.2.328.9; Fri, 14 Dec 2012
- 16:49:59 +0100
-Received: from proxmox.maurer-it.com (proxmox.maurer-it.com
- [192.168.2.110]) by rt.proxmox.com (Postfix) with ESMTP id 25351206E234	for
- <dietmar at proxmox.com>; Fri, 14 Dec 2012 16:49:59 +0100 (CET)
-Received: from proxmox.maurer-it.com (localhost.localdomain [127.0.0.1])	by
- proxmox.maurer-it.com (Proxmox) with ESMTP id 1AAA626A090F	for
- <dietmar at proxmox.com>; Fri, 14 Dec 2012 16:49:59 +0100 (CET)
-Received-SPF: pass (redhat.com: Sender is authorized to use
- 'lcapitulino at redhat.com' in 'mfrom' identity (mechanism
- 'include:spf-1.redhat.com' matched)) receiver=proxmox.maurer-it.com;
- identity=mailfrom; envelope-from="lcapitulino at redhat.com";
- helo=mx1.redhat.com; client-ip=209.132.183.28
-Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])	by
- proxmox.maurer-it.com (Proxmox) with ESMTP id EAC8B26A0914	for
- <dietmar at proxmox.com>; Fri, 14 Dec 2012 16:49:57 +0100 (CET)
-Received: from int-mx09.intmail.prod.int.phx2.redhat.com
- (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])	by mx1.redhat.com
- (8.14.4/8.14.4) with ESMTP id qBEFnnhC005826	(version=TLSv1/SSLv3
- cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);	Fri, 14 Dec 2012 10:49:49
- -0500
-Received: from localhost (ovpn-113-80.phx2.redhat.com [10.3.113.80])	by
- int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
- qBEFnlph004684;	Fri, 14 Dec 2012 10:49:48 -0500
-From: Luiz Capitulino <lcapitulino at redhat.com>
-To: <qemu-devel at nongnu.org>
-CC: <eblake at redhat.com>, <aliguori at us.ibm.com>, <agl at us.ibm.com>,
- <mdroth at linux.vnet.ibm.com>, <dietmar at proxmox.com>
-Subject: [PATCH 3/3] docs: document virtio-balloon stats
-Date: Fri, 14 Dec 2012 13:49:42 -0200
-Message-ID: <1355500182-12743-4-git-send-email-lcapitulino at redhat.com>
-In-Reply-To: <1355500182-12743-1-git-send-email-lcapitulino at redhat.com>
-References: <1355500182-12743-1-git-send-email-lcapitulino at redhat.com>
-X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
-X-Proxmox-CTCH-Refid:
- str=0001.0A0C0203.50CB4AA6.0198:SCFSTAT2484459,ss=1,re=-4.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0
-x-proxmoxspam-level: Spam detection results:  0 AWL                   
- -0.199 From: address is in the auto white-list RCVD_IN_DNSWL_HI          
- -5 Sender listed at http://www.dnswl.org/, high trust SPF_HELO_PASS        
-  -0.001 SPF: HELO matches SPF record SPF_PASS               -0.001 SPF:
- sender matches SPF record T_RP_MATCHES_RCVD       -0.01 Envelope sender
- domain matches handover relay domain
-Content-Type: text/plain
-Return-Path: lcapitulino at redhat.com
-X-MS-Exchange-Organization-AuthSource: lisa.maurer-it.com
-X-MS-Exchange-Organization-AuthAs: Anonymous
-MIME-Version: 1.0
-Content-Transfer-Encoding: 8bit
-
-Signed-off-by: Luiz Capitulino <lcapitulino at redhat.com>
----
- docs/virtio-balloon-stats.txt | 91 +++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 91 insertions(+)
- create mode 100644 docs/virtio-balloon-stats.txt
-
-diff --git a/docs/virtio-balloon-stats.txt b/docs/virtio-balloon-stats.txt
-new file mode 100644
-index 0000000..990e746
---- /dev/null
-+++ b/docs/virtio-balloon-stats.txt
-@@ -0,0 +1,91 @@
-+virtio balloon memory statistics
-+================================
-+
-+The virtio balloon driver supports guest memory statistics reporting. These
-+statistics are available to QEMU users as QOM (QEMU Object Model) device
-+properties via a polling mechanism.
-+
-+Basically, clients first have to enable polling, then they can query the
-+available statistics.
-+
-+There are two control properties and six memory statistics properties.
-+
-+The control properties are:
-+
-+ o stats-polling-interval: polling time interval in seconds, it can be:
-+
-+   > 0  enables polling in the specified interval. If polling is already
-+        enabled, the polling time interval will be changed to the new value
-+
-+   0    disables polling. Previous polled statistics are still valid and
-+        can be queried.
-+
-+ o stats-last-update: last stats update timestamp, in seconds
-+
-+The following statistics are available, all values are in bytes:
-+
-+ o stat-swap-in
-+ o stat-swap-out
-+ o stat-major-faults
-+ o stat-minor-faults
-+ o stat-free-memory
-+ o stat-total-memory
-+
-+Also, please note the following:
-+
-+ - If a statistic is queried before the timer is enabled or if the guest
-+   doesn't support a particular statistic, an error will be returned
-+
-+ - Previously polled statistics remain available even if the timer is
-+   later disabled
-+
-+ - Polling can be enabled even if the guest doesn't support memory
-+   statistics or its balloon driver hasn't been loaded. Applications
-+   can check this condition by checking that stats-last-update doesn't
-+   change
-+
-+ - The polling timer is only re-armed when the guest responds to the
-+   statistics request. This means that if a (buggy) guest doesn't
-+   ever respond to the request the timer will never be re-armed,
-+   which has the same effect as disabling polling
-+
-+Here are a few examples. The virtio-balloon device is assumed to be in the
-+'/machine/peripheral-anon/device[1]' QOM path.
-+
-+Enable polling with 2 seconds interval:
-+
-+{ "execute": "qom-set",
-+             "arguments": { "path": "/machine/peripheral-anon/device[1]",
-+			 "property": "stats-polling-interval", "value": 2 } }
-+
-+{ "return": {} }
-+
-+Change polling to 10 seconds:
-+
-+{ "execute": "qom-set",
-+             "arguments": { "path": "/machine/peripheral-anon/device[1]",
-+			 "property": "stats-polling-interval", "value": 10 } }
-+
-+{ "return": {} }
-+
-+Get last update timestamp and free memory stat:
-+
-+{ "execute": "qom-get",
-+  "arguments": { "path": "/machine/peripheral-anon/device[1]",
-+  "property": "stats-last-update" } }
-+
-+{ "return": 1354629634 }
-+
-+{ "execute": "qom-get",
-+  "arguments": { "path": "/machine/peripheral-anon/device[1]",
-+  "property": "stat-free-memory" } }
-+
-+{ "return": 845115392 }
-+
-+Disable polling:
-+
-+{ "execute": "qom-set",
-+             "arguments": { "path": "/machine/peripheral-anon/device[1]",
-+			 "property": "stats-polling-interval", "value": 0 } }
-+
-+{ "return": {} }
--- 
-1.8.0
-
-
-
diff --git a/debian/patches/virtio-balloon-drop-old-stats-code.patch b/debian/patches/virtio-balloon-drop-old-stats-code.patch
deleted file mode 100644
index cf606fe..0000000
--- a/debian/patches/virtio-balloon-drop-old-stats-code.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From: Luiz Capitulino <lcapitulino at redhat.com>
-Subject: [Qemu-devel] [PATCH 1/3] virtio-balloon: drop old stats code
-
-Next commit will re-enable balloon stats with a different interface, but
-this old code conflicts with it. Drop it.
-
-Signed-off-by: Luiz Capitulino <lcapitulino at redhat.com>
----
- hw/virtio-balloon.c | 22 ----------------------
- 1 file changed, 22 deletions(-)
-
-diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
-index dd1a650..4398025 100644
---- a/hw/virtio-balloon.c
-+++ b/hw/virtio-balloon.c
-@@ -164,28 +164,6 @@ static uint32_t virtio_balloon_get_features(VirtIODevice *vdev, uint32_t f)
- static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
- {
-     VirtIOBalloon *dev = opaque;
--
--#if 0
--    /* Disable guest-provided stats for now. For more details please check:
--     * https://bugzilla.redhat.com/show_bug.cgi?id=623903
--     *
--     * If you do enable it (which is probably not going to happen as we
--     * need a new command for it), remember that you also need to fill the
--     * appropriate members of the BalloonInfo structure so that the stats
--     * are returned to the client.
--     */
--    if (dev->vdev.guest_features & (1 << VIRTIO_BALLOON_F_STATS_VQ)) {
--        virtqueue_push(dev->svq, &dev->stats_vq_elem, dev->stats_vq_offset);
--        virtio_notify(&dev->vdev, dev->svq);
--        return;
--    }
--#endif
--
--    /* Stats are not supported.  Clear out any stale values that might
--     * have been set by a more featureful guest kernel.
--     */
--    reset_stats(dev);
--
-     info->actual = ram_size - ((uint64_t) dev->actual <<
-                                VIRTIO_BALLOON_PFN_SHIFT);
- }
--- 
-1.8.0
-
-
-
-
diff --git a/debian/patches/virtio-balloon-fix-query.patch b/debian/patches/virtio-balloon-fix-query.patch
deleted file mode 100644
index ab25d93..0000000
--- a/debian/patches/virtio-balloon-fix-query.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-Index: new/hw/virtio-balloon.c
-===================================================================
---- new.orig/hw/virtio-balloon.c	2012-12-20 08:41:19.000000000 +0100
-+++ new/hw/virtio-balloon.c	2012-12-20 08:42:08.000000000 +0100
-@@ -59,7 +59,7 @@
- }
- 
- static const char *balloon_stat_names[] = {
--   [VIRTIO_BALLOON_S_SWAP_IN] = "stat-swap-in", 
-+   [VIRTIO_BALLOON_S_SWAP_IN] = "stat-swap-in",
-    [VIRTIO_BALLOON_S_SWAP_OUT] = "stat-swap-out",
-    [VIRTIO_BALLOON_S_MAJFLT] = "stat-major-faults",
-    [VIRTIO_BALLOON_S_MINFLT] = "stat-minor-faults",
-@@ -73,7 +73,7 @@
-  *
-  * This function needs to be called at device intialization and before
-  * before updating to a set of newly-generated stats.  This will ensure that no
-- * stale values stick around in case the guest reports a subset of the supported
-+ * stale values stick around in case The guest reports a subset of the supported
-  * statistics.
-  */
- static inline void reset_stats(VirtIOBalloon *dev)
-@@ -315,6 +315,34 @@
-     VirtIOBalloon *dev = opaque;
-     info->actual = ram_size - ((uint64_t) dev->actual <<
-                                VIRTIO_BALLOON_PFN_SHIFT);
-+
-+    info->max_mem = ram_size;
-+
-+    if (!(balloon_stats_enabled(dev) && balloon_stats_supported(dev) &&
-+          dev->stats_last_update)) {
-+        return;
-+    }
-+
-+    info->last_update = dev->stats_last_update;
-+    info->has_last_update = true;
-+
-+    info->mem_swapped_in = dev->stats[VIRTIO_BALLOON_S_SWAP_IN];
-+    info->has_mem_swapped_in = info->mem_swapped_in >= 0 ? true : false;
-+
-+    info->mem_swapped_out = dev->stats[VIRTIO_BALLOON_S_SWAP_OUT];
-+    info->has_mem_swapped_out = info->mem_swapped_out >= 0 ? true : false;
-+
-+    info->major_page_faults = dev->stats[VIRTIO_BALLOON_S_MAJFLT];
-+    info->has_major_page_faults = info->major_page_faults >= 0 ? true : false;
-+
-+    info->minor_page_faults = dev->stats[VIRTIO_BALLOON_S_MINFLT];
-+    info->has_minor_page_faults = info->minor_page_faults >= 0 ? true : false;
-+
-+    info->free_mem = dev->stats[VIRTIO_BALLOON_S_MEMFREE];
-+    info->has_free_mem = info->free_mem >= 0 ? true : false;
-+
-+    info->total_mem = dev->stats[VIRTIO_BALLOON_S_MEMTOT];
-+    info->has_total_mem = info->total_mem >= 0 ? true : false;
- }
- 
- static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
-Index: new/qapi-schema.json
-===================================================================
---- new.orig/qapi-schema.json	2012-12-20 08:40:30.000000000 +0100
-+++ new/qapi-schema.json	2012-12-20 08:41:40.000000000 +0100
-@@ -1044,6 +1044,8 @@
- #
- # @actual: the number of bytes the balloon currently contains
- #
-+# @last_update: #optional time when stats got updated from guest
-+#
- # @mem_swapped_in: #optional number of pages swapped in within the guest
- #
- # @mem_swapped_out: #optional number of pages swapped out within the guest
-@@ -1056,16 +1058,15 @@
- #
- # @total_mem: #optional amount of memory (in bytes) visible to the guest
- #
--# Since: 0.14.0
-+# @max_mem: amount of memory (in bytes) assigned to the guest
- #
--# Notes: all current versions of QEMU do not fill out optional information in
--#        this structure.
-+# Since: 0.14.0
- ##
- { 'type': 'BalloonInfo',
--  'data': {'actual': 'int', '*mem_swapped_in': 'int',
-+  'data': {'actual': 'int', '*last_update': 'int', '*mem_swapped_in': 'int',
-            '*mem_swapped_out': 'int', '*major_page_faults': 'int',
-            '*minor_page_faults': 'int', '*free_mem': 'int',
--           '*total_mem': 'int'} }
-+           '*total_mem': 'int', 'max_mem': 'int', } }
- 
- ##
- # @query-balloon:
-Index: new/hmp.c
-===================================================================
---- new.orig/hmp.c	2012-12-20 08:40:31.000000000 +0100
-+++ new/hmp.c	2012-12-20 08:41:40.000000000 +0100
-@@ -497,6 +497,14 @@
-     }
- 
-     monitor_printf(mon, "balloon: actual=%" PRId64, info->actual >> 20);
-+    monitor_printf(mon, " max_mem=%" PRId64, info->max_mem >> 20);
-+    if (info->has_total_mem) {
-+        monitor_printf(mon, " total_mem=%" PRId64, info->total_mem >> 20);
-+    }
-+    if (info->has_free_mem) {
-+        monitor_printf(mon, " free_mem=%" PRId64, info->free_mem >> 20);
-+    }
-+
-     if (info->has_mem_swapped_in) {
-         monitor_printf(mon, " mem_swapped_in=%" PRId64, info->mem_swapped_in);
-     }
-@@ -511,11 +519,9 @@
-         monitor_printf(mon, " minor_page_faults=%" PRId64,
-                        info->minor_page_faults);
-     }
--    if (info->has_free_mem) {
--        monitor_printf(mon, " free_mem=%" PRId64, info->free_mem);
--    }
--    if (info->has_total_mem) {
--        monitor_printf(mon, " total_mem=%" PRId64, info->total_mem);
-+    if (info->has_last_update) {
-+        monitor_printf(mon, " last_update=%" PRId64,
-+                       info->last_update);
-     }
- 
-     monitor_printf(mon, "\n");
diff --git a/debian/patches/virtio-balloon-re-enable-balloon-stats.patch b/debian/patches/virtio-balloon-re-enable-balloon-stats.patch
deleted file mode 100644
index ea3e594..0000000
--- a/debian/patches/virtio-balloon-re-enable-balloon-stats.patch
+++ /dev/null
@@ -1,333 +0,0 @@
-From lcapitulino at redhat.com Fri Dec 14 16:49:58 2012
-Received: from rt.proxmox.com (192.168.2.18) by lisa.maurer-it.com
- (192.168.2.121) with Microsoft SMTP Server id 14.2.328.9; Fri, 14 Dec 2012
- 16:49:58 +0100
-Received: from proxmox.maurer-it.com (proxmox.maurer-it.com
- [192.168.2.110]) by rt.proxmox.com (Postfix) with ESMTP id 9D849206E234	for
- <dietmar at proxmox.com>; Fri, 14 Dec 2012 16:49:58 +0100 (CET)
-Received: from proxmox.maurer-it.com (localhost.localdomain [127.0.0.1])	by
- proxmox.maurer-it.com (Proxmox) with ESMTP id 6DC3526A0912	for
- <dietmar at proxmox.com>; Fri, 14 Dec 2012 16:49:58 +0100 (CET)
-Received-SPF: pass (redhat.com: Sender is authorized to use
- 'lcapitulino at redhat.com' in 'mfrom' identity (mechanism
- 'include:spf-1.redhat.com' matched)) receiver=proxmox.maurer-it.com;
- identity=mailfrom; envelope-from="lcapitulino at redhat.com";
- helo=mx1.redhat.com; client-ip=209.132.183.28
-Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])	by
- proxmox.maurer-it.com (Proxmox) with ESMTP id 7B90426A090F	for
- <dietmar at proxmox.com>; Fri, 14 Dec 2012 16:49:55 +0100 (CET)
-Received: from int-mx12.intmail.prod.int.phx2.redhat.com
- (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])	by mx1.redhat.com
- (8.14.4/8.14.4) with ESMTP id qBEFnl3Y014706	(version=TLSv1/SSLv3
- cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);	Fri, 14 Dec 2012 10:49:47
- -0500
-Received: from localhost (ovpn-113-80.phx2.redhat.com [10.3.113.80])	by
- int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
- qBEFnkfm012128;	Fri, 14 Dec 2012 10:49:46 -0500
-From: Luiz Capitulino <lcapitulino at redhat.com>
-To: <qemu-devel at nongnu.org>
-CC: <eblake at redhat.com>, <aliguori at us.ibm.com>, <agl at us.ibm.com>,
- <mdroth at linux.vnet.ibm.com>, <dietmar at proxmox.com>
-Subject: [PATCH 2/3] balloon: re-enable balloon stats
-Date: Fri, 14 Dec 2012 13:49:41 -0200
-Message-ID: <1355500182-12743-3-git-send-email-lcapitulino at redhat.com>
-In-Reply-To: <1355500182-12743-1-git-send-email-lcapitulino at redhat.com>
-References: <1355500182-12743-1-git-send-email-lcapitulino at redhat.com>
-X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
-X-Proxmox-CTCH-Refid:
- str=0001.0A0C0203.50CB4AA5.008C:SCFSTAT2484459,ss=1,re=-4.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0
-x-proxmoxspam-level: Spam detection results:  0 AWL                   
- -0.200 From: address is in the auto white-list RCVD_IN_DNSWL_HI          
- -5 Sender listed at http://www.dnswl.org/, high trust SPF_HELO_PASS        
-  -0.001 SPF: HELO matches SPF record SPF_PASS               -0.001 SPF:
- sender matches SPF record T_RP_MATCHES_RCVD       -0.01 Envelope sender
- domain matches handover relay domain
-Content-Type: text/plain
-Return-Path: lcapitulino at redhat.com
-X-MS-Exchange-Organization-AuthSource: lisa.maurer-it.com
-X-MS-Exchange-Organization-AuthAs: Anonymous
-MIME-Version: 1.0
-Content-Transfer-Encoding: 8bit
-
-The statistics are now available through device properties via a
-polling mechanism. First a client has to enable polling, then it
-can query each stat individually.
-
-The following control properties are introduced:
-
- o stats-polling-interval: a value greater than zero enables polling
-   in the specified interval (in seconds). When value equals zero,
-   polling is disabled. If polling is already enabled and a value
-   greater than zero is written, the polling interval time is changed
-
- o stats-last-update: last stats update timestamp, in seconds.
-
-The following stats properties are introduced, all values are in bytes:
-
- o stat-swap-in
- o stat-swap-out
- o stat-major-faults
- o stat-minor-faults
- o stat-free-memory
- o stat-total-memory
-
-Please, refer to the documentation introduced by the next commit for
-more information and examples.
-
-Signed-off-by: Luiz Capitulino <lcapitulino at redhat.com>
----
- hw/virtio-balloon.c | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 176 insertions(+), 2 deletions(-)
-
-diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
-index 4398025..47e35b1 100644
---- a/hw/virtio-balloon.c
-+++ b/hw/virtio-balloon.c
-@@ -22,6 +22,8 @@
- #include "virtio-balloon.h"
- #include "kvm.h"
- #include "exec-memory.h"
-+#include "qemu-timer.h"
-+#include "qapi/qapi-visit-core.h"
- 
- #if defined(__linux__)
- #include <sys/mman.h>
-@@ -36,6 +38,9 @@ typedef struct VirtIOBalloon
-     uint64_t stats[VIRTIO_BALLOON_S_NR];
-     VirtQueueElement stats_vq_elem;
-     size_t stats_vq_offset;
-+    QEMUTimer *stats_timer;
-+    int64_t stats_last_update;
-+    int64_t stats_poll_interval;
-     DeviceState *qdev;
- } VirtIOBalloon;
- 
-@@ -53,6 +58,16 @@ static void balloon_page(void *addr, int deflate)
- #endif
- }
- 
-+static const char *balloon_stat_names[] = {
-+   [VIRTIO_BALLOON_S_SWAP_IN] = "stat-swap-in", 
-+   [VIRTIO_BALLOON_S_SWAP_OUT] = "stat-swap-out",
-+   [VIRTIO_BALLOON_S_MAJFLT] = "stat-major-faults",
-+   [VIRTIO_BALLOON_S_MINFLT] = "stat-minor-faults",
-+   [VIRTIO_BALLOON_S_MEMFREE] = "stat-free-memory",
-+   [VIRTIO_BALLOON_S_MEMTOT] = "stat-total-memory",
-+   [VIRTIO_BALLOON_S_NR] = NULL
-+};
-+
- /*
-  * reset_stats - Mark all items in the stats array as unset
-  *
-@@ -67,6 +82,138 @@ static inline void reset_stats(VirtIOBalloon *dev)
-     for (i = 0; i < VIRTIO_BALLOON_S_NR; dev->stats[i++] = -1);
- }
- 
-+static bool balloon_stats_supported(const VirtIOBalloon *s)
-+{
-+    return s->vdev.guest_features & (1 << VIRTIO_BALLOON_F_STATS_VQ);
-+}
-+
-+static bool balloon_stats_enabled(const VirtIOBalloon *s)
-+{
-+    return s->stats_poll_interval > 0;
-+}
-+
-+static void balloon_stats_destroy_timer(VirtIOBalloon *s)
-+{
-+    if (balloon_stats_enabled(s)) {
-+        qemu_del_timer(s->stats_timer);
-+        qemu_free_timer(s->stats_timer);
-+        s->stats_timer = NULL;
-+        s->stats_poll_interval = 0;
-+    }
-+}
-+
-+static void balloon_stats_change_timer(VirtIOBalloon *s, int secs)
-+{
-+    qemu_mod_timer(s->stats_timer, qemu_get_clock_ms(vm_clock) + secs * 1000);
-+}
-+
-+static void balloon_stats_poll_cb(void *opaque)
-+{
-+    VirtIOBalloon *s = opaque;
-+
-+    if (!balloon_stats_supported(s)) {
-+        /* re-schedule */
-+        balloon_stats_change_timer(s, s->stats_poll_interval);
-+        return;
-+    }
-+
-+    virtqueue_push(s->svq, &s->stats_vq_elem, s->stats_vq_offset);
-+    virtio_notify(&s->vdev, s->svq);
-+}
-+
-+static void balloon_stats_get_last_update(Object *obj, struct Visitor *v,
-+                                          void *opaque, const char *name,
-+                                          Error **errp)
-+{
-+    VirtIOBalloon *s = opaque;
-+    visit_type_int(v, &s->stats_last_update, name, errp);
-+}
-+
-+static void balloon_stats_get_stat(Object *obj, struct Visitor *v,
-+                                   void *opaque, const char *name, Error **errp)
-+{
-+    VirtIOBalloon *s = opaque;
-+    int i;
-+
-+    for (i = 0; i < VIRTIO_BALLOON_S_NR; i++) {
-+        if (!strcmp(balloon_stat_names[i], name)) {
-+            break;
-+        }
-+    }
-+
-+    if (i == VIRTIO_BALLOON_S_NR) {
-+        error_setg(errp, "invalid stat name '%s'", name);
-+        return;
-+    }
-+
-+    if (s->stats[i] == -1) {
-+        /*
-+         * Possible reasons for this error:
-+         *
-+         * - The timer hasn't been enabled
-+         * - The guest hasn't loaded its balloon driver
-+         * - The guest's balloon driver doesn't support memory stats
-+         * - The guest's balloon driver doesn't support this stat
-+         * - The guest's balloon driver didn't send this stat for
-+         *   whatever reason
-+         */
-+        error_setg(errp,
-+            "guest didn't update '%s' (does the guest support it?)", name);
-+        return;
-+    }
-+
-+    visit_type_int(v, (int64_t *) &s->stats[i], name, errp);
-+}
-+
-+static void balloon_stats_get_poll_interval(Object *obj, struct Visitor *v,
-+                                            void *opaque, const char *name,
-+                                            Error **errp)
-+{
-+    VirtIOBalloon *s = opaque;
-+    visit_type_int(v, &s->stats_poll_interval, name, errp);
-+}
-+
-+static void balloon_stats_set_poll_interval(Object *obj, struct Visitor *v,
-+                                            void *opaque, const char *name,
-+                                            Error **errp)
-+{
-+    VirtIOBalloon *s = opaque;
-+    int64_t value;
-+
-+    visit_type_int(v, &value, name, errp);
-+    if (error_is_set(errp)) {
-+        return;
-+    }
-+
-+    if (value < 0) {
-+        error_setg(errp, "timer value must be positive");
-+        return;
-+    }
-+
-+    if (value == s->stats_poll_interval) {
-+        return;
-+    }
-+
-+    if (value == 0) {
-+        /* timer=0 disables the timer */
-+        balloon_stats_destroy_timer(s);
-+        return;
-+    }
-+
-+    if (balloon_stats_enabled(s)) {
-+        /* timer interval change */
-+        s->stats_poll_interval = value;
-+        balloon_stats_change_timer(s, value);
-+        return;
-+    }
-+
-+    /* create a new timer */
-+    g_assert(s->stats_timer == NULL);
-+    s->stats_timer = qemu_new_timer_ms(vm_clock, balloon_stats_poll_cb, s);
-+    s->stats_poll_interval = value;
-+    balloon_stats_change_timer(s, 0);
-+}
-+
- static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq)
- {
-     VirtIOBalloon *s = to_virtio_balloon(vdev);
-@@ -107,9 +254,10 @@ static void virtio_balloon_receive_stats(VirtIODevice *vdev, VirtQueue *vq)
-     VirtQueueElement *elem = &s->stats_vq_elem;
-     VirtIOBalloonStat stat;
-     size_t offset = 0;
-+    qemu_timeval tv;
- 
-     if (!virtqueue_pop(vq, elem)) {
--        return;
-+        goto out;
-     }
- 
-     /* Initialize the stats to get rid of any stale values.  This is only
-@@ -128,6 +276,18 @@ static void virtio_balloon_receive_stats(VirtIODevice *vdev, VirtQueue *vq)
-             s->stats[tag] = val;
-     }
-     s->stats_vq_offset = offset;
-+
-+    if (qemu_gettimeofday(&tv) < 0) {
-+        fprintf(stderr, "warning: %s: failed to get time of day\n", __func__);
-+        goto out;
-+    }
-+
-+    s->stats_last_update = tv.tv_sec;
-+
-+out:
-+    if (balloon_stats_enabled(s)) {
-+        balloon_stats_change_timer(s, s->stats_poll_interval);
-+    }
- }
- 
- static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_data)
-@@ -212,7 +372,7 @@ static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
- VirtIODevice *virtio_balloon_init(DeviceState *dev)
- {
-     VirtIOBalloon *s;
--    int ret;
-+    int i, ret;
- 
-     s = (VirtIOBalloon *)virtio_common_init("virtio-balloon",
-                                             VIRTIO_ID_BALLOON,
-@@ -239,6 +399,19 @@ VirtIODevice *virtio_balloon_init(DeviceState *dev)
-     register_savevm(dev, "virtio-balloon", -1, 1,
-                     virtio_balloon_save, virtio_balloon_load, s);
- 
-+    for (i = 0; i < VIRTIO_BALLOON_S_NR; i++) {
-+        object_property_add(OBJECT(dev), balloon_stat_names[i], "int",
-+                            balloon_stats_get_stat, NULL, NULL, s, NULL);
-+    }
-+
-+    object_property_add(OBJECT(dev), "stats-last-update", "int",
-+                        balloon_stats_get_last_update, NULL, NULL, s, NULL);
-+
-+    object_property_add(OBJECT(dev), "stats-polling-interval", "int",
-+                        balloon_stats_get_poll_interval,
-+                        balloon_stats_set_poll_interval,
-+                        NULL, s, NULL);
-+
-     return &s->vdev;
- }
- 
-@@ -246,6 +419,7 @@ void virtio_balloon_exit(VirtIODevice *vdev)
- {
-     VirtIOBalloon *s = DO_UPCAST(VirtIOBalloon, vdev, vdev);
- 
-+    balloon_stats_destroy_timer(s);
-     qemu_remove_balloon_handler(s);
-     unregister_savevm(s->qdev, "virtio-balloon", s);
-     virtio_cleanup(vdev);
--- 
-1.8.0
-
-
-
diff --git a/debian/patches/vncticket.diff b/debian/patches/vncticket.diff
deleted file mode 100644
index fa1474d..0000000
--- a/debian/patches/vncticket.diff
+++ /dev/null
@@ -1,149 +0,0 @@
-Index: qemu-kvm/console.h
-===================================================================
---- qemu-kvm.orig/console.h	2010-10-21 13:40:20.000000000 +0200
-+++ qemu-kvm/console.h	2010-10-21 14:06:21.000000000 +0200
-@@ -368,7 +368,7 @@
- void vnc_display_init(DisplayState *ds);
- void vnc_display_close(DisplayState *ds);
- int vnc_display_open(DisplayState *ds, const char *display);
--int vnc_display_password(DisplayState *ds, const char *password);
-+int vnc_display_password(DisplayState *ds, const char *password, int limit);
- void do_info_vnc_print(Monitor *mon, const QObject *data);
- void do_info_vnc(Monitor *mon, QObject **ret_data);
- char *vnc_display_local_addr(DisplayState *ds);
-Index: qemu-kvm/ui/vnc.c
-===================================================================
---- qemu-kvm.orig/ui/vnc.c	2010-10-21 13:40:21.000000000 +0200
-+++ qemu-kvm/ui/vnc.c	2010-10-21 14:06:21.000000000 +0200
-@@ -1790,7 +1790,7 @@
- static void set_pixel_conversion(VncState *vs)
- {
-     if ((vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG) ==
--        (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG) && 
-+        (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG) &&
-         !memcmp(&(vs->clientds.pf), &(vs->ds->surface->pf), sizeof(PixelFormat))) {
-         vs->write_pixels = vnc_write_pixels_copy;
-         vnc_hextile_set_pixel_conversion(vs, 0);
-@@ -1876,7 +1876,7 @@
-         vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
-         vnc_write_u8(vs, 0);
-         vnc_write_u16(vs, 1); /* number of rects */
--        vnc_framebuffer_update(vs, 0, 0, ds_get_width(vs->ds), 
-+        vnc_framebuffer_update(vs, 0, 0, ds_get_width(vs->ds),
-                                ds_get_height(vs->ds), VNC_ENCODING_WMVi);
-         pixel_format_message(vs);
-         vnc_unlock_output(vs);
-@@ -2079,7 +2079,10 @@
-     int i, j, pwlen;
-     unsigned char key[8];
- 
--    if (!vs->vd->password || !vs->vd->password[0]) {
-+    if (vs->vd->retries >= 0)
-+        vs->vd->retries++;
-+
-+    if (!vs->vd->password || !vs->vd->password[0] || vs->vd->retries > 3) {
-         VNC_DEBUG("No password configured on server");
-         vnc_write_u32(vs, 1); /* Reject auth */
-         if (vs->minor >= 8) {
-@@ -2478,7 +2481,7 @@
- #endif
- }
- 
--int vnc_display_password(DisplayState *ds, const char *password)
-+int vnc_display_password(DisplayState *ds, const char *password, int limit)
- {
-     VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
- 
-@@ -2493,6 +2496,7 @@
-     if (password && password[0]) {
-         if (!(vs->password = qemu_strdup(password)))
-             return -1;
-+	vs->retries = limit ? 0 : -1;
-         if (vs->auth == VNC_AUTH_NONE) {
-             vs->auth = VNC_AUTH_VNC;
-         }
-Index: qemu-kvm/ui/vnc.h
-===================================================================
---- qemu-kvm.orig/ui/vnc.h	2010-10-21 13:40:20.000000000 +0200
-+++ qemu-kvm/ui/vnc.h	2010-10-21 14:06:21.000000000 +0200
-@@ -120,6 +120,7 @@
- 
-     char *display;
-     char *password;
-+    int retries;
-     int auth;
-     bool lossy;
- #ifdef CONFIG_VNC_TLS
-Index: qemu-kvm/monitor.c
-===================================================================
---- qemu-kvm.orig/monitor.c	2010-10-21 13:40:21.000000000 +0200
-+++ qemu-kvm/monitor.c	2010-10-21 14:14:38.000000000 +0200
-@@ -978,7 +978,7 @@
- 
- static int change_vnc_password(const char *password)
- {
--    if (vnc_display_password(NULL, password) < 0) {
-+    if (vnc_display_password(NULL, password, 0) < 0) {
-         qerror_report(QERR_SET_PASSWD_FAILED);
-         return -1;
-     }
-@@ -986,6 +986,17 @@
-     return 0;
- }
- 
-+static int change_vnc_ticket(const char *password)
-+{
-+    if (vnc_display_password(NULL, password, 1) < 0) {
-+	qerror_report(QERR_SET_PASSWD_FAILED);
-+	return -1;
-+    }
-+
-+    return 0;
-+}
-+
-+
- static void change_vnc_password_cb(Monitor *mon, const char *password,
-                                    void *opaque)
- {
-@@ -996,12 +1007,16 @@
- static int do_change_vnc(Monitor *mon, const char *target, const char *arg)
- {
-     if (strcmp(target, "passwd") == 0 ||
--        strcmp(target, "password") == 0) {
-+        strcmp(target, "password") == 0 ||
-+	strcmp(target, "ticket") == 0) {
-         if (arg) {
-             char password[9];
-             strncpy(password, arg, sizeof(password));
-             password[sizeof(password) - 1] = '\0';
--            return change_vnc_password(password);
-+	    if (strcmp(target, "ticket") == 0)
-+		return change_vnc_ticket(password);
-+	    else
-+		return change_vnc_password(password);
-         } else {
-             return monitor_read_password(mon, change_vnc_password_cb, NULL);
-         }
-@@ -3324,11 +3339,11 @@
- static int is_valid_option(const char *c, const char *typestr)
- {
-     char option[3];
--  
-+
-     option[0] = '-';
-     option[1] = *c;
-     option[2] = '\0';
--  
-+
-     typestr = strstr(typestr, option);
-     return (typestr != NULL);
- }
-@@ -3640,7 +3655,7 @@
-                     p++;
-                     if(c != *p) {
-                         if(!is_valid_option(p, typestr)) {
--                  
-+
-                             monitor_printf(mon, "%s: unsupported option -%c\n",
-                                            cmdname, *p);
-                             goto fail;
-- 
1.7.10.4




More information about the pve-devel mailing list