Skip to contentSkip to conversation

iommu/hyper-v: Use helper instead of directly accessing affinity

PATCH Applied Michael Kelley 6 participants 10 messages Jul 26, 2022 – Aug 4, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/hyper-v: Use helper instead of directly accessing affinity

Recent changes to solve inconsistencies in handling IRQ masks #ifdef out the affinity field in irq_common_data for non-SMP configurations. The current code in hyperv_irq_remapping_alloc() gets a compiler error in that case.

Fix this by using the new irq_data_update_affinity() helper, which handles the non-SMP case correctly.

---
 drivers/iommu/hyperv-iommu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iommu/hyperv-iommu.c +1 -3
index 51bd66a..e190bb8 100644
@@ -68,7 +68,6 @@ static int hyperv_irq_remapping_alloc(struct irq_domain *domain,
 {
 	struct irq_alloc_info *info = arg;
 	struct irq_data *irq_data;
-	struct irq_desc *desc;
 	int ret = 0;
 
 	if (!info || info->type != X86_IRQ_ALLOC_TYPE_IOAPIC || nr_irqs > 1)
@@ -90,8 +89,7 @@ static int hyperv_irq_remapping_alloc(struct irq_domain *domain,
 	 * Hypver-V IO APIC irq affinity should be in the scope of
 	 * ioapic_max_cpumask because no irq remapping support.
 	 */
-	desc = irq_data_to_desc(irq_data);
-	cpumask_copy(desc->irq_common_data.affinity, &ioapic_max_cpumask);
+	irq_data_update_affinity(irq_data, &ioapic_max_cpumask);
 
 	return 0;
 }
Signature · 1 line
1.8.3.1
Tested-by Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Michael Kelley

Recent changes to solve inconsistencies in handling IRQ masks #ifdef out the affinity field in irq_common_data for non-SMP configurations. The current code in hyperv_irq_remapping_alloc() gets a compiler error in that case.

Fix this by using the new irq_data_update_affinity() helper, which handles the non-SMP case correctly.

Quoted 1 line

Thanks.

Quoted 26 lines
---
 drivers/iommu/hyperv-iommu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iommu/hyperv-iommu.c +1 -3
index 51bd66a..e190bb8 100644
@@ -68,7 +68,6 @@ static int hyperv_irq_remapping_alloc(struct irq_domain *domain,
 {
 	struct irq_alloc_info *info = arg;
 	struct irq_data *irq_data;
-	struct irq_desc *desc;
 	int ret = 0;
 
 	if (!info || info->type != X86_IRQ_ALLOC_TYPE_IOAPIC || nr_irqs > 1)
@@ -90,8 +89,7 @@ static int hyperv_irq_remapping_alloc(struct irq_domain *domain,
 	 * Hypver-V IO APIC irq affinity should be in the scope of
 	 * ioapic_max_cpumask because no irq remapping support.
 	 */
-	desc = irq_data_to_desc(irq_data);
-	cpumask_copy(desc->irq_common_data.affinity, &ioapic_max_cpumask);
+	irq_data_update_affinity(irq_data, &ioapic_max_cpumask);
 
 	return 0;
 }
Signature · 1 line
~Randy
#2 lore raw

From: Randy Dunlap <[email protected]> Sent: Monday, July 25, 2022 7:39 PM

Quoted 7 lines · Michael Kelley
Quoted 5 lines

Recent changes to solve inconsistencies in handling IRQ masks #ifdef out the affinity field in irq_common_data for non-SMP configurations. The current code in hyperv_irq_remapping_alloc() gets a compiler error in that case.

Quoted 5 lines
Quoted 3 lines

Fix this by using the new irq_data_update_affinity() helper, which handles the non-SMP case correctly.

Indeed. Apologies for omitting this originally.

Quoted 5 lines
Quoted 1 line

Thanks.

This patch needs to go through the same tree as Samuel Holland's earlier patch set to solve inconsistencies in handling IRQ masks on SMP and
non-SMP configs. From what I can tell, that's the irq/irqchip-next tree.

FWIW, it appears there's another occurrence of this same kind of problem in arch/mips/sgi-ip27/ip27-irq.c where the "affinity" field
is referenced without an #ifdef CONFIG_SMP. Copying the MIPS maintainer
and mailing list -- this one is out of my scope to fix.

Michael

Quoted 32 lines

drivers/iommu/hyperv-iommu.c static int hyperv_irq_remapping_alloc(struct irq_domain

Quoted 10 lines
---
 drivers/iommu/hyperv-iommu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iommu/hyperv-iommu.c +0 -0
index 51bd66a..e190bb8 100644
@@ -68,7 +68,6 @@ static int hyperv_irq_remapping_alloc(struct irq_domain

*domain,

drivers/iommu/hyperv-iommu.c static int hyperv_irq_remapping_alloc(struct irq_domain

Quoted 8 lines
drivers/iommu/hyperv-iommu.c +0 -1
 {
 	struct irq_alloc_info *info = arg;
 	struct irq_data *irq_data;
-	struct irq_desc *desc;
 	int ret = 0;
 
 	if (!info || info->type != X86_IRQ_ALLOC_TYPE_IOAPIC || nr_irqs > 1)
@@ -90,8 +89,7 @@ static int hyperv_irq_remapping_alloc(struct irq_domain

*domain,

drivers/iommu/hyperv-iommu.c static int hyperv_irq_remapping_alloc(struct irq_domain *domain, · line 95

Quoted 9 lines
drivers/iommu/hyperv-iommu.c +1 -2
 	 * Hypver-V IO APIC irq affinity should be in the scope of
 	 * ioapic_max_cpumask because no irq remapping support.
 	 */
-	desc = irq_data_to_desc(irq_data);
-	cpumask_copy(desc->irq_common_data.affinity, &ioapic_max_cpumask);
+	irq_data_update_affinity(irq_data, &ioapic_max_cpumask);
 
 	return 0;
 }

--
~Randy

#3 lore raw
In reply to Randy Dunlap

From: Randy Dunlap <[email protected]> Sent: Monday, July 25, 2022 7:39 PM

Quoted 43 lines · Michael Kelley
Quoted 8 lines

Recent changes to solve inconsistencies in handling IRQ masks #ifdef out the affinity field in irq_common_data for non-SMP configurations. The current code in hyperv_irq_remapping_alloc() gets a compiler error in that case.

Fix this by using the new irq_data_update_affinity() helper, which handles the non-SMP case correctly.

Quoted 1 line

Thanks.

drivers/iommu/hyperv-iommu.c static int hyperv_irq_remapping_alloc(struct irq_domain

Quoted 9 lines
---
 drivers/iommu/hyperv-iommu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iommu/hyperv-iommu.c +0 -0
index 51bd66a..e190bb8 100644
@@ -68,7 +68,6 @@ static int hyperv_irq_remapping_alloc(struct irq_domain

*domain,

Quoted 15 lines
drivers/iommu/hyperv-iommu.c +1 -3
 {
 	struct irq_alloc_info *info = arg;
 	struct irq_data *irq_data;
-	struct irq_desc *desc;
 	int ret = 0;
 
 	if (!info || info->type != X86_IRQ_ALLOC_TYPE_IOAPIC || nr_irqs > 1)
@@ -90,8 +89,7 @@ static int hyperv_irq_remapping_alloc(struct irq_domain *domain,
 	 * Hypver-V IO APIC irq affinity should be in the scope of
 	 * ioapic_max_cpumask because no irq remapping support.
 	 */
-	desc = irq_data_to_desc(irq_data);
-	cpumask_copy(desc->irq_common_data.affinity, &ioapic_max_cpumask);
+	irq_data_update_affinity(irq_data, &ioapic_max_cpumask);
 
Quoted 4 lines

drivers/iommu/hyperv-iommu.c static int hyperv_irq_remapping_alloc(struct irq_domain *domain, · line 95

Quoted 2 lines
drivers/iommu/hyperv-iommu.c +0 -0
 	return 0;
 }

--

Marc --

Could you pick up this patch for the 6.0 merge window? It's a fix to a side effect of Samuel Holland's series to unify SMP and UP handling of affinity masks that went through your irq/irqchip-next tree.

Michael

#4 lore raw
Quoted 50 lines · Michael Kelley (LINUX)

From: Randy Dunlap <[email protected]> Sent: Monday, July 25, 2022 7:39 PM

Quoted 43 lines · Michael Kelley
Quoted 8 lines

Recent changes to solve inconsistencies in handling IRQ masks #ifdef out the affinity field in irq_common_data for non-SMP configurations. The current code in hyperv_irq_remapping_alloc() gets a compiler error in that case.

Fix this by using the new irq_data_update_affinity() helper, which handles the non-SMP case correctly.

Quoted 1 line

Thanks.

drivers/iommu/hyperv-iommu.c static int hyperv_irq_remapping_alloc(struct irq_domain

Quoted 9 lines
---
 drivers/iommu/hyperv-iommu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iommu/hyperv-iommu.c +0 -0
index 51bd66a..e190bb8 100644
@@ -68,7 +68,6 @@ static int hyperv_irq_remapping_alloc(struct irq_domain

*domain,

Quoted 15 lines
drivers/iommu/hyperv-iommu.c +1 -3
 {
 	struct irq_alloc_info *info = arg;
 	struct irq_data *irq_data;
-	struct irq_desc *desc;
 	int ret = 0;
 
 	if (!info || info->type != X86_IRQ_ALLOC_TYPE_IOAPIC || nr_irqs > 1)
@@ -90,8 +89,7 @@ static int hyperv_irq_remapping_alloc(struct irq_domain *domain,
 	 * Hypver-V IO APIC irq affinity should be in the scope of
 	 * ioapic_max_cpumask because no irq remapping support.
 	 */
-	desc = irq_data_to_desc(irq_data);
-	cpumask_copy(desc->irq_common_data.affinity, &ioapic_max_cpumask);
+	irq_data_update_affinity(irq_data, &ioapic_max_cpumask);
 
Quoted 4 lines

drivers/iommu/hyperv-iommu.c static int hyperv_irq_remapping_alloc(struct irq_domain *domain, · line 95

Quoted 2 lines
drivers/iommu/hyperv-iommu.c +0 -0
 	return 0;
 }

--

Quoted 5 lines

Marc --

Could you pick up this patch for the 6.0 merge window? It's a fix to a side effect of Samuel Holland's series to unify SMP and UP handling of affinity masks that went through your irq/irqchip-next tree.

Applied with a:

Fixes aa0813581b8d ("genirq: Provide an IRQ affinity mask in non-SMP configs")

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
maintainer Acked-by on v1 1/1
#5 lore raw
In reply to Michael Kelley

Hi Michael,

Quoted 9 lines · Michael Kelley

Recent changes to solve inconsistencies in handling IRQ masks #ifdef out the affinity field in irq_common_data for non-SMP configurations. The current code in hyperv_irq_remapping_alloc() gets a compiler error in that case.

Fix this by using the new irq_data_update_affinity() helper, which handles the non-SMP case correctly.

Please add a fixes tag.

Where is the change which breaks this currently, in some subsystem tree or already upstream?

In case it is still in a maintainers tree, this patch should be applied there. Here is my

for that.

maintainer
#6 lore raw
Quoted 11 lines · Joerg Roedel

Hi Michael,

Quoted 8 lines · Michael Kelley

Recent changes to solve inconsistencies in handling IRQ masks #ifdef out the affinity field in irq_common_data for non-SMP configurations. The current code in hyperv_irq_remapping_alloc() gets a compiler error in that case.

Fix this by using the new irq_data_update_affinity() helper, which handles the non-SMP case correctly.

Quoted 7 lines
Quoted 1 line

Please add a fixes tag.

Where is the change which breaks this currently, in some subsystem tree or already upstream?

The offending patch aa081358 is in linux-next.

Quoted 4 lines

In case it is still in a maintainers tree, this patch should be applied there. Here is my

I can take this patch via hyperv-next. This is a good improvement anyway.

Thanks,
Wei.

Quoted 3 lines

for that.

#7 lore raw

From: Wei Liu <[email protected]> Sent: Tuesday, July 26, 2022 6:09 AM

Quoted 23 lines · Joerg Roedel
Quoted 11 lines

Hi Michael,

Quoted 8 lines · Michael Kelley

Recent changes to solve inconsistencies in handling IRQ masks #ifdef out the affinity field in irq_common_data for non-SMP configurations. The current code in hyperv_irq_remapping_alloc() gets a compiler error in that case.

Fix this by using the new irq_data_update_affinity() helper, which handles the non-SMP case correctly.

Quoted 7 lines
Quoted 1 line

Please add a fixes tag.

Where is the change which breaks this currently, in some subsystem tree or already upstream?

The offending patch aa081358 is in linux-next.

Quoted 7 lines
Quoted 4 lines

In case it is still in a maintainers tree, this patch should be applied there. Here is my

I can take this patch via hyperv-next. This is a good improvement anyway.

I don't think this patch should go via hyperv-next. The helper function is introduced in the linux-next patch in the irq/irqchip-next tree, so this patch should go through irq/irqchip-next to avoid creating an interdependency.

Since the original breaking change is not upstream, do I need
a Fixes: tag? Won't using a linux-next commitID in a Fixes:
tag be confusing? There's nothing to backport to stable.

Michael

maintainer
#8 lore raw
Quoted 29 lines · Michael Kelley (LINUX)

From: Wei Liu <[email protected]> Sent: Tuesday, July 26, 2022 6:09 AM

Quoted 28 lines · Joerg Roedel
Quoted 11 lines

Hi Michael,

Quoted 8 lines · Michael Kelley

Recent changes to solve inconsistencies in handling IRQ masks #ifdef out the affinity field in irq_common_data for non-SMP configurations. The current code in hyperv_irq_remapping_alloc() gets a compiler error in that case.

Fix this by using the new irq_data_update_affinity() helper, which handles the non-SMP case correctly.

Quoted 7 lines
Quoted 1 line

Please add a fixes tag.

Where is the change which breaks this currently, in some subsystem tree or already upstream?

The offending patch aa081358 is in linux-next.

Quoted 4 lines

In case it is still in a maintainers tree, this patch should be applied there. Here is my

Quoted 7 lines
Quoted 2 lines

I can take this patch via hyperv-next. This is a good improvement anyway.

I don't think this patch should go via hyperv-next. The helper function is introduced in the linux-next patch in the irq/irqchip-next tree, so this patch should go through irq/irqchip-next to avoid creating an interdependency.

This is fine too.

Wei.

#9 lore raw
In reply to Michael Kelley
The following commit has been merged into the irq/irqchip-fixes branch of irqchip:

The following commit has been merged into the irq/irqchip-fixes branch of irqchip:

Commit-ID:     b0a4ab7ca4ce993d1cc51cbc85e9f341c729a3d4
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/b0a4ab7ca4ce993d1cc51cbc85e9f341c729a3d4
Author:        Michael Kelley <[email protected]>
AuthorDate:    Mon, 25 Jul 2022 17:53:40 -07:00
Committer:     Marc Zyngier <[email protected]>
CommitterDate: Thu, 04 Aug 2022 10:02:09 +01:00

iommu/hyper-v: Use helper instead of directly accessing affinity

Recent changes to solve inconsistencies in handling IRQ masks #ifdef out the affinity field in irq_common_data for non-SMP configurations. The current code in hyperv_irq_remapping_alloc() gets a compiler error in that case.

Fix this by using the new irq_data_update_affinity() helper, which handles the non-SMP case correctly.

---
 drivers/iommu/hyperv-iommu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iommu/hyperv-iommu.c +1 -3
index 51bd66a..e190bb8 100644
@@ -68,7 +68,6 @@ static int hyperv_irq_remapping_alloc(struct irq_domain *domain,
 {
 	struct irq_alloc_info *info = arg;
 	struct irq_data *irq_data;
-	struct irq_desc *desc;
 	int ret = 0;
 
 	if (!info || info->type != X86_IRQ_ALLOC_TYPE_IOAPIC || nr_irqs > 1)
@@ -90,8 +89,7 @@ static int hyperv_irq_remapping_alloc(struct irq_domain *domain,
 	 * Hypver-V IO APIC irq affinity should be in the scope of
 	 * ioapic_max_cpumask because no irq remapping support.
 	 */
-	desc = irq_data_to_desc(irq_data);
-	cpumask_copy(desc->irq_common_data.affinity, &ioapic_max_cpumask);
+	irq_data_update_affinity(irq_data, &ioapic_max_cpumask);
 
 	return 0;
 }