mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Magnus Kalland <magnus@dolphinics.com>
To: vasant.hegde@amd.com
Cc: dhsrivas@amd.com, iommu@lists.linux.dev, jonas@dolphinics.com,
	joro@8bytes.org, larsk@dolphinics.com,
	linux-kernel@vger.kernel.org, magnus@dolphinics.com,
	suravee.suthikulpanit@amd.com, torel@simula.no
Subject: Re: [PATCH v3 1/3] iommu/amd: Use raw spinlock for interrupt remapping tables
Date: Tue, 31 Mar 2026 15:10:05 +0200	[thread overview]
Message-ID: <20260331131007.57657-1-magnus@dolphinics.com> (raw)
In-Reply-To: <152a5b57-4956-4f49-85f8-d32ef5f44beb@amd.com>

Hi again Vasant.

Not sure if I understand correctly, but I'll try to answer based on how I
read it.

On Mon, Mar 30, 2026 at 08:53:48PM +0530, Vasant Hegde wrote:
> I spent sometime going through entire flow. I think we can re-arrange code so
> that we can avoid this lock change.
>
> #1 ) alloc_irq_table()
>     Remove iommu_flush_dte() from set_remap_table_entry /
> set_remap_table_entry_alias
>     Once table is updated, at the end of this function we can have a logic to
> flush/completion wait.

The reason we change iommu_table_lock is not just because of the nested raw
spinlocking (holding iommu_table_lock under iommu_lock): it's also because of
the locking context from __setup_irq. Again, see this:
https://lore.kernel.org/linux-iommu/26cfa307-6c33-41f9-a7a0-fbf202b38a00@amd.com/

> #2) iommu_flush_irt_and_complete()
>   This needs to be reworked to match device_flush_dte()
>
> Makes sense? Did I miss anything?

Same here. We cannot rework based on the logic in device_flush_dte using
pci_for_each_dma_alias, so we rely solely on alias_table. But we notice that
device_flush_dte is called without holding iommu_table_lock, so if we can do
the same, then changing the lock type won't be necessary.

Please let me know if there is a misunderstanding somewhere along the way.

Thanks,
Magnus

Signed-off-by: Magnus Kalland <magnus@dolphinics.com>

  reply	other threads:[~2026-03-31 13:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 20:23 [PATCH v3 0/3] iommu/amd: Invalidate IRT cache for DMA aliases Magnus Kalland
2026-02-25 20:23 ` [PATCH v3 1/3] iommu/amd: Use raw spinlock for interrupt remapping tables Magnus Kalland
2026-03-30 15:23   ` Vasant Hegde
2026-03-31 13:10     ` Magnus Kalland [this message]
2026-02-25 20:23 ` [PATCH v3 2/3] iommu/amd: Track PCIe DMA aliases in set_remap_table_entry_alias Magnus Kalland
2026-02-25 20:23 ` [PATCH v3 3/3] iommu/amd: Invalidate IRT cache for DMA aliases Magnus Kalland
2026-03-30 11:18   ` Vasant Hegde
2026-03-31 12:48     ` Magnus Kalland
2026-04-01  7:44       ` Vasant Hegde
2026-04-01 10:34         ` Magnus Kalland
2026-04-01 10:46           ` Vasant Hegde
2026-04-01 11:38             ` Magnus Kalland
2026-03-06  9:22 [PATCH v3 0/3] " Magnus Kalland
2026-03-06  9:22 ` [PATCH v3 1/3] iommu/amd: Use raw spinlock for interrupt remapping tables Magnus Kalland

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=20260331131007.57657-1-magnus@dolphinics.com \
    --to=magnus@dolphinics.com \
    --cc=dhsrivas@amd.com \
    --cc=iommu@lists.linux.dev \
    --cc=jonas@dolphinics.com \
    --cc=joro@8bytes.org \
    --cc=larsk@dolphinics.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=torel@simula.no \
    --cc=vasant.hegde@amd.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®