]> git.proxmox.com Git - pve-qemu-kvm.git/blob - debian/patches/virtio-balloon-fix-query.patch
update seabios and fix query-balloon
[pve-qemu-kvm.git] / debian / patches / virtio-balloon-fix-query.patch
1 Index: new/hw/virtio-balloon.c
2 ===================================================================
3 --- new.orig/hw/virtio-balloon.c 2012-12-20 08:41:19.000000000 +0100
4 +++ new/hw/virtio-balloon.c 2012-12-20 08:42:08.000000000 +0100
5 @@ -59,7 +59,7 @@
6 }
7
8 static const char *balloon_stat_names[] = {
9 - [VIRTIO_BALLOON_S_SWAP_IN] = "stat-swap-in",
10 + [VIRTIO_BALLOON_S_SWAP_IN] = "stat-swap-in",
11 [VIRTIO_BALLOON_S_SWAP_OUT] = "stat-swap-out",
12 [VIRTIO_BALLOON_S_MAJFLT] = "stat-major-faults",
13 [VIRTIO_BALLOON_S_MINFLT] = "stat-minor-faults",
14 @@ -73,7 +73,7 @@
15 *
16 * This function needs to be called at device intialization and before
17 * before updating to a set of newly-generated stats. This will ensure that no
18 - * stale values stick around in case the guest reports a subset of the supported
19 + * stale values stick around in case The guest reports a subset of the supported
20 * statistics.
21 */
22 static inline void reset_stats(VirtIOBalloon *dev)
23 @@ -315,6 +315,34 @@
24 VirtIOBalloon *dev = opaque;
25 info->actual = ram_size - ((uint64_t) dev->actual <<
26 VIRTIO_BALLOON_PFN_SHIFT);
27 +
28 + info->max_mem = ram_size;
29 +
30 + if (!(balloon_stats_enabled(dev) && balloon_stats_supported(dev) &&
31 + dev->stats_last_update)) {
32 + return;
33 + }
34 +
35 + info->last_update = dev->stats_last_update;
36 + info->has_last_update = true;
37 +
38 + info->mem_swapped_in = dev->stats[VIRTIO_BALLOON_S_SWAP_IN];
39 + info->has_mem_swapped_in = info->mem_swapped_in >= 0 ? true : false;
40 +
41 + info->mem_swapped_out = dev->stats[VIRTIO_BALLOON_S_SWAP_OUT];
42 + info->has_mem_swapped_out = info->mem_swapped_out >= 0 ? true : false;
43 +
44 + info->major_page_faults = dev->stats[VIRTIO_BALLOON_S_MAJFLT];
45 + info->has_major_page_faults = info->major_page_faults >= 0 ? true : false;
46 +
47 + info->minor_page_faults = dev->stats[VIRTIO_BALLOON_S_MINFLT];
48 + info->has_minor_page_faults = info->minor_page_faults >= 0 ? true : false;
49 +
50 + info->free_mem = dev->stats[VIRTIO_BALLOON_S_MEMFREE];
51 + info->has_free_mem = info->free_mem >= 0 ? true : false;
52 +
53 + info->total_mem = dev->stats[VIRTIO_BALLOON_S_MEMTOT];
54 + info->has_total_mem = info->total_mem >= 0 ? true : false;
55 }
56
57 static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
58 Index: new/qapi-schema.json
59 ===================================================================
60 --- new.orig/qapi-schema.json 2012-12-20 08:40:30.000000000 +0100
61 +++ new/qapi-schema.json 2012-12-20 08:41:40.000000000 +0100
62 @@ -1044,6 +1044,8 @@
63 #
64 # @actual: the number of bytes the balloon currently contains
65 #
66 +# @last_update: #optional time when stats got updated from guest
67 +#
68 # @mem_swapped_in: #optional number of pages swapped in within the guest
69 #
70 # @mem_swapped_out: #optional number of pages swapped out within the guest
71 @@ -1056,16 +1058,15 @@
72 #
73 # @total_mem: #optional amount of memory (in bytes) visible to the guest
74 #
75 -# Since: 0.14.0
76 +# @max_mem: amount of memory (in bytes) assigned to the guest
77 #
78 -# Notes: all current versions of QEMU do not fill out optional information in
79 -# this structure.
80 +# Since: 0.14.0
81 ##
82 { 'type': 'BalloonInfo',
83 - 'data': {'actual': 'int', '*mem_swapped_in': 'int',
84 + 'data': {'actual': 'int', '*last_update': 'int', '*mem_swapped_in': 'int',
85 '*mem_swapped_out': 'int', '*major_page_faults': 'int',
86 '*minor_page_faults': 'int', '*free_mem': 'int',
87 - '*total_mem': 'int'} }
88 + '*total_mem': 'int', 'max_mem': 'int', } }
89
90 ##
91 # @query-balloon:
92 Index: new/hmp.c
93 ===================================================================
94 --- new.orig/hmp.c 2012-12-20 08:40:31.000000000 +0100
95 +++ new/hmp.c 2012-12-20 08:41:40.000000000 +0100
96 @@ -497,6 +497,14 @@
97 }
98
99 monitor_printf(mon, "balloon: actual=%" PRId64, info->actual >> 20);
100 + monitor_printf(mon, " max_mem=%" PRId64, info->max_mem >> 20);
101 + if (info->has_total_mem) {
102 + monitor_printf(mon, " total_mem=%" PRId64, info->total_mem >> 20);
103 + }
104 + if (info->has_free_mem) {
105 + monitor_printf(mon, " free_mem=%" PRId64, info->free_mem >> 20);
106 + }
107 +
108 if (info->has_mem_swapped_in) {
109 monitor_printf(mon, " mem_swapped_in=%" PRId64, info->mem_swapped_in);
110 }
111 @@ -511,11 +519,9 @@
112 monitor_printf(mon, " minor_page_faults=%" PRId64,
113 info->minor_page_faults);
114 }
115 - if (info->has_free_mem) {
116 - monitor_printf(mon, " free_mem=%" PRId64, info->free_mem);
117 - }
118 - if (info->has_total_mem) {
119 - monitor_printf(mon, " total_mem=%" PRId64, info->total_mem);
120 + if (info->has_last_update) {
121 + monitor_printf(mon, " last_update=%" PRId64,
122 + info->last_update);
123 }
124
125 monitor_printf(mon, "\n");