From patchwork Fri Mar 13 12:33:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Heyne X-Patchwork-Id: 11436847 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 169BF139A for ; Fri, 13 Mar 2020 12:35:35 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E781F20724 for ; Fri, 13 Mar 2020 12:35:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.de header.i=@amazon.de header.b="m1kBGk/M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E781F20724 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCjW5-0006VC-WD; Fri, 13 Mar 2020 12:34:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCjVH-0006SD-W8 for xen-devel@lists.xenproject.org; Fri, 13 Mar 2020 12:33:28 +0000 X-Inumbo-ID: d411e7ba-6526-11ea-a6c1-bc764e2007e4 Received: from smtp-fw-9102.amazon.com (unknown [207.171.184.29]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d411e7ba-6526-11ea-a6c1-bc764e2007e4; Fri, 13 Mar 2020 12:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1584102803; x=1615638803; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=6O8VBOGvr5WUoEfBKPbnEZdWawUmQ5qWCa/btGpiBco=; b=m1kBGk/MxDmT629Qwq9j1BkLftLC6ori0RXixxqfD71z9edkh9Oi3Tls Wlp0aC/2VhcoYTzaOkANZYKJ6Ax5ftKgjGl8szLZ5uBOv/zcn+s9HEPT8 XzvjZaj4Dl/gCJmCgnsZMD0yGkCtJ3jJ32gbpQD9Xpe5NkuqaNwqQkMNR k=; IronPort-SDR: PBjDWD+72t0Sgt36kfYExy7ggBjstxkcoHY7UpdiScYpdcU/lbCxSeZQMk3GYtrBBmy5uQgrpA FxqKMcpNHJlQ== X-IronPort-AV: E=Sophos;i="5.70,548,1574121600"; d="scan'208";a="31028704" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1a-67b371d8.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 13 Mar 2020 12:33:21 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1a-67b371d8.us-east-1.amazon.com (Postfix) with ESMTPS id A1A66A2275; Fri, 13 Mar 2020 12:33:20 +0000 (UTC) Received: from EX13D08EUC002.ant.amazon.com (10.43.164.124) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Fri, 13 Mar 2020 12:33:20 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX13D08EUC002.ant.amazon.com (10.43.164.124) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 13 Mar 2020 12:33:19 +0000 Received: from dev-dsk-mheyne-60001.pdx1.corp.amazon.com (10.184.85.242) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Fri, 13 Mar 2020 12:33:17 +0000 Received: by dev-dsk-mheyne-60001.pdx1.corp.amazon.com (Postfix, from userid 5466572) id 87454222D6; Fri, 13 Mar 2020 12:33:16 +0000 (UTC) From: Maximilian Heyne To: Date: Fri, 13 Mar 2020 12:33:16 +0000 Message-ID: <20200313123316.122003-4-mheyne@amazon.de> X-Mailer: git-send-email 2.16.6 In-Reply-To: <20200313123316.122003-1-mheyne@amazon.de> References: <20200313123316.122003-1-mheyne@amazon.de> MIME-Version: 1.0 Precedence: Bulk X-Mailman-Approved-At: Fri, 13 Mar 2020 12:34:16 +0000 Subject: [Xen-devel] [PATCH 3/3] xen: cleanup IOREQ server on exit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson , Paul Durrant Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Use the backported Notifier interface to register an atexit handler to cleanup the IOREQ server. This is required since Xen commit a5a180f9 ("x86/domain: don't destroy IOREQ servers on soft reset") is introduced which requires Qemu to explicitly close the IOREQ server. This is can be seen as a backport of ba7fdd64 ("xen: cleanup IOREQ server on exit"). Signed-off-by: Maximilian Heyne Reviewed-by: Paul Durrant --- hw/xen_machine_fv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/xen_machine_fv.c b/hw/xen_machine_fv.c index f0989fad4..66eb4a1eb 100644 --- a/hw/xen_machine_fv.c +++ b/hw/xen_machine_fv.c @@ -31,6 +31,7 @@ #include "qemu-aio.h" #include "xen_backend.h" #include "pci.h" +#include "sysemu.h" #include #include @@ -67,6 +68,8 @@ TAILQ_HEAD(map_cache_head, map_cache_rev) locked_entries = TAILQ_HEAD_INITIALIZE static unsigned long last_address_page = ~0UL; static uint8_t *last_address_vaddr; +static Notifier exit_notifier; + static int qemu_map_cache_init(void) { unsigned long size; @@ -283,6 +286,11 @@ void xen_disable_io(void) xc_hvm_set_ioreq_server_state(xc_handle, domid, ioservid, 0); } +static void xen_exit_notifier(Notifier *n) +{ + xc_hvm_destroy_ioreq_server(xc_handle, domid, ioservid); +} + static void xen_init_fv(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, const char *kernel_filename,const char *kernel_cmdline, @@ -317,6 +325,9 @@ static void xen_init_fv(ram_addr_t ram_size, int vga_ram_size, exit(-1); } + exit_notifier.notify = xen_exit_notifier; + qemu_add_exit_notifier(&exit_notifier); + if (xc_hvm_get_ioreq_server_info(xc_handle, domid, ioservid, &ioreq_pfn, &bufioreq_pfn, &bufioreq_evtchn)) {