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=-0.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 A565EC433E0 for ; Thu, 4 Jun 2020 10:51:04 +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 6D8F6207D3 for ; Thu, 4 Jun 2020 10:51:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KTty5MTz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D8F6207D3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 1jgnSQ-0002Ow-5H; Thu, 04 Jun 2020 10:50:46 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jgnSO-0002Or-OF for xen-devel@lists.xenproject.org; Thu, 04 Jun 2020 10:50:44 +0000 X-Inumbo-ID: 3d0a2df2-a651-11ea-81bc-bc764e2007e4 Received: from mail-wr1-x431.google.com (unknown [2a00:1450:4864:20::431]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3d0a2df2-a651-11ea-81bc-bc764e2007e4; Thu, 04 Jun 2020 10:50:43 +0000 (UTC) Received: by mail-wr1-x431.google.com with SMTP id j10so5547653wrw.8 for ; Thu, 04 Jun 2020 03:50:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:thread-index :content-language; bh=nUFyO32duoOSfs+J/3Tj+DbYbB4ZRTeXA2objZH1viU=; b=KTty5MTz6rh24hiJjjvJpDqqqamqP00bb75wpNNsCRCfzgxMwgUJ7cpDCEXQYEOmKx mGXxY0+rhe0FbxIm1L0/YDS2DlOwVjptqARdnUwdy+EU63UsGO3meFwcK1+BQygg5vZf VI1mWZzCPeKx0F00OfegMeAEB0KmeilCeTwvGsXsC8dvzV1xBJv23MTzcJ3kNF8u/s4G 7aQBqscvgTTPiX/OiS//Hfok2AfDIZKFLZ8q7fV4muvAJQwh/mJdAx0nW4zg+CDHjpKQ TeQOVxqUjsfWwb9WPLkXPrgFKhR6cSHv83ZBngFyz6W2uHQtLSZA9Ib72rPgiOauxeiy haew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:to:cc:references:in-reply-to :subject:date:message-id:mime-version:content-transfer-encoding :thread-index:content-language; bh=nUFyO32duoOSfs+J/3Tj+DbYbB4ZRTeXA2objZH1viU=; b=eE+9C61pzENVryzuJ+FOtapDAqDY01yUzuygoqrySHY8QYqm4h3y/2mZgCloEeOA2t wFmfDKRSy4bUao/0QNv/lQL88nTGpZbKuoH0S3QIkuiHMJHPbrLI3SWFHnubYSrMaL9G Z9QMaVi8LcbRA22cJhhS0zjnBVIEfbjNMW2VvXKz8NbB2j1UgFf52IDve95djleXg3SM 2wvmmpx/l/1ouBFKv9AUyOc8z7suwYx0fzguUfuTDFB3fUhQYca/5AHYLqI8fo+i2+gs mKoHv6wzhhwP7N6MTbXA+2Vsbpz4rCXxYdmlIvI+aF+6LSPg57ntrhPev1NxpXtui2gc ebdQ== X-Gm-Message-State: AOAM5316A5xUneUDeE8z0444Fb8G/RoHXvRKps2dn+Mr4ifhGBQZ5Kjn 84T061K29ZNjonAArqs9/wc= X-Google-Smtp-Source: ABdhPJy5dPNM2tGSqf+FwA/Rxze+LaLDvtwAbx5siXV5WGg8ViuwjroM0J0giqPhKaVHi81yrxp5WA== X-Received: by 2002:adf:a1c1:: with SMTP id v1mr3941049wrv.205.1591267843180; Thu, 04 Jun 2020 03:50:43 -0700 (PDT) Received: from CBGR90WXYV0 ([54.239.6.187]) by smtp.gmail.com with ESMTPSA id d16sm6822665wmd.42.2020.06.04.03.50.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jun 2020 03:50:42 -0700 (PDT) From: Paul Durrant X-Google-Original-From: "Paul Durrant" 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> In-Reply-To: <4d1da8eb-a06e-c97a-09a0-e84070dc5ec8@suse.com> Subject: RE: [PATCH for-4.14 v3] x86/svm: do not try to handle recalc NPT faults immediately Date: Thu, 4 Jun 2020 11:50:40 +0100 Message-ID: <000f01d63a5d$fe3787f0$faa697d0$@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQKnLWBT9mNjQEOL+u7d2oiXq95SHgJRYkBUAnFt9OGnAEkYcA== Content-Language: en-gb 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: , Reply-To: paul@xen.org Cc: 'Igor Druzhinin' , wl@xen.org, andrew.cooper3@citrix.com, george.dunlap@citrix.com, xen-devel@lists.xenproject.org, roger.pau@citrix.com Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" > -----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 >=20 > 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. >=20 > 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. >=20 > 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; > } >=20 > 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. Paul