From patchwork Tue Jun 6 18:19:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 9769589 Return-Path: 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 1B21860364 for ; Tue, 6 Jun 2017 18:29:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1544128358 for ; Tue, 6 Jun 2017 18:29:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08810283BA; Tue, 6 Jun 2017 18:29:57 +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 5E70428358 for ; Tue, 6 Jun 2017 18:29:56 +0000 (UTC) Received: from localhost ([::1]:39661 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIJEo-0005ro-KD for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Jun 2017 14:29:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIJ5O-0005oo-Uw for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:20:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIJ5K-0007Hu-AK for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:20:10 -0400 Received: from mail-eopbgr30097.outbound.protection.outlook.com ([40.107.3.97]:4272 helo=EUR03-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIJ5J-0007HV-VD for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:20:06 -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=w7lunx7kRkteZfziJIHp6+e73ajWT74Dtvtr2fZBC+o=; b=V+/ilgzaXeylQfJFixM3ISVF7qRUXRLvAhCgJ0M2hMAVFN+nUp+zP8r9TJYY1R1FQfISqZnABxZ9PsysrUJxVZVASJA9UeFGpf6UfVJUfos/dmxwCnt6lBgG0QAWAL/7qqwag4Sil1HObAtIx6uu4xB+sASDkxDasmu71lRmMNY= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from rkaganb.sw.ru (195.214.232.6) by VI1PR08MB0847.eurprd08.prod.outlook.com (2a01:111:e400:5a05::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Tue, 6 Jun 2017 18:20:02 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Tue, 6 Jun 2017 21:19:34 +0300 Message-Id: <20170606181948.16238-10-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170606181948.16238-1-rkagan@virtuozzo.com> References: <20170606181948.16238-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR1001CA0042.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::28) To VI1PR08MB0847.eurprd08.prod.outlook.com (2a01:111:e400:5a05::17) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR08MB0847: X-MS-Office365-Filtering-Correlation-Id: bb7f718d-5ace-4f22-e17b-08d4ad08a6c7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:VI1PR08MB0847; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0847; 3:ldwRNgH/0+peDn7b8ZY17mgQaEuPQnZ9/GrdqYSe4jaeSObifAz8dtBhDNrbKR7LVP6WufT1G4A/0KwqIN9p3DaAG1k5ol46ujGHK21HXucguwblRQR4pNW0c0c6bwWU6qHG8w3dxU+xefCSa9xw+e81UTIZHbOvNtu3qheA2yKuzLYnV543WpRKzPBOEvauPbHwubCiEm9felSw18T/x4CLyAeIzPewrBm1dXcBSthPjc9Y2/KsbFinYeo+lXnNoHBw8M1ksoxXq7AjHnRh0LKxJ99/nF817nXQlKxW6eTxPyggcfaI+4YELLi8w+/CskzX6ef6ZwdlgrHs1a9nvQ==; 25:lQ22eGrnfspErfFFsIQxPTt40GwZY5HnLU62UAzj57yjd+VplBu/TG8o5doUT7VLm2xabFBIDfspijBeR/5Mo3DLb103IWaSCvH+CiedSoJcntJqO4KvdiN40aMCH+smdzEKTqPBNxrsN+JoaanCJ84xcZ/cghTCgWiUea/H9TFUuoXgRB6cr7iWad14+NFGtVVrkeheI1yuwQab2Mz5zCykOWyS6fSM4FW/g7GcrBrCuzI697Rebge16h+hxhBECqP+QN7W+e/EwXR9iawnFySvbakWXAjx5QI/TYEQ5/X84QtQi4r9R3ukxykEn3oQz6j48t0423bJylWnFXy2gG40n/TtnrU3kM13zDqMR4YTYAxLqr8JwXmot8TQfos8BqjFmZOiGiqEGJKti7VImujqqgzlfrKcgK3nePnl8khKLB878G3eth8hJHNYB7DsKEIgGPzSqyOiIsflm4EZfFukFpmPUE89iBjzmA2pgg0= X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0847; 31:SPkYHjTl3D3jTRDNrPpGoYbS309jRa2tPrpQqMfbeI7oq+5O/WKGn8OVy5IgAg3x7ggOLnbO38M4V/2Mpjo07Zx+ga3XQfaT8oSKt3LAWgIGa8PcQYeQW9QRbfrZqpY3ZfBShz4Q96e+01B1dyxRQUA2PYjipm6LVrponhjTn4RPesht+oU7SACo8+sodoHo7yw5UuTgmRp1tBLr9CACN8uPGMb7Ei2HeeZHp+JD8xM=; 20:YSbg1lXDZl8ZpqdnLV/on3TfOe5YcvBaKB+CcBQ2gL9NkKdxqUMHOWTulvgmu1zeOIlFCacTp+UzNgV5k81mJcj2veuJOUNRCTqUb115gjDTLgttkTFVm09VVLVF/JwOgHOqPaiWfocj9GgMjGueWfquKyGbxVOPryaVG7cfi1vgLkpKm2xrS33tTPcKUMc+tvrVOXK8iZ8IHLw41JWqU1vpMHdgxbsIJCIsNrMQOBs7mgx3NmbYU5t3exBt+IH7xwz+ogq+hDNGRPGDAlv4lJdfxU7n64ylPhcYlyZdHuDdn9/I+BKenqmj0yBsiYaTSAKmrEfllXkzPadIMbd2paKofoba9jX5NG9cOL64cUe6wT0axB565JNFOjqz/0Ym+AYKJCekCSqbVm+mm7ScxMmMidOrUWFog/1chfQ0B7M= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123555025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR08MB0847; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR08MB0847; X-Microsoft-Exchange-Diagnostics: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OrwIOS9z7naiO5J1G?= =?us-ascii?Q?H+DGEqO40Dd+FycUqQt8vrOKUS4YjlAv7Ns5oyPMpWuPvtN/73x/vSMEcyr1?= =?us-ascii?Q?6PLyeA0i2/jEC78oiPoJrV8qqRf0QMga3JvzNXLpJal1GxIWPAtZXsd8SmDg?= =?us-ascii?Q?Qs5C2KtJMlRTF3bC6p3cXmk5JcTH9ISCc6pmD5J2V/bJTkUDH8/i6iWZwsb9?= =?us-ascii?Q?Vif6SYFbH4qLhsnypyo6FQ0EbEiR0H7BRg8ivrF6yGRYlpzJLFvE8tSy3GPS?= =?us-ascii?Q?h4cfV+KtDct9crI883jS/DZCp4xtLS?= X-Forefront-PRVS: 033054F29A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39410400002)(39400400002)(39840400002)(39450400003)(48376002)(33646002)(36756003)(47776003)(6486002)(478600001)(66066001)(5003940100001)(2361001)(2906002)(5660300001)(2351001)(50226002)(81166006)(8676002)(25786009)(1076002)(6512007)(6916009)(53416004)(76176999)(42186005)(189998001)(38730400002)(53936002)(4326008)(50986999)(107886003)(7736002)(110136004)(6666003)(6116002)(3846002)(54906002)(2950100002)(86362001)(6506006)(305945005); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB0847; H:rkaganb.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR08MB0847; 23:JNDoGBt4Cnp1ajL4Z8P2JOFU6ggq4Zi2IEYH3EN9L?= =?us-ascii?Q?K+FTmH7/iaKQ116seSmcEbOTN7AsSiHYL8wYh0ZMCRtqkZrvDeyEF4pVeqKZ?= =?us-ascii?Q?D6k1gQIzHG0xs8MAqrB7XtFWjrL6zyjn+upc+6TEuD43S6/+3KvfNM/r9pGI?= =?us-ascii?Q?9/Oi+5T5+LhuRYu0j1W5YN6pkB5TS0UiUOgF4yUUHC/Dioqk1qWU5xkpAvVy?= =?us-ascii?Q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v7DGgAaanoYdd2z9XscXMuwD/WJwA492pGfwSl5XHeUbr5dpNNpO3Lb3ILaYLgDg2BalU17ZLQn1gpm; 24:tMV29ZeuFSdvyS205J8Fq9RZQk1bULWXa1Jiqxhu1aqLQE5UfqaTv7Val/gs1UHhyJxX1jGf9lnbvHTMmG9ZRaRCGpkt47Cj2iSwIee2nL8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0847; 7:QvHBwbx9kRSD7gsD4BriGba1BFLhm/djdY31W1lVl7WoDHerfjfsZmMgjbBJN0s7/pLQn9qYEK5ttt3xPCQsxzPcWceQ7+gj/rCSXEhKcMnmEbOdO5qdwSMPk3IQHUjo9mwdc6boCfsSuXryktaBgWgbpU8TXpcffq2++nz+Apcs1Vavsa13a3cQYPG5KDnlCxH05ogzfGuCvyIKHFEaYuewS/sZ9FJj1NOmdUfVnkjsZu+pmpTafT3SNjV43M1rGnNKPPmbi2Sv3gETElxMvfxD9ZRfVILVmQT9dbflJIjmWWbihB5SgngWL7MBe4s3lF3RZ7+fLoMPgI4MsXlYQg==; 20:5niuMaSfIiDnv0KXnhoUbVvrGkY5ki2xSnmO7ZICfS4GtVL7Cc2LdgwAbN7XbM/0oME2DIIhYkWp1+nZZ59GsYd9GTxYZCjrxXvzWQ5iA/FOdfwN8EkxzVgFVItYEGKFg4CRXOYS05GrBM5O7xFEWURZUiFqqt9NLfS0BZ+K4QE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2017 18:20:02.8355 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB0847 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.3.97 Subject: [Qemu-devel] [PATCH 09/23] hyperv: synic: only setup ack notifier if there's a callback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Evgeny Yakovlev , Eduardo Habkost , "Denis V . Lunev" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP There's no point setting up an sint ack notifier if no callback is specified. Signed-off-by: Roman Kagan --- target/i386/hyperv.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/target/i386/hyperv.c b/target/i386/hyperv.c index 9aa5ec5..3ed5a48 100644 --- a/target/i386/hyperv.c +++ b/target/i386/hyperv.c @@ -77,15 +77,14 @@ static void kvm_hv_sint_ack_handler(EventNotifier *notifier) HvSintRoute *sint_route = container_of(notifier, HvSintRoute, sint_ack_notifier); event_notifier_test_and_clear(notifier); - if (sint_route->sint_ack_clb) { - sint_route->sint_ack_clb(sint_route); - } + sint_route->sint_ack_clb(sint_route); } HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint, HvSintAckClb sint_ack_clb) { HvSintRoute *sint_route; + EventNotifier *ack_notifier; int r, gsi; sint_route = g_new0(HvSintRoute, 1); @@ -94,13 +93,15 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint, goto err; } - r = event_notifier_init(&sint_route->sint_ack_notifier, false); - if (r) { - goto err_sint_set_notifier; - } + ack_notifier = sint_ack_clb ? &sint_route->sint_ack_notifier : NULL; + if (ack_notifier) { + r = event_notifier_init(ack_notifier, false); + if (r) { + goto err_sint_set_notifier; + } - event_notifier_set_handler(&sint_route->sint_ack_notifier, - kvm_hv_sint_ack_handler); + event_notifier_set_handler(ack_notifier, kvm_hv_sint_ack_handler); + } gsi = kvm_irqchip_add_hv_sint_route(kvm_state, vcpu_id, sint); if (gsi < 0) { @@ -109,7 +110,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint, r = kvm_irqchip_add_irqfd_notifier_gsi(kvm_state, &sint_route->sint_set_notifier, - &sint_route->sint_ack_notifier, gsi); + ack_notifier, gsi); if (r) { goto err_irqfd; } @@ -123,8 +124,10 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint, err_irqfd: kvm_irqchip_release_virq(kvm_state, gsi); err_gsi: - event_notifier_set_handler(&sint_route->sint_ack_notifier, NULL); - event_notifier_cleanup(&sint_route->sint_ack_notifier); + if (ack_notifier) { + event_notifier_set_handler(ack_notifier, NULL); + event_notifier_cleanup(ack_notifier); + } err_sint_set_notifier: event_notifier_cleanup(&sint_route->sint_set_notifier); err: @@ -139,8 +142,10 @@ void kvm_hv_sint_route_destroy(HvSintRoute *sint_route) &sint_route->sint_set_notifier, sint_route->gsi); kvm_irqchip_release_virq(kvm_state, sint_route->gsi); - event_notifier_set_handler(&sint_route->sint_ack_notifier, NULL); - event_notifier_cleanup(&sint_route->sint_ack_notifier); + if (sint_route->sint_ack_clb) { + event_notifier_set_handler(&sint_route->sint_ack_notifier, NULL); + event_notifier_cleanup(&sint_route->sint_ack_notifier); + } event_notifier_cleanup(&sint_route->sint_set_notifier); g_free(sint_route); }