From patchwork Mon Jul 2 16:58:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10502111 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 C56FA6035E for ; Mon, 2 Jul 2018 17:05:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC6A628D72 for ; Mon, 2 Jul 2018 17:05:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CEE528531; Mon, 2 Jul 2018 17:05:22 +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=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, 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 A5B4128531 for ; Mon, 2 Jul 2018 17:05:21 +0000 (UTC) Received: from localhost ([::1]:34362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa2GO-0004Du-Q5 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 02 Jul 2018 13:05:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa2AM-0007rM-Kk for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:59:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fa2AI-00045X-Ow for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:59:06 -0400 Received: from mail-eopbgr80097.outbound.protection.outlook.com ([40.107.8.97]:59505 helo=EUR04-VI1-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 1fa2AI-000440-D5 for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:59:02 -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:X-MS-Exchange-SenderADCheck; bh=5dhf6hfCBJS0hmk+iXlerSBCbX/RlcSkS0vmyMWZLIA=; b=aeMHmwUt/LapKJVVbWVorxZt4LB86ltQUF6F2XF/g794TO4HGixJ0OCiWs3xWvqzxDLi/o0J1Zds0oRNnth2CLdm0BYq6dtA4CevwDPv4+mh3Um2uRfSF6n8zgCndNk5hmCt9KHtEsoDq1BhJjzfh9x/elSK7Ladl0vgHRZpuzo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by DB6PR0801MB1974.eurprd08.prod.outlook.com (2603:10a6:4:75::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.26; Mon, 2 Jul 2018 16:58:57 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Mon, 2 Jul 2018 19:58:39 +0300 Message-Id: <20180702165842.11423-4-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180702165842.11423-1-rkagan@virtuozzo.com> References: <20180702165842.11423-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1PR08CA0234.eurprd08.prod.outlook.com (2603:10a6:802:15::43) To DB6PR0801MB1974.eurprd08.prod.outlook.com (2603:10a6:4:75::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e6b6d92c-23e9-4130-91b1-08d5e03d1b4a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1974; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1974; 3:4xoYgiOj/yeNdngRqDsWnwHjbuhPJX6hlxevUlNqZ8Bp80IHlpvBA0hf4meRjBGT7JpT5UCVUdzvbeGQXvBhrgdC/ImfE3J4A7mWCltw9Lm8q8y0d9k9sbbdXrjuDn9x7UMdR0qxaorWCP3w6ucjADG7IEl5+bUG4fT8U4HQO7WPshHbnQNsr5KS4sf/hT/pWvb5IgoByy06CbCHPbWH/58AvWukCsIdrk/iFmSMMMm5Y3S0sD55bXDcl6I+1TFE; 25:AtZ1eq1WoQyfohgBCW8ZEBhXlfErOgHU7Gp4S5w6xzt57A5w+tYjiQK1WZYcTE1TCED7GfdNID0LRO5KLz0RIDaWmZDy0BJX/6EQnRrpcVRlFK7PXgWZHPwMXdn+yKXEqw2upUeeHWwSB0JDve9+5eyQfsNSC33zSeXYD9YiqWcIMUAWaAudgq5anpBV3FKyhnJjfp8mRfM5MxsVAedbXWZdsoinjRnTZPO2PDpaHQkg/Yrs025QIf9HXSXXWFIQ/pCfsTlbGpjKaD6/B1Ccvp9mJTZpk/JcbpnyFYorcwZ8N4zuubUgN+bwEz5bvqTp1tabK77yt0USQXPcxb5RKw==; 31:TbF+8ZBLA/j+Wq9Tt80lSZUIIwsls6iLLsZLAlvWDcMBq4uZVvz/o0el7KawRfHXxPV+j1BKWR7izDOovp/SSFHp3vAT8ULvSNQOGzxia4mH0Hu+a0Mxets0Tv6nxUKtRzTzTF+e+fDRHn7uweuS6V6aR127OwNc617o8ZSV6suQg4sUw6MJIT8vFsdj0k+N+JPDnDVvPbGgk7TmtlbZ01vaNbAVQ2sXnVYOzrjIQJY= X-MS-TrafficTypeDiagnostic: DB6PR0801MB1974: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1974; 20:H4IIlTcGP6spVHpENdzHCok/D96NRLLXwiJzaHnZFrQsGfiTMNaJIPTffDVWSwjWUuw1M9BRF68jeZAouT2Vn6L3g0uaztWvvrgYelTDc+aoefsPuxbDxbPdnBVDtMXzc3M7lF5qVADW7HggBYdqN3qtzCb9IDP6Vwtm59xOjdT5vv6sRxJ4ucwIHUU8LuoA0HthLAhzjWy2hkTm6fXTFaVgHGgaSOKjg0of1ByDCQeKAwxAXdASyuYhSi/14zBl69ftOVq8n37H/7u+RqKiMkJVvqU3WbSSZjAF3Rx8aU9mBlFMO0j/yVk7Z1+/OaC2tycZk70GFYplhhVQB8za/0ZFUb/ffWtYZB5DXVMUbp/D/cR69L54oIcbsTBh/k90C4HizgDjtsvodJnuR0tNsyGBtFLpWt3CeVdpns6RcIDBW2fwra1BSzXEoHNniiQUCrdPyRok6WgvrqhKkIZ7tOm3T4Ac6GMg02bX1XD30CtCWzzlEOL7IINgr4g7w51J; 4:rtQKnl5e5+1fSYGQ+MVQps+KjNUoBIWQgfVhqiD0dlIfUqt0y5HmKYFUm16zaYlSd9ORM6t2vHLYV0z6KZz8+jU6wutXOC8CVY1H4c4+XAUBImfZ/qGZAQdQpO7c0PXYb33eQE4Umf+barcnj8mj7DSYfDDtOJXaxLaB70zhGIAl655IJE3M1ekGlEDJPLVV3KVv2gdtPNJeQxlagmmrI5jQ3t/B+jBs7f4IQ9b00nzh9mgEB5OvJr2ZefnlIRdp6tTekgdZFu/TRtUmo/leww== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:DB6PR0801MB1974; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB1974; X-Forefront-PRVS: 07215D0470 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(189003)(199004)(7736002)(26005)(53936002)(305945005)(4326008)(50466002)(39060400002)(478600001)(6506007)(386003)(186003)(6512007)(51416003)(6486002)(66066001)(47776003)(25786009)(76176011)(97736004)(2906002)(2351001)(52116002)(16526019)(11346002)(105586002)(36756003)(8936002)(69596002)(53416004)(3846002)(6116002)(106356001)(81156014)(81166006)(446003)(2361001)(7416002)(86362001)(54906003)(2616005)(6666003)(16586007)(956004)(316002)(486006)(48376002)(68736007)(1076002)(50226002)(8676002)(476003)(5660300001)(6916009)(575784001); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0801MB1974; H:rkaganb.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0801MB1974; 23:6eQUNuF0L/8l7FaGUQQyFJg5yrW/gdFcLBeZnnZ?= =?us-ascii?Q?7Ar4ZmfEC7muT7gKrialSOMJ9coQXpxHTasTgPCFwKy+JT8fVKGiTLgWWzU+?= =?us-ascii?Q?y4kno93TyyjHHja7FFVBX0lVoJ/8HVz6nXQeKE+KlJuf9pgP/apLTXAykyBY?= =?us-ascii?Q?2ySM4pH50LREQRtYzQUH/pRBdZAayU8u8c802st4AJ18LLa071mVgRsxgx8I?= =?us-ascii?Q?prEj6tckohGha0KZIXc5Mluc2ncSMIXOQhMPy8OROxI3ZEKyUkPwqXk/RBzu?= =?us-ascii?Q?oXifLt15SxX1kqWuBIQ/00XCjTxLEdaZsOs7gCJcj5hX4quQ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ftzsALw3QELZ4Crv4Oo3fR3dw==; 5:ZVHTYsXtKRBku4QbYDL7oMwFhHYIFLoQhlZ1I2n9W47PXGC2v4MpxoKcBjlC0z1Jb4zOOu6yzHCqmu5SsRq8Jj2DGqUXoFn2p1kb1wRp46CAKTKrjZ1Uo7OQpECMdOxH0WokNEEISArWVaiVXLAB9gQVIZFbLxB/+p2/wd5ZVRo=; 24:53veB2uS+vsSPKwxgljK1qsniJpAiEOVFwOxPVdATOn6td6xI+PkcYMg4vV8CX7MFLt26DwcjaHPsOgMdGGsDBML7DcVpJuEsmjuhfN+bsw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1974; 7:4joBrHZgo5C56qrYIGXwC/1nLX3dVy8ptKgo4+RkjkQOQA+YfJnCkdfld4OThbZ0OigrlWM9gVNoQa8NbaXKEq1GYp++Pl8AlR15Igb09TtvxzObm9iRmsFBg0pZDX8VlRci9SUsqHqWfjdNMED4s9E5ih7keuq5Rwbn3RDMoQ2+Rw9x8wtX531truhMIVgJGsZZN5/JwI9J/cdXMlNk/8LZ9J3p2OOgwtcpFn4UFJbzKHJ+qJmc3iHwDElsPmpK; 20:J7N1ISNIa0Ry3KawoITULjShb82a5jouDu0MbtgR6phbA4RIqieIy3yrOxXZjdpK/LPDkZvrHtTjM+tVdX6Lz915M5nDjffvWlpV0LQyvSRsgCix9Ve/E4eh5iZm+ifri6s9+5IOQCqT7B4rfgHIo+QgiizakLj/hEy3gSfrOBg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2018 16:58:57.2680 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e6b6d92c-23e9-4130-91b1-08d5e03d1b4a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1974 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.8.97 Subject: [Qemu-devel] [PATCH 3/6] 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: Vijayabhaskar Balakrishna , Eduardo Habkost , "Michael S. Tsirkin" , Konrad Rzeszutek Wilk , Venu Busireddy , Liran Alon , Igor Mammedov , Si-Wei Liu , Paolo Bonzini , Boris Ostrovsky , Karl Heubaum , Richard Henderson 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 47368b77c0..acdb0ca9df 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 vp_index, 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 vp_index, 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, vp_index, sint); if (gsi < 0) { @@ -109,7 +110,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index, 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 vp_index, 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); }