diff mbox series

[3/3] irq/affinity: Fix a possible breakage

Message ID 20181204155122.6327-4-douliyangs@gmail.com
State Not Applicable
Headers show
Series irq/core: Fix and expand the irq affinity descriptor | expand

Commit Message

Dou Liyang Dec. 4, 2018, 3:51 p.m. UTC
In case of irq_default_affinity != cpu_possible_mask, setting the affinity
for the pre/post vectors to irq_default_affinity is a breakage.

Just set the pre/post vectors to cpu_possible_mask and be done with it.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Dou Liyang <douliyangs@gmail.com>
---
 kernel/irq/affinity.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Thomas Gleixner Dec. 5, 2018, 8:28 a.m. UTC | #1
On Tue, 4 Dec 2018, Dou Liyang wrote:

> In case of irq_default_affinity != cpu_possible_mask, setting the affinity
> for the pre/post vectors to irq_default_affinity is a breakage.

Why so? All interrupts which are not managed get te default affinity
mask. It can be different than cpu_possible_mask, but that's what the admin
has set. The affinity of these non-managed interrupts can still be set via
/proc/... so where is the breakage?

Thanks,

	tglx
Dou Liyang Dec. 11, 2018, 4:27 p.m. UTC | #2
Hi tglx,
on 2018/12/5 16:28, Thomas Gleixner wrote:
> On Tue, 4 Dec 2018, Dou Liyang wrote:
> 
>> In case of irq_default_affinity != cpu_possible_mask, setting the affinity
>> for the pre/post vectors to irq_default_affinity is a breakage.
> 
> Why so? All interrupts which are not managed get te default affinity
> mask. It can be different than cpu_possible_mask, but that's what the admin
> has set. The affinity of these non-managed interrupts can still be set via
> /proc/... so where is the breakage?

I misunderstood it. please ignore this, ;-)

Thanks,
	dou
diff mbox series

Patch

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index d122575ba1b4..aaa1dd82c3df 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -257,7 +257,7 @@  irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
 
 	/* Fill out vectors at the beginning that don't need affinity */
 	for (curvec = 0; curvec < affd->pre_vectors; curvec++)
-		cpumask_copy(&masks[curvec].mask, irq_default_affinity);
+		cpumask_copy(&masks[curvec].mask, cpu_possible_mask);
 	/*
 	 * Spread on present CPUs starting from affd->pre_vectors. If we
 	 * have multiple sets, build each sets affinity mask separately.
@@ -282,12 +282,15 @@  irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
 	}
 
 	/* Fill out vectors at the end that don't need affinity */
-	if (usedvecs >= affvecs)
+	if (usedvecs >= affvecs) {
 		curvec = affd->pre_vectors + affvecs;
-	else
+	} else {
 		curvec = affd->pre_vectors + usedvecs;
+		for (; curvec < affd->pre_vectors + affvecs; curvec++)
+			cpumask_copy(&masks[curvec].mask, irq_default_affinity);
+	}
 	for (; curvec < nvecs; curvec++)
-		cpumask_copy(&masks[curvec].mask, irq_default_affinity);
+		cpumask_copy(&masks[curvec].mask, cpu_possible_mask);
 
 	/*  Setup complementary information */
 	for (i = 0; i < nvecs; i++) {