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

Re: [PATCH v4 06/21] IOMMU/x86: perform PV Dom0 mappings in batches


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 4 May 2022 16:26:40 +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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MbIRklcKrf6YQ+z2qg+c4tmqOIeHHIcsZmFER4YXlcg=; b=FrMqztCwOiDLdcTQSNvZXKsI9QlpuUkai25KMyVY0Hlp/sgdGnvsjZn4+xRSHupJK6rL44oqErQEYMCjNXMnEN9yGNc8Q900aaSpXmIf6ryARkzMyWrVj/nBTrTB5wa6RUB06IF4ZMIgfppwe06atPFmxyXf/5yFPpwviEIwycg0TsP5QxqBCpFxox7QCJTPHoxAwpdmh8+CDSKBu004gHBVqe5wZpJS9IQpkzCJLTypSeJXlySKfoGLzoXEZtJ4lxvqr8MqCtOHnqm3sOc5WldJ/BZStlXhxObNNHvsaI163lHc4gx7nLPHPfsBY8u5LLJMZWiYxzR2oAloDaJkAg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MZbg0pXAUS068iphzx36b5TTpKKwtNV0+DkblLinVGXsKWAtT5YulH4/JXJatpwkZc905MHDz2fzh4ECktN8ZaIoyTG1Eo0XjOi0sfgSO/gw9+wpz5fus4EzSGHewW9DQAHnVtmr738/h8RBPNvIfKf+GC5vGJ916E1Hbr7q+s+R2zZl7kfZk8NBVwFbWBmbqTnqZ24dTZMaVDBjuLI9nC1naA6iN1j+HJL4AGEhXnLggm+Dmw9zxXZK3IXn+bSHtgEF27fLTYgQm4qLMO/++1BmIyCB1xe486IRHkTb6W6VlbSBCd7N3vJ5ff7N1d7HRxYBDYi/nj1xi9sujqspWA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 04 May 2022 14:26:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 04.05.2022 15:55, Roger Pau Monné wrote:
> On Wed, May 04, 2022 at 02:27:14PM +0200, Jan Beulich wrote:
>> On 04.05.2022 13:20, Roger Pau Monné wrote:
>>> On Wed, May 04, 2022 at 11:46:37AM +0200, Jan Beulich wrote:
>>>> On 03.05.2022 16:49, Roger Pau Monné wrote:
>>>>> On Mon, Apr 25, 2022 at 10:34:59AM +0200, Jan Beulich wrote:
>>>>>> @@ -390,20 +390,41 @@ void __hwdom_init arch_iommu_hwdom_init(
>>>>>>          if ( !perms )
>>>>>>              rc = 0;
>>>>>>          else if ( paging_mode_translate(d) )
>>>>>> +        {
>>>>>>              rc = p2m_add_identity_entry(d, pfn,
>>>>>>                                          perms & IOMMUF_writable ? 
>>>>>> p2m_access_rw
>>>>>>                                                                  : 
>>>>>> p2m_access_r,
>>>>>>                                          0);
>>>>>> +            if ( rc )
>>>>>> +                printk(XENLOG_WARNING
>>>>>> +                       "%pd: identity mapping of %lx failed: %d\n",
>>>>>> +                       d, pfn, rc);
>>>>>> +        }
>>>>>> +        else if ( pfn != start + count || perms != start_perms )
>>>>>> +        {
>>>>>> +        commit:
>>>>>> +            rc = iommu_map(d, _dfn(start), _mfn(start), count, 
>>>>>> start_perms,
>>>>>> +                           &flush_flags);
>>>>>> +            if ( rc )
>>>>>> +                printk(XENLOG_WARNING
>>>>>> +                       "%pd: IOMMU identity mapping of [%lx,%lx) 
>>>>>> failed: %d\n",
>>>>>> +                       d, pfn, pfn + count, rc);
>>>>>> +            SWAP(start, pfn);
>>>>>> +            start_perms = perms;
>>>>>> +            count = 1;
>>>>>> +        }
>>>>>>          else
>>>>>> -            rc = iommu_map(d, _dfn(pfn), _mfn(pfn), 1ul << 
>>>>>> PAGE_ORDER_4K,
>>>>>> -                           perms, &flush_flags);
>>>>>> +        {
>>>>>> +            ++count;
>>>>>> +            rc = 0;
>>>>>
>>>>> Seeing as we want to process this in blocks now, I wonder whether it
>>>>> would make sense to take a different approach, and use a rangeset to
>>>>> track which regions need to be mapped.  What gets added would be based
>>>>> on the host e820 plus the options
>>>>> iommu_hwdom_{strict,inclusive,reserved}.  We would then punch holes
>>>>> based on the logic in hwdom_iommu_map() and finally we could iterate
>>>>> over the regions afterwards using rangeset_consume_ranges().
>>>>>
>>>>> Not that you strictly need to do it here, just think the end result
>>>>> would be clearer.
>>>>
>>>> The end result might indeed be, but it would be more of a change right
>>>> here. Hence I'd prefer to leave that out of the series for now.
>>>
>>> OK.  I think it might be nice to add a comment in that regard, mostly
>>> because I tend to forget myself.
>>
>> Sure, I've added another post-commit-message remark.
> 
> Sorry for being confused, but are those reflected in the final commit
> message, or in the code itself?

Neither - I didn't think we have any code comments anywhere which outline
future plans, including reasons why not doing so right away. When writing
that new remark I didn't even think it would belong in the commit message.

Jan




 


Rackspace

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