From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXy0s-0004OR-0g for qemu-devel@nongnu.org; Mon, 22 Feb 2016 16:27:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXy0n-000121-JE for qemu-devel@nongnu.org; Mon, 22 Feb 2016 16:27:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXy0n-00011v-Bf for qemu-devel@nongnu.org; Mon, 22 Feb 2016 16:27:21 -0500 References: <1455954883-28858-1-git-send-email-den@openvz.org> <1455954883-28858-2-git-send-email-den@openvz.org> From: Eric Blake Message-ID: <56CB7D37.6080704@redhat.com> Date: Mon, 22 Feb 2016 14:27:19 -0700 MIME-Version: 1.0 In-Reply-To: <1455954883-28858-2-git-send-email-den@openvz.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xQRs9vqQFBBF6r1IMF2JkFKO7toxjST5M" Subject: Re: [Qemu-devel] [PATCH 1/2] virtio-balloon: export all balloon statistics List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Igor Redko , qemu-devel@nongnu.org, "Michael S. Tsirkin" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xQRs9vqQFBBF6r1IMF2JkFKO7toxjST5M Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/20/2016 12:54 AM, Denis V. Lunev wrote: > From: Igor Redko >=20 > We are making experiments with different autoballooning strategies > based on the guest behavior. Thus we need to experiment with different > guest statistics. For now every counter change requires QEMU recompilat= ion > and dances with Libvirt. >=20 > This patch introduces transport for unrecognized counters in virtio-bal= loon. > This transport can be used for measuring benefits from using new > balloon counters, before submitting any patches. Current alternative > is 'guest-exec' transport which isn't made for such delicate matters > and can influence test results. >=20 > Originally all counters with tag >=3D VIRTIO_BALLOON_S_NR were ignored.= > Instead of this we keep first (VIRTIO_BALLOON_S_NR + 32) counters from = the > queue and pass unrecognized ones with the following names: 'x-stat-XXXX= ', > where XXXX is a tag number in hex. Defined counters are reported with t= heir > regular names. The name implies experimental, so apps like libvirt shouldn't rely on it; while it does fill a gap for making development easier, so I'm in favor of the idea. > @@ -133,12 +132,20 @@ static void balloon_stats_get_all(Object *obj, Vi= sitor *v, const char *name, > if (err) { > goto out_end; > } > - for (i =3D 0; i < VIRTIO_BALLOON_S_NR; i++) { > - visit_type_uint64(v, balloon_stat_names[i], &s->stats[i], &err= ); > + for (i =3D 0; !err && i < s->stats_cnt; i++) { Why are you checking for err here? You cannot enter the loop with err set... > + if (s->stats[i].tag < VIRTIO_BALLOON_S_NR) { > + visit_type_uint64(v, balloon_stat_names[s->stats[i].tag], > + &s->stats[i].val, &err); > + } else { > + gchar *str =3D g_strdup_printf("x-stat-%04x", s->stats[i].= tag); > + visit_type_uint64(v, str, &s->stats[i].val, &err); > + g_free(str); > + } > if (err) { > break; > } =2E..and you cannot exit the loop with it set. Therefore the check is dea= d code. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xQRs9vqQFBBF6r1IMF2JkFKO7toxjST5M Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWy303AAoJEKeha0olJ0NqQ7MIAKtR/13bNkZnPaYA1U4+o4iw /JCJGGUf1/EIc1tJgLczS0xPmKsj8qmWIg1J/eDz73yQJwv0AZbUpLioUOtoZCzS 7SX2pWQd1NQ8R3sug1I5q5uYEWl5V1Zo+yH9Q4TGw+u8TpH9ZLMqZIa6PxDhqHzw gmkLxv/FdpymhbzBLo2vmPGiP4tZL631d+j2yB2zfTbUdl+W/V9kobV9u8sMgtmB /Plr/8yAqDJS+zxs/6op/tRwSqHQ2JwCRdbs0oxxMebSCRgAyWFKNxEjzKS7ON/Q zA9HfkIKmTEXG01IsQeoG5dbY8dFmn6oBdbKmBzFksWk+CJj6G6hDxhu2UBHx0Q= =8oq7 -----END PGP SIGNATURE----- --xQRs9vqQFBBF6r1IMF2JkFKO7toxjST5M--