mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vasant Hegde <vasant.hegde@amd.com>
To: Guanghui Feng <guanghuifeng@linux.alibaba.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 2/2] iommu/amd: Reuse device data for IRTE cache invalidation
Date: Mon, 23 Nov 2026 15:05:14 +0530	[thread overview]
Message-ID: <721a92c6-fbf3-4f92-9812-3765dbe4af6a@amd.com> (raw)
In-Reply-To: <20261113095017.1835921-3-guanghuifeng@linux.alibaba.com>



On 11/13/2026 3:20 PM, Guanghui Feng wrote:
> Switching an interrupt route between guest and remapping modes, changing
> IRQ affinity, and enabling or disabling an IRTE all perform a linear
> device lookup to invalidate the IRT cache for DMA aliases.  Nested VM
> entry and exit can repeat this for every posted interrupt route.
> A reported workload with 4334 device entries shows median lookup
> latencies of 22-33 us per invocation.
> 
> Save the allocation-time device data in struct amd_ir_data and thread it
> through all IRTE update paths:
> 
>  - modify_irte_ga() and modify_irte() accept a dev_data parameter and
>    pass it to iommu_flush_irt_and_complete().
> 
>  - The amd_irte_ops callbacks (activate, deactivate, set_affinity) are
>    extended to carry dev_data, so amd_ir_update_irte() and the
>    irq_remapping activate/deactivate chip callbacks pass the cached
>    pointer.
> 
>  - amd_iommu_activate_guest_mode() and deactivate_guest_mode() pass
>    ir_data->dev_data directly.
> 
>  - free_irte() receives dev_data from irq_remapping_free().
> 
>  - amd_ir_set_vcpu_affinity() reuses ir_data->dev_data for the vCPU
>    affinity capability check.
> 
> This eliminates all search_dev_data() list walks from IRTE update
> paths.  For non-PCI interrupt sources (IOAPIC, HPET) whose dev_data is
> NULL from allocation, iommu_flush_irt_and_complete() skips the DMA
> alias walk and invalidates only the single devid, which is correct
> because these sources have no DMA aliases.

In iommu_flush_irt_and_complete() may be fall back to search_dev_data if
dev_data is NULL?


Its fine for set_vcpu_affinity() path as we know it gets called only after probe
is complete.

Otherwise patch look.

-Vasant


      reply	other threads:[~2026-11-23  9:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  9:50 [PATCH 0/2] iommu/amd: Optimize IRT cache invalidation for nested VM workloads 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 [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=721a92c6-fbf3-4f92-9812-3765dbe4af6a@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=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®