[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>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Fri, 18 Feb 2022 08:26:35 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=l/f5xypZqjw2suVXTiTVySGThvVTUm5eh/LMP1QVt+c=; b=oCMXcXGytK1Q881eNOtXC1gdaat18ltby+j/xN2WyJEQA3iIfuINAbdpMZ9UfyDzPYjfg6JyX0/ZBEGPm4RZbQRZVptjEfScF0OD+v9luUhmjTdnvcr1PqZ3feQC16dS5fVWXVyNPyWvPNrt/vpQh/WVSEl/y4wSluPeBFHH2BlJ/PVFt2GFv5BY/kURXDG1BwwbwavArXy9j8CHpWQS0tfyiXVVla0EeWqOn+Plhy24k75mm0rbWZROWLpnwQE6jChJNnSIKCCVdMmg9S6fi6QgVCG5HWyDO+7NOHKnLrmQcwAtVS/TeEC39L3oZ2vVwQuNvGKVq2zInZbOS9U4BA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k7Ga0UM1ZylmcVtZYWH5ME0FhcyQsYqpYOaYtXqHHA9HfcqCVKZPlBhaCDekbrKVnps7AJjlepJW/wL0yBHOaGgl/pswgwYqOw4XRy21NSExJ1LMiBWCzlz9UD0gpAz6AME5oxrNujMNGs/ZlvKDEcYTuiw1fkU6zNiFshriyvNBbbTQ8LiI7TDUjkJKXwFmNzkuF/AHW4RGFQKXtx6JkfZvYu9hDnzyRhXrmFTnflgciacALwjRyYi3zsrhAEpe8LFPAvtqzQFJs4/zMCB7ihhKkNS4IU3Mp/q3yT7/Bf75fiUT855nNci6CmdztzIU1yGpeYmyH+zIJjCpzWw11A==
  • 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>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 18 Feb 2022 08:27:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYBkAJc6JSR61nEESS/gtIFkcsm6yY/BvAgAA5aYCAAABjEA==
  • Thread-topic: [PATCH v3 17/23] IOMMU/x86: prefill newly allocate page tables

> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Friday, February 18, 2022 4:25 PM
> 
> On 18.02.2022 06:01, Tian, Kevin wrote:
> >> 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:
> 
> Thanks.
> 
> >> @@ -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.
> 
> I wouldn't want to replicate what pt-contig-markers.h describes, so
> maybe a comment referring there would do?
> 

sounds good.

 


Rackspace

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