From patchwork Fri Sep 21 08:18:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10609275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A084214DA for ; Fri, 21 Sep 2018 08:26:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E5AF2DACF for ; Fri, 21 Sep 2018 08:26:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 820FD2DAD5; Fri, 21 Sep 2018 08:26:47 +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 033B62DACF for ; Fri, 21 Sep 2018 08:26:47 +0000 (UTC) Received: from localhost ([::1]:54397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3Gly-0002XF-8d for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Sep 2018 04:26:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3GeT-0003cq-NY for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:19:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g3GeP-0001Fr-Bo for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:19:00 -0400 Received: from mail-eopbgr60095.outbound.protection.outlook.com ([40.107.6.95]:38256 helo=EUR04-DB3-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 1g3GeP-00012c-0m for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:18:57 -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=L3tAHKVy6bRPLzmSpTHcARIftfnelMpSM7w1uXW88byRu3H2/faiOcTYeYOl1hOOXwwPFbzFYHsmpMPAzEtGMTgjSs+4K42H+89AoeMNZBAnTfetCgTcMxyE+P8Tq5MsjVNyASSLHw4yfiKP5z72O4I0cQcTNeQWjt5UOUCYICo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by AM0PR08MB3586.eurprd08.prod.outlook.com (2603:10a6:208:e1::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Fri, 21 Sep 2018 08:18:52 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Fri, 21 Sep 2018 11:18:32 +0300 Message-Id: <20180921081836.29230-5-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921081836.29230-1-rkagan@virtuozzo.com> References: <20180921081836.29230-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1P193CA0009.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::19) To AM0PR08MB3586.eurprd08.prod.outlook.com (2603:10a6:208:e1::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 08f6e278-bd3d-44e1-618e-08d61f9ade97 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3586; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3586; 3:pK6MGg2Tl7pX9dbfuTXot1HiDdNupKDy/1rAEFpzj94q4A07Z6MiWrag6CDsx15/dVMGIsEHvdcgK7zNZ4R5xs5WOKaML8VZX0AM/3lGjhdeEsx7igjHQeup7JkBjtW0X4BzSe6JBQDVzqMPT6siqyO42GNr49hVsYr/+heSqqwQrsk96va1cdPBYESBb4XbUDeBs58fDZNofOkKtQrCbzkC/1AIyZdfvR1KoJls/4GUd2wBNhkHv2xMvsWJWboZ; 25:2KXKF7HgPDQwgZxeJjIuASqOVAUr74DBI52V6n7toHK5joZI4YGebqiGROxygieK9tWZm/wvhjggM9qivZpu5w3LL3Ilc0oGDanv6HpuXk29xjLIlWkVPtVVNrzfp963h56uhDISkCubffz0BVEwuHFXLVit1TTWne8LFDX7pGlkeguRz2Mm+dm9GhFgXzx4IymOLvluu5+pmisN9/MKeTJAsjK8SoYU+k/KxhRDAZHIH4LHfzsmVLodfG1qaYwzUH9hbkbflWZmq854h+U9RvuYGBK+Syu77MgVTpxRyjCYHYFff1NTzKUAQ1q4300rBb/NBvDnu8twC5OZwYU1lg==; 31:jy3j/a4dVPjslZOhHb3W8U/uq3cz1WpQcGkcJ/iLoBQfAxyG+8otkRjHNAsxqM+MFWXU4UgXF9t4M8XkonyI/2Sj/ytPLzmCclPdaTXH0qDNCCZN+iYCxSsDnIK8UOwB7eYXnglEpUZYMSprEaMGD5Ymu9YycsqWGDHMoU6klAq3N3PplKWd360XF/lEWK1xqMAH9OBA03V3q5C1aB0vpIDf1Qm0fJeFZHxthlRy9BE= X-MS-TrafficTypeDiagnostic: AM0PR08MB3586: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3586; 20:q1PRQqSsMNzpxlBwNVN3dru6CP2iq44Sq6u8JEWgYmOd1mIHdHHwjqFZgB7BRNQC8CVwfgSdMAsCR+TNG8Go+3+HyMIR+qLqRrlL/cKkDmBxezjxX7r1uS7zPFDbLuGTJgBWsjrJb967mes2tTX9cM9kfZGgprEgjnmRHVoegs06qQMK9NivwqF7twIwZ0v1App6b0DpvgBcIxSDyInJNFOOO8BA96ABJMjpoh33f8x6WThOuGbFd+UF9zShO9/tZftCEO4+iH7wl0umK32KV+AAROpriG+BY8+CbNczmgtvLCloAoZTgnusCXxhzBfG2oZZEJ3yf+KRHEfrp6ETcBYMDHlIYm2KfoEuUbuogaOcj3mQ2BxkFUUOZSK/lMW/TohBrYvC8J06DoVIHh9gZfHlgaTtEJgeFUYMb/J67FH5xu0OCcgv4L3C+9sMw+py078kI2qYwlZZMVkOJS2viwyz46h2OL2o23XoN3sHo9zUpbPoczLSuGceRgTc2R6h; 4:Lc3VS1AsxCN2rEq5J7MqgozFhnNDAMbEe/6I3U9RgiWDbZ6h4Y1p7X/GaqCX03G4cBn/NCpVanvmYVMcDotBdg3my8Sg8jp5djEL6TUKHOFGqNNDc1kILmHaEUVh031I14DQBeD5jT+yKdU5MviESXb/adu+CGnI521vxLSeNvamYrYLQWkqTee/km62JL6/lkFssO++PZgUPHNZ7VApTBkhhJElnSkij7iIdiSZRg/7HbYr7nJFJpfTVEXainYQIUsQa6Yj7qaD1NrYh0DFwQ== 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)(3002001)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:AM0PR08MB3586; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3586; X-Forefront-PRVS: 0802ADD973 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(136003)(39840400004)(376002)(366004)(346002)(189003)(199004)(2906002)(81156014)(50466002)(51416003)(305945005)(575784001)(25786009)(2361001)(478600001)(316002)(7416002)(54906003)(86362001)(16586007)(26005)(52116002)(48376002)(8936002)(36756003)(76176011)(186003)(50226002)(386003)(69596002)(2351001)(53416004)(106356001)(6486002)(11346002)(476003)(446003)(8676002)(16526019)(5660300001)(2616005)(956004)(6506007)(81166006)(68736007)(6116002)(1076002)(6666003)(486006)(105586002)(97736004)(4326008)(7736002)(3846002)(47776003)(6512007)(66066001)(6916009)(53936002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3586; 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; AM0PR08MB3586; 23:iuD2rTLgvj7N1uwngqMX1oT7N1LoQs713FOzIVojM?= 19xz4RvuSxgKUrI5XPHQLcAgoR88ScEMYfArpXCSOnIVI/CSd+nJFE1kuoH9wTJtXaDWuuO2fKmpjIuu2GBa9wGlOUNLYlsqz6F96Y102T6XiG1hMeASTWNU7vBVk4xbA/bcgYfvuHUtzWgSVEErrepybufr5KTdxL7XRi/lsJbnEvSTCDZrh5XLIuJm/oZue2mCTO6xjkWAMUi+zK7VeVHBRlMY8/JFR9Jf6Pr5oDaEjiGXyseaU0W7R27jEFgMA+sGbVeHS8bn58kEMx18v9UtJa71LkxRmvrbFoVQ21cxfXoz+lDCLep0BlR99cSecXey1HfzOGb9XBja7wcWgLpijSzoSNu/WBWi/v3oYCdlq76vaFhxU29AP8HHmgYAmW0wftcyL+FU0euYuP31aMNJl0eBE+Ygz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TouAlTEiPV4FoaOC1AELS6DcnDW1PTTKpvJFO2K1DWc4VuZbMHMGApF58 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3586; 20:LoF65GP+CsoS0Gni8Fg0NX3aVGJhE8J9FDudzvI79oJpFh7e9213EEHmSbuYK4VXxavvFQJ36/IR62QvJ27p0bwcR+nqWB/gv0iCVI+yUbSB2I61XaxQOnoYuwpnH85ttGRUkCEZT2Aalx0GH+eb7J+K+4V+q/ioZsC7mh+/IkE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 08:18:52.7515 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 08f6e278-bd3d-44e1-618e-08d61f9ade97 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3586 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.6.95 Subject: [Qemu-devel] [PATCH v2 4/8] 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 , Konrad Rzeszutek Wilk , "Michael S. Tsirkin" , Venu Busireddy , Liran Alon , Paolo Bonzini , Si-Wei Liu , Igor Mammedov , Boris Ostrovsky , Karl Heubaum 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); }