* [PATCH 0/2] [PULL REQUEST] iommu/vt-d: Fixes for v6.15-rc2
@ 2025-04-10 7:32 Lu Baolu
2025-04-10 7:32 ` [PATCH 1/2] iommu/vt-d: Wire up irq_ack() to irq_move_irq() for posted MSIs Lu Baolu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Lu Baolu @ 2025-04-10 7:32 UTC (permalink / raw)
To: Joerg Roedel; +Cc: Sean Christopherson, Petr Tesarik, iommu, linux-kernel
Hi Joerg,
The following fixes have been queued for v6.15-rc2:
- Fix posted MSI issue when users change cpu affinity
- Remove invalid set_dma_ops() call in the iommu driver
They have been reviewed and are ready for merge. Can you please take
them?
Best regards,
baolu
Petr Tesarik (1):
iommu/vt-d: Remove an unnecessary call set_dma_ops()
Sean Christopherson (1):
iommu/vt-d: Wire up irq_ack() to irq_move_irq() for posted MSIs
drivers/iommu/intel/iommu.c | 1 -
drivers/iommu/intel/irq_remapping.c | 29 +++++++++++++++--------------
2 files changed, 15 insertions(+), 15 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/2] iommu/vt-d: Wire up irq_ack() to irq_move_irq() for posted MSIs 2025-04-10 7:32 [PATCH 0/2] [PULL REQUEST] iommu/vt-d: Fixes for v6.15-rc2 Lu Baolu @ 2025-04-10 7:32 ` Lu Baolu 2025-04-10 7:32 ` [PATCH 2/2] iommu/vt-d: Remove an unnecessary call set_dma_ops() Lu Baolu 2025-04-11 7:06 ` [PATCH 0/2] [PULL REQUEST] iommu/vt-d: Fixes for v6.15-rc2 Joerg Roedel 2 siblings, 0 replies; 4+ messages in thread From: Lu Baolu @ 2025-04-10 7:32 UTC (permalink / raw) To: Joerg Roedel; +Cc: Sean Christopherson, Petr Tesarik, iommu, linux-kernel From: Sean Christopherson <seanjc@google.com> Set the posted MSI irq_chip's irq_ack() hook to irq_move_irq() instead of a dummy/empty callback so that posted MSIs process pending changes to the IRQ's SMP affinity. Failure to honor a pending set-affinity results in userspace being unable to change the effective affinity of the IRQ, as IRQD_SETAFFINITY_PENDING is never cleared and so irq_set_affinity_locked() always defers moving the IRQ. The issue is most easily reproducible by setting /proc/irq/xx/smp_affinity multiple times in quick succession, as only the first update is likely to be handled in process context. Fixes: ed1e48ea4370 ("iommu/vt-d: Enable posted mode for device MSIs") Cc: Robert Lippert <rlippert@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Reported-by: Wentao Yang <wentaoyang@google.com> Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20250321194249.1217961-1-seanjc@google.com Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> --- drivers/iommu/intel/irq_remapping.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c index ea3ca5203919..3bc2a03cceca 100644 --- a/drivers/iommu/intel/irq_remapping.c +++ b/drivers/iommu/intel/irq_remapping.c @@ -1287,43 +1287,44 @@ static struct irq_chip intel_ir_chip = { }; /* - * With posted MSIs, all vectors are multiplexed into a single notification - * vector. Devices MSIs are then dispatched in a demux loop where - * EOIs can be coalesced as well. + * With posted MSIs, the MSI vectors are multiplexed into a single notification + * vector, and only the notification vector is sent to the APIC IRR. Device + * MSIs are then dispatched in a demux loop that harvests the MSIs from the + * CPU's Posted Interrupt Request bitmap. I.e. Posted MSIs never get sent to + * the APIC IRR, and thus do not need an EOI. The notification handler instead + * performs a single EOI after processing the PIR. * - * "INTEL-IR-POST" IRQ chip does not do EOI on ACK, thus the dummy irq_ack() - * function. Instead EOI is performed by the posted interrupt notification - * handler. + * Note! Pending SMP/CPU affinity changes, which are per MSI, must still be + * honored, only the APIC EOI is omitted. * * For the example below, 3 MSIs are coalesced into one CPU notification. Only - * one apic_eoi() is needed. + * one apic_eoi() is needed, but each MSI needs to process pending changes to + * its CPU affinity. * * __sysvec_posted_msi_notification() * irq_enter(); * handle_edge_irq() * irq_chip_ack_parent() - * dummy(); // No EOI + * irq_move_irq(); // No EOI * handle_irq_event() * driver_handler() * handle_edge_irq() * irq_chip_ack_parent() - * dummy(); // No EOI + * irq_move_irq(); // No EOI * handle_irq_event() * driver_handler() * handle_edge_irq() * irq_chip_ack_parent() - * dummy(); // No EOI + * irq_move_irq(); // No EOI * handle_irq_event() * driver_handler() * apic_eoi() * irq_exit() + * */ - -static void dummy_ack(struct irq_data *d) { } - static struct irq_chip intel_ir_chip_post_msi = { .name = "INTEL-IR-POST", - .irq_ack = dummy_ack, + .irq_ack = irq_move_irq, .irq_set_affinity = intel_ir_set_affinity, .irq_compose_msi_msg = intel_ir_compose_msi_msg, .irq_set_vcpu_affinity = intel_ir_set_vcpu_affinity, -- 2.43.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] iommu/vt-d: Remove an unnecessary call set_dma_ops() 2025-04-10 7:32 [PATCH 0/2] [PULL REQUEST] iommu/vt-d: Fixes for v6.15-rc2 Lu Baolu 2025-04-10 7:32 ` [PATCH 1/2] iommu/vt-d: Wire up irq_ack() to irq_move_irq() for posted MSIs Lu Baolu @ 2025-04-10 7:32 ` Lu Baolu 2025-04-11 7:06 ` [PATCH 0/2] [PULL REQUEST] iommu/vt-d: Fixes for v6.15-rc2 Joerg Roedel 2 siblings, 0 replies; 4+ messages in thread From: Lu Baolu @ 2025-04-10 7:32 UTC (permalink / raw) To: Joerg Roedel; +Cc: Sean Christopherson, Petr Tesarik, iommu, linux-kernel From: Petr Tesarik <ptesarik@suse.com> Do not touch per-device DMA ops when the driver has been converted to use the dma-iommu API. Fixes: c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the iommu ops") Signed-off-by: Petr Tesarik <ptesarik@suse.com> Link: https://lore.kernel.org/r/20250403165605.278541-1-ptesarik@suse.com Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> --- drivers/iommu/intel/iommu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 6e67cc66a204..b29da2d96d0b 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -3835,7 +3835,6 @@ static void intel_iommu_release_device(struct device *dev) intel_pasid_free_table(dev); intel_iommu_debugfs_remove_dev(info); kfree(info); - set_dma_ops(dev, NULL); } static void intel_iommu_get_resv_regions(struct device *device, -- 2.43.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] [PULL REQUEST] iommu/vt-d: Fixes for v6.15-rc2 2025-04-10 7:32 [PATCH 0/2] [PULL REQUEST] iommu/vt-d: Fixes for v6.15-rc2 Lu Baolu 2025-04-10 7:32 ` [PATCH 1/2] iommu/vt-d: Wire up irq_ack() to irq_move_irq() for posted MSIs Lu Baolu 2025-04-10 7:32 ` [PATCH 2/2] iommu/vt-d: Remove an unnecessary call set_dma_ops() Lu Baolu @ 2025-04-11 7:06 ` Joerg Roedel 2 siblings, 0 replies; 4+ messages in thread From: Joerg Roedel @ 2025-04-11 7:06 UTC (permalink / raw) To: Lu Baolu; +Cc: Sean Christopherson, Petr Tesarik, iommu, linux-kernel On Thu, Apr 10, 2025 at 03:32:45PM +0800, Lu Baolu wrote: > Petr Tesarik (1): > iommu/vt-d: Remove an unnecessary call set_dma_ops() > > Sean Christopherson (1): > iommu/vt-d: Wire up irq_ack() to irq_move_irq() for posted MSIs > > drivers/iommu/intel/iommu.c | 1 - > drivers/iommu/intel/irq_remapping.c | 29 +++++++++++++++-------------- > 2 files changed, 15 insertions(+), 15 deletions(-) Applied, thanks Baolu. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-11 7:06 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-10 7:32 [PATCH 0/2] [PULL REQUEST] iommu/vt-d: Fixes for v6.15-rc2 Lu Baolu 2025-04-10 7:32 ` [PATCH 1/2] iommu/vt-d: Wire up irq_ack() to irq_move_irq() for posted MSIs Lu Baolu 2025-04-10 7:32 ` [PATCH 2/2] iommu/vt-d: Remove an unnecessary call set_dma_ops() Lu Baolu 2025-04-11 7:06 ` [PATCH 0/2] [PULL REQUEST] iommu/vt-d: Fixes for v6.15-rc2 Joerg Roedel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox