[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: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 18 Feb 2022 09:24:55 +0100
  • 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qpfJ/2lOHie385EtIUECXmt0dCOgdruSpPCiFO+/p2c=; b=Q0F9pkCAuV2z6KL6TIEewGFv8o+PRdojPIICTQzoMweS7ZQJBXv6mBJju+/vAl1Zh+f+OeF67r0Y1UPSfFYatFxl6xX5G5ZNQzu5oTpbzz4xn1uZfaPwemM9lXjJsHgkwKkJ3zbquoOH+AVteqCEvKBGk+PHef690AaHwhfEdnHK1UEdXbPUgenyFw84iodotWREdHmSA5WsX/pR9d7W5TcDS8O0GnSZO01d0/QskG094ujcQctEZAmmcnb3ZoI+X/Bti1wpmFphpVt/hfFcdDDLu5RZq1mdq3BkU5YttrEDZjHVJv3Xer7z8M8UmpwC4l0lZX0yf0fPVe/pTcVXQQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XrshcfwHjzl54bR3UaJI/KjXteN1L7OrXVwZml+glgigsZyoVReMgRxGkbO/+gcQf4hDBfeCXn0EFZbkkZEFaVj2kX7a3r7SVz2Kc5OB8+hXSAhnR4o87jYaZ01nf0u59oeyXUWiCDQ/BhlduAVVS2xNEliDUi6LtRZHJtjZVeeGujkH4iBmtSZKFwyLhIpYZLq41ZE6PFgxlTG/MYeTzOfmPGiTNheZhzX6nPLY103sdGvyyukx+tCWB7+XAXT93jxdsexXpS4/Q4MwdSJcNMzBfC6Wm8xaj3IHQVkBSaalG+h99paXhSTLJUOwvFIQoQWyynykPIIvjKOqC6HAiw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.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:25:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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?

Jan




 


Rackspace

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