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

RE: [PATCH v3 17/23] IOMMU/x86: prefill newly allocate page tables


  • To: "Beulich, Jan" <JBeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Fri, 18 Feb 2022 05:01:10 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DeRfIz/ZZN9WK9zX+Y3M8EAmfgxbe1Ge5kugEXG99Zs=; b=U+J33e04r1d0sSIrX2aokD/bhET6XSmq8Px1DDNh7jOQw6nOjgYpkqMJELiVkqMHTXx0LTHFgNZifK7UGQZr/3em1rH7U0i2rEcxBdjnFJCr9h5Ru6IRCwz1ec0seMRi0X4OcKk49tUuRVj4lhsjKc289n5m8ZrHrnRdKyTj6QnkuIs1goIdQ3aYYhT0+8tD+JI2+BnxgJZiZv5xfAJOxvzAYLMbmeIjxbAzjuDB6q7vOpuohLgJkPfqnakl+HekX5UVauLmUTSnRrwTNO1AW1jEMOcZ0yeRny69BE/ipL79k53A+YzuIysqUdV8iWjYrqdpahLuTcnCA0Ghc/QK8g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LM5FSjLIkrp/GFnrFKnKZY6G1eaP4TxlG2Hhj+kCxVVSsdfjW4zZ11wjJLuS732W2mvGKY91rJv8kK17Y809lqwUq2tM8PC1xlYsdnCrquLgmXXNcgNFVQiJ2YFbuCTUqjAmcvSonGXUf/oFJiq3d1+A4641ho2R7i6mzrm1V8OcoZM3PIpArB9vG5/FigCD40abR6+LdHf//LR/zZuDgxjMCJfMLTKpnQ1LtICOwYcwOYhCeqdpAUpzYMA+42jIUGoSLOMWkCJPOwakwoa0BftOVeqZrUwTTNtRBWQhsZ04WyYnpkZtCEF5H1HUNoKoNLzJpcajmRWzR1/M8+W2pA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com;
  • Cc: "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Pau Monné, Roger <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 18 Feb 2022 05:01:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYBkAJc6JSR61nEESS/gtIFkcsm6yY/BvA
  • Thread-topic: [PATCH v3 17/23] IOMMU/x86: prefill newly allocate page tables

> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Tuesday, January 11, 2022 12:35 AM
> 
> Page tables are used for two purposes after allocation: They either
> start out all empty, or they get filled to replace a superpage.
> Subsequently, to replace all empty or fully contiguous page tables,
> contiguous sub-regions will be recorded within individual page tables.
> Install the initial set of markers immediately after allocation. Make
> sure to retain these markers when further populating a page table in
> preparation for it to replace a superpage.
> 
> The markers are simply 4-bit fields holding the order value of
> contiguous entries. To demonstrate this, if a page table had just 16
> entries, this would be the initial (fully contiguous) set of markers:
> 
> index  0 1 2 3 4 5 6 7 8 9 A B C D E F
> marker 4 0 1 0 2 0 1 0 3 0 1 0 2 0 1 0
> 
> "Contiguous" here means not only present entries with successively
> increasing MFNs, each one suitably aligned for its slot, but also a
> respective number of all non-present entries.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>, with a nit:

> @@ -478,7 +478,28 @@ struct page_info *iommu_alloc_pgtable(st
>          return NULL;
> 
>      p = __map_domain_page(pg);
> -    clear_page(p);
> +
> +    if ( contig_mask )
> +    {
> +        unsigned int i, shift = find_first_set_bit(contig_mask);
> +
> +        ASSERT(((PAGE_SHIFT - 3) & (contig_mask >> shift)) == PAGE_SHIFT - 
> 3);
> +
> +        p[0] = (PAGE_SHIFT - 3ull) << shift;
> +        p[1] = 0;
> +        p[2] = 1ull << shift;
> +        p[3] = 0;
> +
> +        for ( i = 4; i < PAGE_SIZE / 8; i += 4 )
> +        {
> +            p[i + 0] = (find_first_set_bit(i) + 0ull) << shift;
> +            p[i + 1] = 0;
> +            p[i + 2] = 1ull << shift;
> +            p[i + 3] = 0;
> +        }

some comment similar to what commit msg describes can improve
the readability here.

Thanks
Kevin

 


Rackspace

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