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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 507E1C433E0 for ; Thu, 4 Jun 2020 10:59:58 +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 2A5682075B for ; Thu, 4 Jun 2020 10:59:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A5682075B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.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 1jgnaz-0002jr-AS; Thu, 04 Jun 2020 10:59:37 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jgnay-0002jm-3h for xen-devel@lists.xenproject.org; Thu, 04 Jun 2020 10:59:36 +0000 X-Inumbo-ID: 794d7688-a652-11ea-81bc-bc764e2007e4 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 794d7688-a652-11ea-81bc-bc764e2007e4; Thu, 04 Jun 2020 10:59:34 +0000 (UTC) Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: XVxB87/Z9g5o5YKbU2OBpRABk1sML0trbpWTiJ0zUHsznL9Ul24n3cKKc0zfuvprxY67muag5Y rJCOnGelI58TqsyAyn3HtL9r06Cxf4y0tZsiepM8xymJkhbeOTkYnCdueP24ZWPtCMYwxYj0x2 k4p76QZ1y6a63AQEQ/WVWxaJZH2apWQfbqeasWfw7DV/abLRbEtnPwNKXKYvWv+1q5nCgGEGQr UmqhgAXukFApC1qH0U1bvfNK4gE0VFpPQO22vphqQcfC/eINoigF8Si6oqnm3XXJFNAiDvZZbT 1r0= X-SBRS: 2.7 X-MesageID: 19502629 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.73,472,1583211600"; d="scan'208";a="19502629" Subject: Re: [PATCH for-4.14 v3] x86/svm: do not try to handle recalc NPT faults immediately To: , 'Jan Beulich' References: <1591224108-564-1-git-send-email-igor.druzhinin@citrix.com> <006401d63a44$a27349e0$e759dda0$@xen.org> <4d1da8eb-a06e-c97a-09a0-e84070dc5ec8@suse.com> <000f01d63a5d$fe3787f0$faa697d0$@xen.org> From: Igor Druzhinin Message-ID: Date: Thu, 4 Jun 2020 11:59:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <000f01d63a5d$fe3787f0$faa697d0$@xen.org> Content-Type: text/plain; charset="utf-8" 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: xen-devel@lists.xenproject.org, roger.pau@citrix.com, george.dunlap@citrix.com, wl@xen.org, andrew.cooper3@citrix.com Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 04/06/2020 11:50, Paul Durrant wrote: >> -----Original Message----- >> From: Jan Beulich >> Sent: 04 June 2020 11:34 >> To: paul@xen.org >> Cc: 'Igor Druzhinin' ; xen-devel@lists.xenproject.org; >> andrew.cooper3@citrix.com; wl@xen.org; roger.pau@citrix.com; george.dunlap@citrix.com >> Subject: Re: [PATCH for-4.14 v3] x86/svm: do not try to handle recalc NPT faults immediately >> >> On 04.06.2020 09:49, Paul Durrant wrote: >>>> -----Original Message----- >>>> From: Igor Druzhinin >>>> Sent: 03 June 2020 23:42 >>>> To: xen-devel@lists.xenproject.org >>>> Cc: jbeulich@suse.com; andrew.cooper3@citrix.com; wl@xen.org; roger.pau@citrix.com; >>>> george.dunlap@citrix.com; paul@xen.org; Igor Druzhinin >>>> Subject: [PATCH for-4.14 v3] x86/svm: do not try to handle recalc NPT faults immediately >>>> >>>> A recalculation NPT fault doesn't always require additional handling >>>> in hvm_hap_nested_page_fault(), moreover in general case if there is no >>>> explicit handling done there - the fault is wrongly considered fatal. >>>> >>>> This covers a specific case of migration with vGPU assigned which >>>> uses direct MMIO mappings made by XEN_DOMCTL_memory_mapping hypercall: >>>> at a moment log-dirty is enabled globally, recalculation is requested >>>> for the whole guest memory including those mapped MMIO regions >>> >>> I still think it is odd to put this in the commit comment since, as I >>> said before, Xen ensures that this situation cannot happen at >>> the moment. >> >> Aiui Igor had replaced reference to passed-through devices by reference >> to mere handing of an MMIO range to a guest. Are you saying we suppress >> log-dirty enabling in this case as well? I didn't think we do: > > No, but the comment says "migration with vGPU *assigned*" (my emphasis), which surely means has_arch_pdevs() will be true. You may replace it with 'associated' or something if you don't like this word. >> >> if ( has_arch_pdevs(d) && log_global ) >> { >> /* >> * Refuse to turn on global log-dirty mode >> * if the domain is sharing the P2M with the IOMMU. >> */ >> return -EINVAL; >> } >> >> Seeing this code I wonder about the non-sharing case: If what the >> comment says was true, the condition would need to change, but I >> think it's the comment which is wrong, and we don't want global >> log-dirty as long as an IOMMU is in use at all for a domain. > > I think is the comment that is correct, not the condition. It is only when using shared EPT that enabling logdirty is clearly an unsafe thing to do. Using sync-ed IOMMU mappings should be ok. It seems that the case of simple MMIO mappings made without IOMMU being enabled for a domain, in fact, irrelevant to the this condition. I take it as a separate discussion on a different topic. Igor