From patchwork Wed Dec 12 13:17:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Maurer X-Patchwork-Id: 205509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1FB512C00A5 for ; Thu, 13 Dec 2012 00:17:47 +1100 (EST) Received: from localhost ([::1]:42642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TimC1-00055o-7R for incoming@patchwork.ozlabs.org; Wed, 12 Dec 2012 08:17:45 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TimBn-00052W-Cb for qemu-devel@nongnu.org; Wed, 12 Dec 2012 08:17:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TimBh-0004DS-Bx for qemu-devel@nongnu.org; Wed, 12 Dec 2012 08:17:31 -0500 Received: from www.maurer-it.com ([213.129.239.114]:42054 helo=proxmox.maurer-it.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TimBh-0004Bw-5q for qemu-devel@nongnu.org; Wed, 12 Dec 2012 08:17:25 -0500 Received: from proxmox.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox.maurer-it.com (Proxmox) with ESMTP id 9C7A026A0912; Wed, 12 Dec 2012 14:17:16 +0100 (CET) From: Dietmar Maurer To: Luiz Capitulino Thread-Topic: [Qemu-devel] [PATCH 0/3] re-enable balloon stats Thread-Index: AQHN1w2sTbWWswJGR0+Jfv2aRqSIfpgTDIbAgABekYCAABw2UP//+J+AgAA1O4CAABiKAIAADh8AgAAbQHD///QvgIAAFKxA///wXQAAJtnmkA== Date: Wed, 12 Dec 2012 13:17:15 +0000 Message-ID: <24E144B8C0207547AD09C467A8259F75578AC74C@lisa.maurer-it.com> References: <1355168173-14571-1-git-send-email-lcapitulino@redhat.com> <24E144B8C0207547AD09C467A8259F7557870AEE@lisa.maurer-it.com> <20121211094513.29fa32bd@doriath.home> <24E144B8C0207547AD09C467A8259F755787AC78@lisa.maurer-it.com> <20121211105947.1b92f411@doriath.home> <24E144B8C0207547AD09C467A8259F755787E011@lisa.maurer-it.com> <20121211173808.GH30686@vm> <20121211162840.4b01701e@doriath.home> <24E144B8C0207547AD09C467A8259F755788040D@lisa.maurer-it.com> <20121211172355.3ee96cd4@doriath.home> <24E144B8C0207547AD09C467A8259F755788045F@lisa.maurer-it.com> <20121211174156.6e3e4d78@doriath.home> In-Reply-To: <20121211174156.6e3e4d78@doriath.home> Accept-Language: en-US, de-AT Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 213.129.239.114 Cc: "qemu-devel@nongnu.org" , "aliguori@us.ibm.com" , mdroth , "agl@us.ibm.com" Subject: Re: [Qemu-devel] [PATCH 0/3] re-enable balloon stats X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org > > > > Why don't we raise the error when we query the values? You already raise an error here, so that works out of the box: if (s->stats[i] == -1) { error_setg(errp, "timer hasn't been enabled or guest doesn't support '%s'", name); > > > > > > Hmm, that's a good idea. > > > > > > Only small nit is that, today old stats will remain available to be > > > queried even if you disable the timer. If we do what you suggest, > > > old stats won't be available if the module is unloaded (well, I > > > *guess* the guest will unset the feature bit on module removal). > > > > What is the problem with that? It would be no problem to simulate the > > old behavior, but why do you want that? > > I actually just thought that it's a nice to have. The following patch seems to work for me: Index: new/hw/virtio-balloon.c =================================================================== --- new.orig/hw/virtio-balloon.c 2012-12-12 14:05:56.000000000 +0100 +++ new/hw/virtio-balloon.c 2012-12-12 14:07:43.000000000 +0100 @@ -111,6 +111,10 @@ { VirtIOBalloon *s = opaque; + if (!balloon_stats_supported(s) || !runstate_is_running()) { + return; + } + virtqueue_push(s->svq, &s->stats_vq_elem, s->stats_vq_offset); virtio_notify(&s->vdev, s->svq); } @@ -164,11 +168,6 @@ VirtIOBalloon *s = opaque; int64_t value; - if (!balloon_stats_supported(s)) { - error_setg(errp, "guest doesn\'t support balloon stats"); - return; - } - visit_type_int(v, &value, name, errp); if (error_is_set(errp)) { return;