From: Alex Williamson <alex@shazbot.org>
To: Wanhui Fu <fuwh1120@163.com>
Cc: tpearson@raptorengineering.com, kvm@vger.kernel.org, alex@shazbot.org
Subject: Re: [PATCH] vfio/spapr: Remove the redundant TCE page containment check
Date: Fri, 4 Dec 2026 10:28:26 -0700 [thread overview]
Message-ID: <20261204102826.6541bfc6@shazbot.org> (raw)
In-Reply-To: <20261204150913.1928978-1-fuwh1120@163.com>
On Fri, 4 Dec 2026 23:09:13 +0800
Wanhui Fu <fuwh1120@163.com> wrote:
> tce_iommu_build() uses a default DMA window with 4 KB TCE pages. A
> successfully pinned system page is at least 4 KB, so the containment
> check always succeeds for system memory. The device memory case requires
> a region registered through mm_iommu_newdev(), which has no in-tree
> callers since the removal of the NVLink2 driver.
>
> Remove the redundant check from tce_iommu_build(). The v2 mapping path
> still needs the check because it supports larger TCE pages.
>
> Found by self-developed static analysis tool and compile-test passed.
>
> Signed-off-by: Wanhui Fu <fuwh1120@163.com>
> ---
> drivers/vfio/vfio_iommu_spapr_tce.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
> index 1c0eec228cc6..ea1509d93005 100644
> --- a/drivers/vfio/vfio_iommu_spapr_tce.c
> +++ b/drivers/vfio/vfio_iommu_spapr_tce.c
> @@ -512,12 +512,6 @@ static long tce_iommu_build(struct tce_container *container,
> if (ret)
> break;
>
> - if (!tce_page_is_contained(container->mm, hpa,
> - tbl->it_page_shift)) {
> - ret = -EPERM;
> - break;
> - }
> -
> hpa |= offset;
> dirtmp = direction;
> ret = iommu_tce_xchg_no_kill(container->mm, tbl, entry + i,
AIUI, this is being positioned as an untested redundancy removal, not a
fix, and with no claims of a performance enhancement, on a driver that
is very nearly dead. I'm inclined not to bother unless someone endorses
this with a practical consideration and testing. Thanks,
Alex
prev parent reply other threads:[~2026-12-04 17:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 15:09 [PATCH] vfio/spapr: Remove the redundant TCE page containment check Wanhui Fu
2026-12-04 17:28 ` Alex Williamson [this message]
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=20261204102826.6541bfc6@shazbot.org \
--to=alex@shazbot.org \
--cc=fuwh1120@163.com \
--cc=kvm@vger.kernel.org \
--cc=tpearson@raptorengineering.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.