From: Vasant Hegde <vasant.hegde@amd.com>
To: "guanghuifeng@linux.alibaba.com" <guanghuifeng@linux.alibaba.com>,
Sairaj Kodilkar <sarunkod@amd.com>,
joro@8bytes.org, suravee.suthikulpanit@amd.com, will@kernel.org,
robin.murphy@arm.com
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] iommu/amd: Optimize IRT cache invalidation for nested VM workloads
Date: Wed, 2 Dec 2026 15:07:18 +0530 [thread overview]
Message-ID: <8215c30b-446b-4eca-9d0e-a0844defd669@amd.com> (raw)
In-Reply-To: <3cab44e0-feff-45b4-8565-32e25dbc0da2@linux.alibaba.com>
On 12/2/2026 8:01 AM, guanghuifeng@linux.alibaba.com wrote:
> Hi Sairaj
>
> Thanks a lot for running the tests and for the Tested-by.
>
> Your numbers actually point at an important detail: the flush path
> taking 172546 ns *including the COMPLETION_WAIT* means IRT caching
> was ENABLED in this run (amd_iommu=irtcachedis not set). In that
> configuration iommu_flush_irt_and_complete() still issues
> INVALIDATE_INTERRUPT_TABLE + COMPLETION_WAIT, so the lookup is indeed
> a tiny fraction -- and this patch deliberately keeps that behaviour
> byte-for-byte identical, it only drops the redundant list walk.
>
> The primary target of this patch is the *cache-disabled*
> configuration (amd_iommu=irtcachedis). There, the function returns
> early:
>
> if (iommu->irtcachedis_enabled)
> return;
>
> so no command and no COMPLETION_WAIT are issued at all, and the
> search_dev_data() walk becomes the *only* remaining cost of the
> whole function. On the reported system the dev_data list has grown
> to 4334 entries, making that walk 22-33 us of pure waste on every
> nested VMRUN/#VMEXIT that toggles AVIC. This patch removes 100% of
> it, not 0.2%.
>
> So both measurements are correct and consistent -- they are two
> points on the same O(N) curve:
>
> - your setup: short list (~tens of entries) -> 373 ns
> - reported setup: 4334 entries -> 22-33 us
>
> The list is append-only (alloc_dev_data() only does llist_add(),
> there is no llist_del()/kfree() in the driver, and dev_data is kept
> across unplug on purpose), so its length grows monotonically with
> SR-IOV VF churn and hotplug.
Suravee's hw-viommu series enhances dev_data tracking. It will be moved to
xa_array instead of llist and we will add remove device support as well.
Having said that this patch is the right fix. Thanks for tracking it down and
fixing it. I will pick your v2.
-Vasant
prev parent reply other threads:[~2026-12-02 9:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 9:50 Guanghui Feng
2026-11-13 9:50 ` [PATCH 1/2] iommu/amd: Skip device lookup when IRT caching is disabled Guanghui Feng
2026-11-23 9:18 ` Vasant Hegde
2026-11-13 9:50 ` [PATCH 2/2] iommu/amd: Reuse device data for IRTE cache invalidation Guanghui Feng
2026-11-23 9:35 ` Vasant Hegde
2026-11-24 12:15 ` [PATCH v2] " Guanghui Feng
2026-11-27 6:16 ` Sairaj Kodilkar
2026-12-02 9:41 ` Vasant Hegde
2026-11-25 5:34 ` [PATCH 0/2] iommu/amd: Optimize IRT cache invalidation for nested VM workloads Sairaj Kodilkar
2026-12-02 2:31 ` guanghuifeng
2026-12-02 5:22 ` Sairaj Kodilkar
2026-12-02 9:37 ` Vasant Hegde [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=8215c30b-446b-4eca-9d0e-a0844defd669@amd.com \
--to=vasant.hegde@amd.com \
--cc=guanghuifeng@linux.alibaba.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=sarunkod@amd.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=will@kernel.org \
/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®