iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: iommu@lists.linux-foundation.org, Tom Murphy <murphyt7@tcd.ie>
Subject: Re: [Regression] Re: [PATCH 18/18] iommu/vt-d: Remove IOVA handling code from the non-dma_ops path
Date: Fri, 19 Jun 2020 07:38:37 +0800	[thread overview]
Message-ID: <11bea0ec-74cd-a13d-d509-f9cc1cb58508@linux.intel.com> (raw)
In-Reply-To: <20200618090329.2d38f697@w520.home>

Hi Alex,

On 6/18/20 11:03 PM, Alex Williamson wrote:
> On Thu, 18 Jun 2020 09:52:56 +0800
> Lu Baolu <baolu.lu@linux.intel.com> wrote:
> 
>> Hi Alex,
>>
>> Thanks for the report.
>>
>> On 6/18/20 4:06 AM, Alex Williamson wrote:
>>> On Sat, 16 May 2020 14:21:01 +0800
>>> Lu Baolu<baolu.lu@linux.intel.com>  wrote:
>>>    
>>>> From: Tom Murphy<murphyt7@tcd.ie>
>>>>
>>>> There's no need for the non-dma_ops path to keep track of IOVAs. The
>>>> whole point of the non-dma_ops path is that it allows the IOVAs to be
>>>> handled separately. The IOVA handling code removed in this patch is
>>>> pointless.
>>>>
>>>> Signed-off-by: Tom Murphy<murphyt7@tcd.ie>
>>>> Signed-off-by: Lu Baolu<baolu.lu@linux.intel.com>
>>>> ---
>>>>    drivers/iommu/intel-iommu.c | 95 +++++++++++++------------------------
>>>>    1 file changed, 32 insertions(+), 63 deletions(-)
>>> This commit results in a massive increase in memory use from the VT-d
>>> code.  I have a 16GB system where I reserve 7168 2MB hugespages for VM
>>> usage (14GB), leaving the host with 2GB.  I can no longer even boot the
>>> host in this configuration.  Bisecting to this commit, I find that
>>> reverting this change shows the following memory usage difference
>>> immediately after boot (no hugepages, nosmp, single user,
>>> intel_iommu=on iommu=pt):
>>>
>>> @e70b081c6f37:
>>>                total        used        free      shared  buff/cache   available
>>> Mem:       16090860     2219372    13673044        1040      198444    13602664
>>> Swap:       2097148           0     2097148
>>>
>>> reverting e70b081c6f37:
>>>                 total        used        free      shared  buff/cache   available
>>> Mem:       16090852      101648    15789156        1040      200048    15719572
>>> Swap:       2097148           0     2097148
>>>
>>> More than 2GB of additional memory used!  There's also a notable stall
>>> during bootup for this allocation:
>>>
>>> [    9.703360] DMAR: No ATSR found
>>> [    9.709768] DMAR: dmar0: Using Queued invalidation
>>> [    9.719370] DMAR: dmar1: Using Queued invalidation
>>>
>>> ### 4+ seconds! ###
>>>
>>> [   14.076387] pci 0000:00:00.0: Adding to iommu group 0
>>> [   14.086515] pci 0000:00:01.0: Adding to iommu group 1
>>> [   14.096635] pci 0000:00:02.0: Adding to iommu group 2
>>
>> Can you please try below changes?
>>
>> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
>> index 887f184b900d..7eb29167e8f9 100644
>> --- a/drivers/iommu/intel/iommu.c
>> +++ b/drivers/iommu/intel/iommu.c
>> @@ -2705,7 +2705,9 @@ static int __init si_domain_init(int hw)
>>                                       end >> agaw_to_width(si_domain->agaw)))
>>                                   continue;
>>
>> -                       ret = iommu_domain_identity_map(si_domain,
>> start, end);
>> +                       ret = iommu_domain_identity_map(si_domain,
>> +                                       mm_to_dma_pfn(start >> PAGE_SHIFT),
>> +                                       mm_to_dma_pfn(end >> PAGE_SHIFT));
>>                           if (ret)
>>                                   return ret;
>>                   }
> 
> Yes, this resolves it.  Used memory after boot returns to similar
> numbers as without this commit.  Thanks,

Thank you! I've posted the fix patch.

Best regards,
baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-06-18 23:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16  6:20 [PATCH 00/18] [PULL REQUEST] iommu/vt-d: patches for v5.8 Lu Baolu
2020-05-16  6:20 ` [PATCH 01/18] iommu/vt-d: Move domain helper to header Lu Baolu
2020-05-16  6:20 ` [PATCH 02/18] iommu/vt-d: Use a helper function to skip agaw for SL Lu Baolu
2020-05-16  6:20 ` [PATCH 03/18] iommu/vt-d: Add nested translation helper function Lu Baolu
2020-05-16  6:20 ` [PATCH 04/18] iommu/vt-d: Add bind guest PASID support Lu Baolu
2020-05-16  6:20 ` [PATCH 05/18] iommu/vt-d: Support flushing more translation cache types Lu Baolu
2020-05-16  6:20 ` [PATCH 06/18] iommu/vt-d: Add svm/sva invalidate function Lu Baolu
2020-05-16  6:20 ` [PATCH 07/18] iommu/vt-d: Enlightened PASID allocation Lu Baolu
2020-05-16  6:20 ` [PATCH 08/18] iommu/vt-d: Add custom allocator for IOASID Lu Baolu
2020-05-16  6:20 ` [PATCH 09/18] iommu/vt-d: Add get_domain_info() helper Lu Baolu
2020-05-16  6:20 ` [PATCH 10/18] iommu/vt-d: Report SVA feature with generic flag Lu Baolu
2020-05-16  6:20 ` [PATCH 11/18] iommu/vt-d: Replace intel SVM APIs with generic SVA APIs Lu Baolu
2020-05-16  6:20 ` [PATCH 12/18] iommu/vt-d: Multiple descriptors per qi_submit_sync() Lu Baolu
2020-05-16  6:20 ` [PATCH 13/18] iommu/vt-d: debugfs: Add support to show inv queue internals Lu Baolu
2020-05-16  6:20 ` [PATCH 14/18] iommu/vt-d: Disable non-recoverable fault processing before unbind Lu Baolu
2020-05-16  6:20 ` [PATCH 15/18] iommu/vt-d: Add page request draining support Lu Baolu
2020-05-16  6:20 ` [PATCH 16/18] iommu/vt-d: Remove redundant IOTLB flush Lu Baolu
2020-05-16  6:21 ` [PATCH 17/18] iommu/vt-d: Remove duplicated check in intel_svm_bind_mm() Lu Baolu
2020-05-16  6:21 ` [PATCH 18/18] iommu/vt-d: Remove IOVA handling code from the non-dma_ops path Lu Baolu
2020-06-17 20:06   ` [Regression] " Alex Williamson
2020-06-18  1:52     ` Lu Baolu
2020-06-18 15:03       ` Alex Williamson
2020-06-18 23:38         ` Lu Baolu [this message]
2020-05-18 13:38 ` [PATCH 00/18] [PULL REQUEST] iommu/vt-d: patches for v5.8 Joerg Roedel
2020-05-18 18:50 ` Joerg Roedel
2020-05-19  1:46   ` Lu Baolu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11bea0ec-74cd-a13d-d509-f9cc1cb58508@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=murphyt7@tcd.ie \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).