From patchwork Tue Sep 14 16:43:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 64733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D4253B6ED0 for ; Wed, 15 Sep 2010 02:54:00 +1000 (EST) Received: from localhost ([127.0.0.1]:40531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvYlY-0007wH-Uk for incoming@patchwork.ozlabs.org; Tue, 14 Sep 2010 12:53:57 -0400 Received: from [140.186.70.92] (port=44765 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvYbk-0003cw-Ti for qemu-devel@nongnu.org; Tue, 14 Sep 2010 12:43:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OvYbf-0005Qe-1N for qemu-devel@nongnu.org; Tue, 14 Sep 2010 12:43:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22336) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OvYbe-0005QQ-O6 for qemu-devel@nongnu.org; Tue, 14 Sep 2010 12:43:43 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8EGhfck023748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 14 Sep 2010 12:43:41 -0400 Received: from blackpad.lan.raisama.net (ovpn-113-84.phx2.redhat.com [10.3.113.84]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8EGhebp022229 for ; Tue, 14 Sep 2010 12:43:41 -0400 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id 0A92D17FA9C; Tue, 14 Sep 2010 13:43:39 -0300 (BRT) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 14 Sep 2010 13:43:39 -0300 Message-Id: <1284482619-3948-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Markus Armbruster , Luiz Capitulino , Adam Litke , Amit Shah , Paolo Bonzini Subject: [Qemu-devel] [PATCH] disable guest-provided stats on "info balloon" command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The addition of memory stats reporting to the virtio balloon causes the 'info balloon' command to become asynchronous. This is a regression because in some cases it can hang the user monitor. This is an alternative to Adam Litke's patch. Adam's patch disabled the corresponding (guest-visible) virtio feature bit, causing issues for migration. Original discussion is available at: http://marc.info/?l=qemu-devel&m=128448124328314&w=2 Signed-off-by: Eduardo Habkost Acked-by: Adam Litke diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c index 1e4dfdd..92e9057 100644 --- a/hw/virtio-balloon.c +++ b/hw/virtio-balloon.c @@ -30,6 +30,10 @@ #include #endif +/* Disable guest-provided stats by now (https://bugzilla.redhat.com/show_bug.cgi?id=623903) */ +#define ENABLE_GUEST_STATS 0 + + typedef struct VirtIOBalloon { VirtIODevice vdev; @@ -84,12 +88,14 @@ static QObject *get_stats_qobject(VirtIOBalloon *dev) VIRTIO_BALLOON_PFN_SHIFT); stat_put(dict, "actual", actual); +#if ENABLE_GUEST_STATS stat_put(dict, "mem_swapped_in", dev->stats[VIRTIO_BALLOON_S_SWAP_IN]); stat_put(dict, "mem_swapped_out", dev->stats[VIRTIO_BALLOON_S_SWAP_OUT]); stat_put(dict, "major_page_faults", dev->stats[VIRTIO_BALLOON_S_MAJFLT]); stat_put(dict, "minor_page_faults", dev->stats[VIRTIO_BALLOON_S_MINFLT]); stat_put(dict, "free_mem", dev->stats[VIRTIO_BALLOON_S_MEMFREE]); stat_put(dict, "total_mem", dev->stats[VIRTIO_BALLOON_S_MEMTOT]); +#endif return QOBJECT(dict); } @@ -215,7 +221,7 @@ static void virtio_balloon_to_target(void *opaque, ram_addr_t target, } dev->stats_callback = cb; dev->stats_opaque_callback_data = cb_data; - if (dev->vdev.guest_features & (1 << VIRTIO_BALLOON_F_STATS_VQ)) { + if (ENABLE_GUEST_STATS && (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); } else {