Skip to content

Commit

Permalink
balloon: drop old stats code & API
Browse files Browse the repository at this point in the history
Next commit will re-enable balloon stats with a different interface, but
this old code conflicts with it. Let's drop it.

It's important to note that the QMP and HMP interfaces are also dropped
by this commit. That shouldn't be a problem though, because:

 1. All QMP fields are optional
 2. This feature has always been disabled

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
  • Loading branch information
Luiz Capitulino committed Jan 25, 2013
1 parent 58513bd commit 01ceb97
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 79 deletions.
24 changes: 1 addition & 23 deletions hmp.c
Expand Up @@ -465,29 +465,7 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
return;
}

monitor_printf(mon, "balloon: actual=%" PRId64, info->actual >> 20);
if (info->has_mem_swapped_in) {
monitor_printf(mon, " mem_swapped_in=%" PRId64, info->mem_swapped_in);
}
if (info->has_mem_swapped_out) {
monitor_printf(mon, " mem_swapped_out=%" PRId64, info->mem_swapped_out);
}
if (info->has_major_page_faults) {
monitor_printf(mon, " major_page_faults=%" PRId64,
info->major_page_faults);
}
if (info->has_minor_page_faults) {
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);
}

monitor_printf(mon, "\n");
monitor_printf(mon, "balloon: actual=%" PRId64 "\n", info->actual >> 20);

qapi_free_BalloonInfo(info);
}
Expand Down
24 changes: 0 additions & 24 deletions hw/virtio-balloon.c
Expand Up @@ -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);
}
Expand Down Expand Up @@ -255,8 +233,6 @@ VirtIODevice *virtio_balloon_init(DeviceState *dev)
s->dvq = virtio_add_queue(&s->vdev, 128, virtio_balloon_handle_output);
s->svq = virtio_add_queue(&s->vdev, 128, virtio_balloon_receive_stats);

reset_stats(s);

s->qdev = dev;
register_savevm(dev, "virtio-balloon", -1, 1,
virtio_balloon_save, virtio_balloon_load, s);
Expand Down
20 changes: 1 addition & 19 deletions qapi-schema.json
Expand Up @@ -977,28 +977,10 @@
#
# @actual: the number of bytes the balloon currently contains
#
# @mem_swapped_in: #optional number of pages swapped in within the guest
#
# @mem_swapped_out: #optional number of pages swapped out within the guest
#
# @major_page_faults: #optional number of major page faults within the guest
#
# @minor_page_faults: #optional number of minor page faults within the guest
#
# @free_mem: #optional amount of memory (in bytes) free in the guest
#
# @total_mem: #optional amount of memory (in bytes) visible to the guest
#
# Since: 0.14.0
#
# Notes: all current versions of QEMU do not fill out optional information in
# this structure.
##
{ 'type': 'BalloonInfo',
'data': {'actual': 'int', '*mem_swapped_in': 'int',
'*mem_swapped_out': 'int', '*major_page_faults': 'int',
'*minor_page_faults': 'int', '*free_mem': 'int',
'*total_mem': 'int'} }
{ 'type': 'BalloonInfo', 'data': {'actual': 'int' } }

##
# @query-balloon:
Expand Down
13 changes: 0 additions & 13 deletions qmp-commands.hx
Expand Up @@ -2549,26 +2549,13 @@ Make an asynchronous request for balloon info. When the request completes a
json-object will be returned containing the following data:

- "actual": current balloon value in bytes (json-int)
- "mem_swapped_in": Amount of memory swapped in bytes (json-int, optional)
- "mem_swapped_out": Amount of memory swapped out in bytes (json-int, optional)
- "major_page_faults": Number of major faults (json-int, optional)
- "minor_page_faults": Number of minor faults (json-int, optional)
- "free_mem": Total amount of free and unused memory in
bytes (json-int, optional)
- "total_mem": Total amount of available memory in bytes (json-int, optional)

Example:

-> { "execute": "query-balloon" }
<- {
"return":{
"actual":1073741824,
"mem_swapped_in":0,
"mem_swapped_out":0,
"major_page_faults":142,
"minor_page_faults":239245,
"free_mem":1014185984,
"total_mem":1044668416
}
}

Expand Down

0 comments on commit 01ceb97

Please sign in to comment.