From patchwork Tue Feb 6 20:30:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10204113 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 DE6F160327 for ; Tue, 6 Feb 2018 21:06:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D18D02859E for ; Tue, 6 Feb 2018 21:06:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2AD128D23; Tue, 6 Feb 2018 21:06:31 +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 1B8022859E for ; Tue, 6 Feb 2018 21:06:31 +0000 (UTC) Received: from localhost ([::1]:34054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejARi-0002Jo-5u for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Feb 2018 16:06:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej9te-0000XH-F0 for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej9tb-000320-5R for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:18 -0500 Received: from mail-eopbgr00114.outbound.protection.outlook.com ([40.107.0.114]:60650 helo=EUR02-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 1ej9ta-00031Z-Rk for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:15 -0500 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=Fq3vrlUtNeYgTh4laUdwUp3nmT2GagoKmWPZ14J+ZJ0=; b=UdRRV6WglaWfjosYOwF0uysjUnMcCkbhZixvBeYiazXLHBY5eHm2vt0McWUGscOp6v7ti1SRytG7t8uwQOhQcR7bytgNQ6pYCzr9yQxnwV7GPZnvY924SO9rxsBQt03RBzau3fQ+ww+0MK6N1DbBWNdJrJTmU7DF/3zGVmpQdkw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (195.214.232.6) by VI1PR0801MB1983.eurprd08.prod.outlook.com (2603:10a6:800:8a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Tue, 6 Feb 2018 20:31:11 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Tue, 6 Feb 2018 23:30:18 +0300 Message-Id: <20180206203048.11096-5-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180206203048.11096-1-rkagan@virtuozzo.com> References: <20180206203048.11096-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0301CA0008.eurprd03.prod.outlook.com (2603:10a6:3:76::18) To VI1PR0801MB1983.eurprd08.prod.outlook.com (2603:10a6:800:8a::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1fe59ac4-b8e4-491d-9129-08d56da0903b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0801MB1983; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 3:cIOx4atKamtL/xOLEZbfyDc8s3GkIUj31Qx+9jgmOQtFHbwqTlOsJ8RghaZSSunng2WSKZ4qlNRdvgtBKv9sIdfjik6lP8PhEkrjbnFHMTFgz3a3v9EjThRO6zjTQJyWUlljLlTGVCOjOzq2cLxZ0up0oipdb+w6koPWIiBaUAaAJBogivlojCGYFjNKNhzJZgmRJOUvVhozId+6ZYS/+q/pXfkLy/EhXHu6/ue9gLUuUpZrP7X1FbhdwlYSfqH3; 25:ExePoYvMnLwY9IcVUiV62u4eh2aXAwnN9Pv/7kZHNAPZ18/fQi4P24NJphaGmSNpqSWBDWHCGxEBxBbn+AcKXYohgZ3YaKYwpFpqFcWWPXd7AcZvLslTzc6eBtoFs5SfFHMpWYw9QB1uNwxDvEvwOmDsSs/8zCCnquob0LB8VOTtPZ+uAF7CYs/ljU/QMytQpHc8S8tgawajCBaVBKGGM8KU3eX785/Xu5cmNowCADqkNufysHpALxRZI9yjwXTNrvSQvFo3xfrm3THAvGVL5Ymd1RJ7KpzTelO//LXQZ3jqhWVbCAfPmRPEhWZuJ2x1CRbJcQivLEHH+TgFKlVZiw==; 31:X/+hhgs7lgnop+9V8edwFwTVWHWsJ9tQc2pF9WnGeLWWGNQnbhuw85XLL4kdb0l6/fsCyE+p8RX6trLEzV0NpnJM+a7ERp2PdluF7nfABst1+CaB7NmwX2mRZ0im7TU+56Svf89mq3IMNQ/HHR90dgzGNIS5kCdkaLXMjUD524Q6Yw5EqgJDRqSz2bM5QIXgSwOJrpJdChkq8rYW1Xc2Ze62vmUqCBRFBzrNeI3NBWY= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1983: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 20:3t9jgR+pXH2JJq5Ui7YsPbKRFKKrkBOJWGVOZ6kYebjaX99W4/qQEoHygrHgXU+oJzub72LCnPqdXJe8yUu2liMtAl21dux8TsdI/qW2gAABUc1BJcs1ywLXXcmA1DDIgNQ/k8DoaplprOLHu3gTxlEVkdzWqptL2j4NCAt0J5PK+Nzc1+PaKt48QYLeqIg3J2YHESFCVrBF2GqjykA1Fo6txdV1JAkiviG9ReGrhdQYvbPHVgujzEWQECSvTqGfR/vrpthNqJqNmfxqnAamn+K5pt5sTxcIePHwBmsvIXap1mLGMx8mWufq/j0UHd4wiNtIPenTRAOA74gdBwqj7RenrE7V5BbWh1uswYDGgooHk4BiOYR5mn4Q8H5CVrrVX2Ir1ypvzWXZ4gJ7fHwBxyInBWYCOmEjY28Ag8nv6Xk=; 4:JFxLzRjNW4N2pvSns7keHQFGWyS9B5AEM/Qb8utguMp0BjRaqCNea7rPKBG0wdSlyD7qROkGxQ3ohHLcZnOzx7xReNQzImdGcPr/kphOyjCs05WMPBgQEBUTx5xUa44snbx6pc+P4JzV4RUI+hLQrdmqaxtNb/JRWR5tC4oLIpjGh21axDsAnJztCXL4opuVzmJy9fikgxGM3DOd92OJgThlZTBu3dZkjlcBIJ4lBX2kJrixdMlMBtni3ORlH3XesyTgWIXwdgS+WNSQaPDHSw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231101)(2400082)(944501161)(10201501046)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:VI1PR0801MB1983; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1983; X-Forefront-PRVS: 0575F81B58 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(366004)(376002)(39380400002)(39850400004)(346002)(189003)(199004)(16586007)(53936002)(305945005)(54906003)(7736002)(3846002)(316002)(105586002)(2361001)(106356001)(2351001)(6116002)(1076002)(50226002)(8936002)(81156014)(5660300001)(8676002)(81166006)(7416002)(2950100002)(6916009)(76176011)(86362001)(68736007)(66066001)(16526019)(47776003)(50466002)(4326008)(97736004)(26005)(6512007)(51416003)(2906002)(52116002)(386003)(6506007)(48376002)(55236004)(36756003)(53416004)(69596002)(6486002)(478600001)(186003)(25786009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1983; 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; VI1PR0801MB1983; 23:QF2VQrAfz7jCZvieYREqwmp9l1Nsjj3KXtsgF5p?= =?us-ascii?Q?jD3jUZwepcNaQMJY2mLsetSPiwdUbxCrGrLWyOv42Q9DFzh+jHPXsDxvWGKb?= =?us-ascii?Q?BAQwio6V6dWza6ToAftxUXLomVl8f9Oo1pFxl3J24VUqYrUgsQ7z9W9PXv7u?= =?us-ascii?Q?6N/n7UU2Aen5W2S4zle9htkKfGz6bsNE/sadZ3gU/URkg85Rgn/sNPM5Udq6?= =?us-ascii?Q?b722AjdCAqY6bD6UEalnNvEW+mbCmyKScU+X4dHGlsYBnA1UW8NG0o4im5+K?= =?us-ascii?Q?cpMZwr6O14HFf8r5dZJeRgaYxNLHiOgCxqy2ObUJsqAUGnyRS2P1mm3zOIl/?= =?us-ascii?Q?ZQ27+GKzePHHUbxDqZup4rFTLJxMODAQDcMCwMPlsef6HtVrA8h1SER8PhFs?= =?us-ascii?Q?ciDazQ7Vmt7r0rW0s6VljcE7VYFLoCMCw4Zs3HLPnBHVj/vKvyrjNMkFASFa?= =?us-ascii?Q?q7kwS08JKuo0T+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u/VvyW7yoDiCt4HdtiWZhKnRRoJIiU0f6w= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2018 20:31:11.5435 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fe59ac4-b8e4-491d-9129-08d56da0903b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1983 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.0.114 Subject: [Qemu-devel] [RFC PATCH 04/34] 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: Ben Warren , Konrad Rzeszutek Wilk , Krish Sadhukhan , "Marcos E. Matsunaga" , Jan Dakinevich , Vadim Rozenfeld , "Denis V. Lunev" , si-wei liu , Paolo Bonzini , Vitaly Kuznetsov , Cathy Avery 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 e762eac79f..f3ffafa4e9 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); }