Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56B86C433E4 for ; Mon, 27 Jul 2020 19:42:22 +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 3140720738 for ; Mon, 27 Jul 2020 19:42:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3140720738 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass 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.92) (envelope-from ) id 1k090W-0004Em-PQ; Mon, 27 Jul 2020 19:41:56 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k090V-0004Eh-7V for xen-devel@lists.xenproject.org; Mon, 27 Jul 2020 19:41:55 +0000 X-Inumbo-ID: 3870bde7-d041-11ea-a7f0-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 3870bde7-d041-11ea-a7f0-12813bfff9fa; Mon, 27 Jul 2020 19:41:54 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8EF74AD43; Mon, 27 Jul 2020 19:42:03 +0000 (UTC) Subject: Re: [PATCH 2/6] x86/iommu: add common page-table allocator To: "Durrant, Paul" References: <20200724164619.1245-1-paul@xen.org> <20200724164619.1245-3-paul@xen.org> From: Jan Beulich Message-ID: <344d62f5-1983-9438-853d-795dfbb8091a@suse.com> Date: Mon, 27 Jul 2020 21:41:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Wei Liu , Paul Durrant , Andrew Cooper , "xen-devel@lists.xenproject.org" , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 27.07.2020 11:37, Durrant, Paul wrote: >> From: Andrew Cooper >> Sent: 24 July 2020 19:24 >> >> On 24/07/2020 17:46, Paul Durrant wrote: >>> --- a/xen/drivers/passthrough/x86/iommu.c >>> +++ b/xen/drivers/passthrough/x86/iommu.c >>> @@ -140,11 +140,19 @@ int arch_iommu_domain_init(struct domain *d) >>> >>> spin_lock_init(&hd->arch.mapping_lock); >>> >>> + INIT_PAGE_LIST_HEAD(&hd->arch.pgtables.list); >>> + spin_lock_init(&hd->arch.pgtables.lock); >>> + >>> return 0; >>> } >>> >>> void arch_iommu_domain_destroy(struct domain *d) >>> { >>> + struct domain_iommu *hd = dom_iommu(d); >>> + struct page_info *pg; >>> + >>> + while ( (pg = page_list_remove_head(&hd->arch.pgtables.list)) ) >>> + free_domheap_page(pg); >> >> Some of those 90 lines saved were the logic to not suffer a watchdog >> timeout here. >> >> To do it like this, it needs plumbing into the relinquish resources path. >> > > Ok. I does look like there could be other potentially lengthy destruction done off the back of the RCU call. Ought we have the ability to have a restartable domain_destroy()? I don't see how this would be (easily) feasible. Instead - why do page tables not get cleaned up already at relinquish_resources time? Jan