[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 02/18] VT-d: have callers specify the target level for page table walks


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 27 Sep 2021 11:13:11 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DeHaMMvFOqxOkESfpOQMbNvuPqgWjvBdIjraCg0PN5M=; b=EpYcuNunX2cfnOycgEsIlWTXs+B3ZJN2YK6Z4CnVFn2mXtUrul5YSOjYxD1pZxRu3AMU8ELpf49awM6n78J/yNpdirZOhq/5vYvV6dgC5DBps18kqrd4pHpzVm1Dqopj4psolDwQULReaZtdjIP9/zm+Z19ETigEA9VP/qO6YWwlxqtzO/GM3Pqgt5W2Q54WR4uIbcTdZ1T1fZPfL0gpIwCnpMnnDKtMQ609OEek+vEkqw8BFfolo0KqmjEyCDxzfdPog3zwakMY5opCz/Kq70o0z0DPJm7wIXNg2m/3LnmiayxAWFY0r5PFsj6cyd6WpGemmSnWwzsaE1OwXJNifA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TpOUftQNqAEAjAJk7Nar3ifQWxDMqSKMw8v0DnW6igKWEYabljq9NmDRKm5M8Fr276EPZQO359Ka0OVE012MQYbl3kBqCpzWBFS3C9zxXJV9L/tQmawEAOHlRhRJgLBbau4z3h5RoBxwUDe6fHuJfGOlxac47Se3QXo1+1W6YS5B03w0IQqYUf8m4fK4aJzrNA9L/zC+qr4DPIRzYlBYmZyjAeiMQSWf2dZ+4kFLb1A7FSiUVw1z9Nrrx0IjisOovaUgTQPAhqIZkuW30QmN4dI6CCQIE+f9ruFZ3kIEZ3NAIOgexj504LlPEzDNGd81dABwkbHhdFN7hKI7duQMTw==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Mon, 27 Sep 2021 09:13:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.09.2021 11:04, Jan Beulich wrote:
> On 24.09.2021 16:45, Roger Pau Monné wrote:
>> On Fri, Sep 24, 2021 at 11:42:13AM +0200, Jan Beulich wrote:
>>> In order to be able to insert/remove super-pages we need to allow
>>> callers of the walking function to specify at which point to stop the
>>> walk.
>>>
>>> For intel_iommu_lookup_page() integrate the last level access into
>>> the main walking function.
>>>
>>> dma_pte_clear_one() gets only partly adjusted for now: Error handling
>>> and order parameter get put in place, but the order parameter remains
>>> ignored (just like intel_iommu_map_page()'s order part of the flags).
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>>> ---
>>> I have to admit that I don't understand why domain_pgd_maddr() wants to
>>> populate all page table levels for DFN 0.
>>
>> I think it would be enough to create up to the level requested by the
>> caller?
>>
>> Seems like a lazy way to always assert that the level requested by the
>> caller would be present.
> 
> The caller doesn't request any level here. What the caller passes in
> is the number of levels the respective IOMMU can deal with (varying
> of which across all IOMMUs is somewhat funny anyway). Hence I _guess_
> that it would really be sufficient to install as many levels as are
> necessary for the loop at the end of the function to complete
> successfully. Full depth population then would have happened only
> because until here addr_to_dma_page_maddr() didn't have a way to
> limit the number of levels. But then the comment is misleading. As
> I'm merely guessing here, I'm still hoping for Kevin to have (and
> share) some insight.

I've extended this post-commit-message comment to:

I have to admit that I don't understand why domain_pgd_maddr() wants to
populate all page table levels for DFN 0. I _guess_ that despite the
comment there what is needed is really only population down to
nr_pt_levels (such that the loop at the end of the function would
succeed). Problem is that this gets done only upon first allocating the
root table, yet the loop may later get executed with a smaller
nr_pt_levels. IOW population would need to be done down to the smallest
of all possible iommu->nr_pt_levels. As per a comment in iommu_alloc()
this can be between 2 and 4, yet once again the code there isn't fully
in line with the comment, going all the way down to 0.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.