From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 D25DAC433E0 for ; Wed, 10 Feb 2021 15:53:41 +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 7911D64E08 for ; Wed, 10 Feb 2021 15:53:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7911D64E08 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.83655.156228 (Exim 4.92) (envelope-from ) id 1l9rnz-0003rf-6Q; Wed, 10 Feb 2021 15:53:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 83655.156228; Wed, 10 Feb 2021 15:53:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l9rnz-0003rY-3P; Wed, 10 Feb 2021 15:53:27 +0000 Received: by outflank-mailman (input) for mailman id 83655; Wed, 10 Feb 2021 15:53:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l9rny-0003rT-Nr for xen-devel@lists.xenproject.org; Wed, 10 Feb 2021 15:53:26 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a6fb4d56-6a7d-4e5a-b8c6-5b9bb183efac; Wed, 10 Feb 2021 15:53:25 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E890DAB98; Wed, 10 Feb 2021 15:53:24 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a6fb4d56-6a7d-4e5a-b8c6-5b9bb183efac X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1612972405; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8uzm/DX6yvAf4dtEdrcBQOAQnj44/gh/KVu3tROWKUc=; b=LAmJjPDRcNDBskP2AC0ZgtotRZ0oZplBdBfscy0/1aqYUPj3TVq03TqIjD5lj9Tx11g9Ew Hsq81N7ECFi/aEwRlDyX36Tdpd4IiZpZzdQC9eNIJ3veLS9q/vU12egqZgBKXirfLa3fp8 w5bsY2cZsgjk9IWqNXbZ/YhyKU166sI= Subject: Re: [for-4.15][PATCH v2 1/5] xen/x86: p2m: Don't map the special pages in the IOMMU page-tables To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Cc: xen-devel@lists.xenproject.org, hongyxia@amazon.co.uk, iwj@xenproject.org, Julien Grall , Andrew Cooper , Wei Liu , Julien Grall References: <20210209152816.15792-2-julien@xen.org> <5bf0a2de-3f0e-8860-7bc7-f667437aa3a7@suse.com> <65797b03-7bd8-92e9-b6c7-e8eccde9f8ba@suse.com> <71c4150a-0b81-cdc3-b752-814f58cb5ca4@suse.com> From: Jan Beulich Message-ID: <14ed7349-4af7-9882-af1f-08c1739cbf5f@suse.com> Date: Wed, 10 Feb 2021 16:53:24 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 10.02.2021 16:24, Roger Pau Monné wrote: > On Wed, Feb 10, 2021 at 02:12:38PM +0100, Jan Beulich wrote: >> On 10.02.2021 12:54, Roger Pau Monné wrote: >>> On Wed, Feb 10, 2021 at 11:48:40AM +0000, Julien Grall wrote: >>>> It feels wrong to me to setup a per-domain mapping when initializing the >>>> first vCPU. >>>> >>>> But, I was under the impression that there is plan to remove >>>> XEN_DOMCTL_max_vcpus. So it would only buy just a bit of time... >>> >>> I was also under that impression. We could setup the lapic access page >>> at vlapic_init for the BSP (which is part of XEN_DOMCTL_max_vcpus >>> ATM). >>> >>> But then I think there should be some kind of check to prevent >>> populating either the CPU or the IOMMU page tables at domain creation >>> hypercall, and so the logic to free CPU table tables on failure could >>> be removed. >> >> I can spot paging_final_teardown() on an error path there, but I >> don't suppose that's what you mean? I guess I'm not looking in >> the right place (there are quite a few after all) ... > > Well, I assume some freeing of the EPT page tables must happen on > error paths, or else we would be leaking them like IOMMU tables are > leaked currently? Well, you can't eliminate paging_final_teardown() from that error path because it frees internal structures. It _also_ sets HAP's / shadow's allocation to zero, so has the side effect of freeing why may have been CPU page tables. Jan