mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: Jie Ji <jijie.ji@linux.alibaba.com>,
	dwmw2@infradead.org, joro@8bytes.org, will@kernel.org,
	robin.murphy@arm.com, Kevin Tian <kevin.tian@intel.com>,
	Alex Williamson <alex.williamson@redhat.com>
Cc: baolu.lu@linux.intel.com, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org, xianting.tian@linux.alibaba.com,
	kaijieguo@linux.alibaba.com, daishengdong@yeah.net
Subject: Re: [PATCH] iommu/vt-d: Atomic breakdown of IOPT into finer granularity
Date: Tue, 15 Aug 2023 10:05:58 +0800	[thread overview]
Message-ID: <4b356a28-5637-d492-9540-d7f5e6c617ec@linux.intel.com> (raw)
In-Reply-To: <20230814121016.32613-1-jijie.ji@linux.alibaba.com>

[Please allow me to include Kevin and Alex in this thread.]

On 2023/8/14 20:10, Jie Ji wrote:
> With the addition of IOMMU support for IO page fault, it's now possible
> to unpin the memory which DMA remapping. However, the lack of support
> for unmapping a subrange of the I/O page table (IOPT) in IOMMU can lead
> to some issues.

Is this the right contract about how iommu_map/unmap() should be used?
If I remember it correctly, IOVA ranges should be mapped in pairs. That
means, if a range is mapped by iommu_map(), the same range should be
unmapped with iommu_unmap().

Any misunderstanding or anything changed?

> 
> For instance, a virtual machine can establish IOPT of 2M/1G for better
> performance, while the host system enable swap and attempts to swap out
> some 4K pages. Unfortunately, unmap subrange of the large-page mapping
> will make IOMMU page walk to error level, and finally cause kernel crash.

Sorry that I can't fully understand this use case. Are you talking about
the nested translation where user spaces manage their own IO page
tables? But how can those pages been swapped out?

> This patch support splitting the page table to a finer granularity and
> atomic switch to it when unmap subrange of the large-page mapping. It
> is much better than the unmap then map method to change IOPT, because
> during interval time, all unmapped address space could trigger IO page
> fault, which is unacceptable.
> 
> Signed-off-by: Jie Ji<jijie.ji@linux.alibaba.com>
> Reviewed-by: Kaijie Guo<kaijieguo@linux.alibaba.com>
> ---
>   drivers/iommu/intel/iommu.c | 97 +++++++++++++++++++++++++++++--------
>   drivers/iommu/intel/iommu.h |  1 +
>   2 files changed, 78 insertions(+), 20 deletions(-)

Best regards,
baolu

  parent reply	other threads:[~2023-08-15  2:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14 12:10 Jie Ji
2023-08-14 12:15 ` Xianting Tian
2023-08-15  2:05 ` Baolu Lu [this message]
2023-08-15  3:15   ` Tian, Kevin
     [not found]   ` <BN9PR11MB527619D76C1ACFA5B85E2DEB8C14A@BN9PR11MB5276.namprd11.prod.outlook.com>
2023-08-15  4:00     ` Tian, Kevin
     [not found]       ` <ae72631d-31a4-eba0-b2f3-de4cf6c7d067@linux.alibaba.com>
2023-08-15 11:31         ` Jason Gunthorpe
2023-08-15 14:34 ` Jason Gunthorpe

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=4b356a28-5637-d492-9540-d7f5e6c617ec@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=daishengdong@yeah.net \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=jijie.ji@linux.alibaba.com \
    --cc=joro@8bytes.org \
    --cc=kaijieguo@linux.alibaba.com \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=xianting.tian@linux.alibaba.com \
    /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

all inboxes | Powered by JetHome®