Message ID | 1471613966-7267-4-git-send-email-rkagan@virtuozzo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2C43C6077B for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 19 Aug 2016 19:18:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 205D829540 for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 19 Aug 2016 19:18:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14F3129543; Fri, 19 Aug 2016 19:18:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D32E29540 for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 19 Aug 2016 19:18:04 +0000 (UTC) Received: from localhost ([::1]:58683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) id 1bapIp-000546-Iq for patchwork-qemu-devel@patchwork.kernel.org; Fri, 19 Aug 2016 15:18:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1bapDO-0000P0-Vn for qemu-devel@nongnu.org; Fri, 19 Aug 2016 15:12:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1bapDI-0002Ek-Qr for qemu-devel@nongnu.org; Fri, 19 Aug 2016 15:12:26 -0400 Received: from mail-db5eur01on0098.outbound.protection.outlook.com ([104.47.2.98]:12320 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1bapDI-0002EZ-Ca for qemu-devel@nongnu.org; Fri, 19 Aug 2016 15:12:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+NaWPPsSHoyLUInspjPFdWIa36cl3Tgh1xLMiLDAUSw=; b=gSaY2IaoS06Su+3syQ1mU6bGWr31HpA5YydzRRziEKCId9pWMqECWG6FxnJlkoWCwGECutb0a4V8/mvIuSOLaCmt0Q+Ixt7sXYDI2kDWe+IeyQBgQIXH7O3cqkJrHHW/uqOgKY2JLWndQsqghCJyYqyd/QdogSqIRyZSQBDTTSo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (195.214.232.10) by DB6PR0802MB2469.eurprd08.prod.outlook.com (10.172.251.17) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Fri, 19 Aug 2016 13:39:42 +0000 From: Roman Kagan <rkagan@virtuozzo.com> To: <qemu-devel@nongnu.org> Date: Fri, 19 Aug 2016 16:39:22 +0300 Message-ID: <1471613966-7267-4-git-send-email-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471613966-7267-1-git-send-email-rkagan@virtuozzo.com> References: <1471613966-7267-1-git-send-email-rkagan@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [195.214.232.10] X-ClientProxiedBy: AM4PR01CA0021.eurprd01.prod.exchangelabs.com (10.164.74.159) To DB6PR0802MB2469.eurprd08.prod.outlook.com (10.172.251.17) X-MS-Office365-Filtering-Correlation-Id: e9e118d1-4cac-466b-b626-08d3c83646e9 X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2469; 2:cvz7PToSDytv+GmVWXp+1UImmE8cfpzS4br2lsfXvSAM0v9Uzzh7p4Co4i0+DIRXB4l029D0tT/2k/7MOL3YS/uZsn8kcApgEjw4OGNf1vllRXepo/eeSRlQUVj6fbwhVJMFCvnUt89W9XuQWcvBg7tQJa7XxvJ5iYn+b3lrRXJSGzVnpPTgUKezfP1kdfEd; 3:2yfQDXqc9kN5YSLavhzYQfXiR1T9Hh6WRuESSKkZVt+OtmeNEWIBEOhnWg/cvtSFSK+DChHUc77BOphT186PZzOoxu8DMIhh31mSN6EpU84lKkcr5wdbTlIJiaKybyvG X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0802MB2469; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2469; 25:cTKMaht7VoEua1MylTE+0jgKHWvqAg6Y5l1WXXuZrp6ZfXRQlnMPTgMtRfy8XNhnfNOlhA4U+2zU0xSN3Nd3QS5Qa4Cwmsx83AV6F1I1aNDsuas+F1aKSeDS7IFBnUqbVAHh24MWvYRX1/W8QioG16nVRZFHTL4RnD9HNyCU0lKMvty1zSsDOoPp395CU6xCH1D+3yUcZHTJP17MGxZFzuXwfq8YxTVCOe6zT10jgx/cvFs0s0mq7I/JCSkxBfElLDhuAK2r0NjTwDndroz7xii9x1Azi1jWi5vvZXl6VRVKrPWk9yL8l4LMhyAMI5BbyjWZYnk5J+8LrxQqFhhWFk8NIL5Dy92469EOxMPNXhmY+4EIJz7t8+xG8Ex6xLN2GgM0GGmyX2r9f46lzng+GH3dJSCvr90DPo46ws0nVGhw6RnHJ2NStgrZIekIvZNA+bT55QYphPe5sTfSaR/2zYa+Bw8cE4XYBwSmXuV0aqHjCFFEde7EwnJuqM5vcEEbRkLJD9WbjIuYeQt+DM4GQJqreALDT4xU574MFOicY/tuPxlcXxUE9uYfokA0NqeEP+ysZJW4GbcoOIQZpooo5OdyHfNwV7ufOLXDVofR0m3VrNH7gS72W3qa8p+lYgKmXTLaElnrygIK0h/IbMhBOMMejN0Q4oZGpF5iaJM7FxKfI3i2fP798YVcXqjUWdQ2yLiIYvKz17BAczx559c4rQ==; 31:pADOpWSC/RuLMqMdIV/0IloyLT6h727uIUZgSKh9yd7GHzKwsrGNHMkZok7tG/663Ihj9IspGsstL0D5hLLayytDbBGTi8ZvJ5rwO0OGK8IjyUzRFhMKS0pVG/0y05DwtaO/O097kFxxrj8knUqxW9uRfhGWX7Rq8q9T9vIfy/OXpDdM2gCoIVhIG12HtMuJnzbVZjF7zaPwJyZPzxv/fEkvw3+iCoeo1tlhlhXogJ8= X-Microsoft-Antispam-PRVS: <DB6PR0802MB24698B134642051457E2B3DFC9160@DB6PR0802MB2469.eurprd08.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(190756311086443); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6043046)(6042046); SRVR:DB6PR0802MB2469; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0802MB2469; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2469; 4:TpV8LpdjUwHIbP24bVSfX71sqNh9o3pFf/OygmDGr+PkKv+aYKNg4cr6DPO4icXVlXPCscpv6ghOX72SC2ya2WnbK16ETwjU383+sm/7WIL8jto9uCyPAUi/+vdT6ys1XxhGXWpx60FneoA/v6vW/GOcvim/j/zq1AuNjh4Mm1NETCeTXZbiDc/sOXUbri7EqDj6rWUBdGAiAHJ1uh8scKJaKnXcV14YZnKXZzx4SK3S6BmGUxL+3SAtlPlmA5XctdfGhrfbuBnrKkjxUUNh0hDlhu/WEvo05q5wdoG0ix+ilW+ygNYkkhe7eYAYCvG7Vze8kiQ42eG/b4WmRD5ry3IoZ8Yny5CgTPv2c0jsQafVCoQMfHDw/PPxyYD1YMLbP0VMMU0GQgwe38MfDG4WIGNDnthZ0sanYAlZ02MfM/Fj31UZUcPytRRIVGyrDWWeqxQMfudjXAEdXLZS4Ozg3g== X-Forefront-PRVS: 0039C6E5C5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(33646002)(229853001)(305945005)(7736002)(81156014)(92566002)(8676002)(81166006)(7846002)(48376002)(105586002)(47776003)(66066001)(50466002)(101416001)(2906002)(4326007)(586003)(36756003)(2351001)(106356001)(86362001)(50986999)(76176999)(3846002)(6116002)(77096005)(5003940100001)(19580395003)(69596002)(19580405001)(97736004)(189998001)(68736007)(2950100001)(53416004)(110136002)(42186005)(50226002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0802MB2469; H:rkaganb.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0802MB2469; 23:mDpxNlyo5w/1V64Bjcs/MXAjq/S90kPGcW1vbvI?= =?us-ascii?Q?v2SpX6fUJjjv9BFu0wziMZsdOSPG0g2eOvcebdrMCH0ftEONCxLNK+0rWXd4?= =?us-ascii?Q?4W4ree6fK19MQbP+AwySOWFu92Uxferv4wpp4OHeh4QO04xhCK1Ancp5XUxE?= =?us-ascii?Q?//o77hle0DZE3p745VzZ6asFLXeXqjQ7or4czZse9lKKKNA4PRPJ5oR+OKcS?= =?us-ascii?Q?anvAWXLKsX0Z1JrRdX0Ki2U7MHQ4pYcXyvrhGoBJyaiwQImmAkUYwMa2n0Pd?= =?us-ascii?Q?Lu9kXhB0c1AU/gK5OQYJ+pAW3JYJlYOuU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Y= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2016 13:39:42.7338 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2469 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.98 Subject: [Qemu-devel] [PATCH v2 3/6] virtio-balloon: don't restart stats timer in callback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: "Denis V. Lunev" <den@openvz.org>, Ladi Prosek <lprosek@redhat.com>, Roman Kagan <rkagan@virtuozzo.com>, Stefan Hajnoczi <stefanha@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com> Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index fb8784e..6d4c57c 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -68,12 +68,6 @@ static inline void reset_stats(VirtIOBalloon *dev) for (i = 0; i < VIRTIO_BALLOON_S_NR; dev->stats[i++] = -1); } -static bool balloon_stats_supported(const VirtIOBalloon *s) -{ - VirtIODevice *vdev = VIRTIO_DEVICE(s); - return virtio_vdev_has_feature(vdev, VIRTIO_BALLOON_F_STATS_VQ); -} - static bool balloon_stats_enabled(const VirtIOBalloon *s) { return s->stats_poll_interval > 0; @@ -99,9 +93,10 @@ static void balloon_stats_poll_cb(void *opaque) VirtIOBalloon *s = opaque; VirtIODevice *vdev = VIRTIO_DEVICE(s); - if (s->stats_vq_elem == NULL || !balloon_stats_supported(s)) { - /* re-schedule */ - balloon_stats_change_timer(s, s->stats_poll_interval); + if (!s->stats_vq_elem) { + /* The guest hasn't sent the stats yet (either not enabled or we came + * too early), nothing to do. Once the guest starts sending stats the + * timer will get armed in receive handler */ return; }
There's no need to restart the stats timer in its callback. If the callback happens to run when there's nothing to do just do nothing and return. The timer is armed either in receive handler or initially when periodic stats collection is enabled via QMP. While at this, observe that the presence of ->stats_vq_elem is enough to indicate there's work to do here, and drop the check for the stats feature. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Ladi Prosek <lprosek@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> --- hw/virtio/virtio-balloon.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)