Message ID | 1471544874-26996-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 EF50460574 for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 19 Aug 2016 00:02:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2FC529271 for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 19 Aug 2016 00:02:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C36F82929C; Fri, 19 Aug 2016 00:02:10 +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 3516829271 for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 19 Aug 2016 00:02:06 +0000 (UTC) Received: from localhost ([::1]:54749 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 1baXG9-0005J9-AP for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Aug 2016 20:02:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1baXFp-0005J3-F3 for qemu-devel@nongnu.org; Thu, 18 Aug 2016 20:01:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1baXFj-0007KY-HZ for qemu-devel@nongnu.org; Thu, 18 Aug 2016 20:01:44 -0400 Received: from mail-ve1eur01on0122.outbound.protection.outlook.com ([104.47.1.122]:53279 helo=EUR01-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1baXFj-0007KU-1y for qemu-devel@nongnu.org; Thu, 18 Aug 2016 20:01:39 -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=CMNTrioGE66y/hhMtnq3xrDhzY0P46dDw16Lgg/2zAo=; b=SjZFFOm5OwESrvbtWYO7t0huUGwgivIuV9DMWM+HXnsMJOtnlGjp6L+YxDPur42XiFKsYd6ZV9lWoJzJoaut+/7PeJA5y9B3Kv4Z2IIcm5P2VJvF0zfOqNt804vFFVSqHA8esEj2Xr7ojvS+FdFa/nBY+Z62s71BetxDg4giDAw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (195.214.232.10) by HE1PR0802MB2476.eurprd08.prod.outlook.com (10.175.34.149) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.9; Thu, 18 Aug 2016 18:28:40 +0000 From: Roman Kagan <rkagan@virtuozzo.com> To: <qemu-devel@nongnu.org> Date: Thu, 18 Aug 2016 21:27:53 +0300 Message-ID: <1471544874-26996-4-git-send-email-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471544874-26996-1-git-send-email-rkagan@virtuozzo.com> References: <1471544874-26996-1-git-send-email-rkagan@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [195.214.232.10] X-ClientProxiedBy: VI1PR07CA0121.eurprd07.prod.outlook.com (10.165.229.175) To HE1PR0802MB2476.eurprd08.prod.outlook.com (10.175.34.149) X-MS-Office365-Filtering-Correlation-Id: ef9a8213-70c5-41e4-4358-08d3c7957a90 X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2476; 2:5JTNjn18HNeogJ+3E0urrUsAYqBea0/k2oZqqQLIo++wg3jXMfNSpjzz+Y9dAS+fa/Y8Jch1S9MBbw7rb7hheC1uve12wHez25STtGomStczT82HZTTfSe0IahFrY13ml3JioAUeZ+kZe+T/iSVP9GSxrL3O8AYOVEQZLrBv15T4JgLwjIgFqDqK6f3DLlkS; 3:aNZRHoJk/y3HHtT7cRP4N+uUN3Vemsa1nh34P3cooRBTXgdEvHb6pfF8luHFjYWqcmJmVWYLs1ZZtCU3cb5yJKg/QDJP4V78K6DQbx7Y54kzZOUxt1mFe5QZ/CWgdBTW X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0802MB2476; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2476; 25:FSZBK2xndIPsuPZfwr+3mrrcdU3qMAlx+UtuUJXL2Cbp2ZQt9I34kC7F1vi70o1LNWZZjcuT9GDbudeRLlZ1oM+d+BfdLlShjrQMKT0b/DAlGjDBN0BmN5vwErN2SQZiG0HOCD17n2R96N4vt34p6xMYwMwIz+m3ukwKCzjfnvqqLa10PwIffFhLmtI+ZE4og4GVbZT2hbX+vH/uN0QeuEg7wXqWKt1K1J93l0Fof/K6uEo4kPvDb/Lia61a7NFgnXMjvQhvhiHT7+pEyE7gmzAHdmfFa/uuuR0DxdGIFzW+0UNyPybbiKtjmz0QkNEh1YyTl/+ElEJedGbRayfJPwWn5yYmcPhBC86AGnS5ibb1YsySOCsAXnAT9mK7inehpBWFHnucazQbowYh+OcqWad8/HSgqsvDQqNRFx37FsZCSNEJrmJ4SPxlUvso0kz7sHKFZVshRdWCfAac6xNTP+TwxzbK6aUQyQyr1W3qO6JyNR8eOaM0+NS77poqmjHdV81eGf5ILJfF2veb1yEERhVi/dbe0J9gmDkiyV2RT7YzzPlN9AOdURSWK2Lw6sYP+WVcwvndBC9t3xJvqImk7k63JIXVEPAdurgEmKkBQ8N9CmDMcMbB3pbzY+8xxbFh8mG8aHXmrYjojaMRJDEprs6Tin46ggEsNbPWUPDlgkdSE5LVte8wCJ46YJ+aF9KLujkyEdNmZhlubP1Wm0BqKQ==; 31:2LNyKfYrBZOxEUIWVsTuu1iNSZmVTdda4sdfWzB4JLnjVf1qUMv6N7hw8JRz3oOy2JRr+YERpBuSm9bNjysZmTKnNFh7qNRA2ld+6Be4saSiBBwGgUoWZ9GtrUa6RHgabCYWcW375gQJK2C6eFdmBuxHjspVNO+0bfEIWfjyNictZ56HpoB0p2+aplv0IE4bmh5rJcmpCSqmo1Goew14MbOxuy8DACz/Axg/XDsY/nQ= X-Microsoft-Antispam-PRVS: <HE1PR0802MB2476141DC11425EC0D3BDE71C9150@HE1PR0802MB2476.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)(10201501046)(3002001)(6043046)(6042046); SRVR:HE1PR0802MB2476; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0802MB2476; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2476; 4:1SIdW67wMEum7bbo2ZIKPgmI/ggPPcNSuSUj+0EgqM/WAtfYpBmUmsw7Pmr77vKsLflnYJf50//x+cmBajA2TH3O8AbOqVUjym8xwO6VnbGfTQB3m4r3JwkMasbj0C8ZnuBBKUwkzLPYN8tcMVZdCH92gBp4nFlTR0qx5XG7iG+ITflrrRVaE8hUOCfI6BunYxyP/Kzo2ymzUuOz0wPfN1pJ4hKwbPDmDydIeDD/WdgxkV+4NdydlzGcEI3MMHYKpiPbsut7pwWBHu4jkCySp2+KUTXbiDwGmhEBG0pI4tw7VHL1MkRjsLj7qF+wMroTzP3O8Sih+qrSw1FGdkmYBxwaGXE+FlXLFlA2xcgNXmSxsYhSPZyn2q8djRloZdwMjYapQOoBB3mA9iRuADDq2W6o91WoWE2cPowmxcyKQLjsWB16g9OjdCk61v3WB4q458dPCqxv8ySJXOCuAjRvQA== X-Forefront-PRVS: 0038DE95A2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(76176999)(19580405001)(7846002)(7736002)(50466002)(229853001)(50226002)(6116002)(2351001)(33646002)(4326007)(305945005)(47776003)(3846002)(2906002)(586003)(81156014)(8676002)(66066001)(101416001)(42186005)(86362001)(77096005)(81166006)(50986999)(53416004)(68736007)(97736004)(105586002)(5003940100001)(92566002)(189998001)(19580395003)(110136002)(48376002)(69596002)(106356001)(2950100001)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0802MB2476; H:rkaganb.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; HE1PR0802MB2476; 23:I5TeJlavdTA7o4p8iLnbzD3ViqUVYLGuo2b6T9I?= =?us-ascii?Q?K5za0KDjGq2VCIPShEromDmwpYTFGMVRFGRwK9RdqqFzUwVGSIJxlLkNW8x0?= =?us-ascii?Q?WzzemP1GqcCz69pFnrrq7RU5jdD29w6LH6w8QYUnwqMR8CImN7xNyQ4rBFPV?= =?us-ascii?Q?MstOxOuGMqkLOEVmb/FpmRU8fwCpjAbPH1YxUQ494iiORHvrmWCbzTzBHsll?= =?us-ascii?Q?7JQ4lQZUUzYW/8tYUfAiThPSxWpoLe6CKNbtuWnsxszMoSoy8Rkxm6InmZeX?= =?us-ascii?Q?HYtgUsnA3hHaUH3yrxJmRuTCRzAaGSjUTYTu8zry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-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2016 18:28:40.3265 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2476 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.1.122 Subject: [Qemu-devel] [PATCH 3/4] 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>, Roman Kagan <rkagan@virtuozzo.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 0baf4b3..b56fecd 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> --- hw/virtio/virtio-balloon.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)