[<prev] [next>] [day] [month] [year] [list]
Message-ID: <5986589C150B2F49A46483AC44C7BCA412D74E@ssvlexmb2.amd.com>
Date: Mon, 23 Oct 2006 14:07:38 -0700
From: "Lu, Yinghai" <yinghai.lu@....com>
To: ebiederm@...ssion.com
cc: "Andi Kleen" <ak@....de>, "Muli Ben-Yehuda" <muli@...ibm.com>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
"Andrew Morton" <akpm@...l.org>, "Adrian Bunk" <bunk@...sta.de>
Subject: RE: [PATCH] x86_64 irq: reuse vector for set_xxx_irq_affinity
in phys flat mode
resend
>From: ebiederm@...ssion.com [mailto:ebiederm@...ssion.com]
>Beyond that I have a few nits to pick with the patch.
>- We duplicate the code that claims a new vector which makes
> maintenance a pain.
>- The comments are specific to phys_flat but the code is not.
>- The test for being able to use the old_vector in the new domain
> should be: ...[old_vector] == vector || ...[old_vector] == -1
Please attached one. This one need Eric's patch about irq global vector.
YH
--- linux-2.6/arch/x86_64/kernel/io_apic_eric.c 2006-10-23
11:56:36.000000000 -0700
+++ linux-2.6/arch/x86_64/kernel/io_apic.c 2006-10-23
13:59:36.000000000 -0700
@@ -613,8 +613,9 @@
* 0x80, because int 0x80 is hm, kind of importantish. ;)
*/
static int current_vector = FIRST_DEVICE_VECTOR, current_offset
= 0;
- int old_vector = -1;
- int cpu;
+ int vector = -1, old_vector = -1;
+ cpumask_t domain, new_mask;
+ int cpu, new_cpu;
BUG_ON((unsigned)irq >= NR_IRQ_VECTORS);
@@ -628,12 +629,30 @@
if (!cpus_empty(*result))
return old_vector;
+ /* try to reuse vector */
+ for_each_cpu_mask(cpu, mask) {
+ int can_resue = 1;
+ domain = vector_allocation_domain(cpu);
+ cpus_and(new_mask, domain, cpu_online_map);
+ for_each_cpu_mask(new_cpu, new_mask) {
+ int old_irq;
+ old_irq = per_cpu(vector_irq,
new_cpu)[old_vector];
+ if ( (old_irq != irq) && (old_irq !=
-1)) {
+ can_resue = 0;
+ break;
+ }
+ }
+
+ if(!can_resue) continue;
+
+ vector = old_vector;
+ goto found_one;
+ }
+
}
for_each_cpu_mask(cpu, mask) {
- cpumask_t domain, new_mask;
- int new_cpu;
- int vector, offset;
+ int offset;
domain = vector_allocation_domain(cpu);
cpus_and(new_mask, domain, cpu_online_map);
@@ -657,21 +676,27 @@
/* Found one! */
current_vector = vector;
current_offset = offset;
- if (old_vector >= 0) {
- cpumask_t old_mask;
- int old_cpu;
- cpus_and(old_mask, irq_domain[irq],
cpu_online_map);
- for_each_cpu_mask(old_cpu, old_mask)
- per_cpu(vector_irq, old_cpu)[old_vector]
= -1;
- }
- for_each_cpu_mask(new_cpu, new_mask)
- per_cpu(vector_irq, new_cpu)[vector] = irq;
- irq_vector[irq] = vector;
- irq_domain[irq] = domain;
- cpus_and(*result, domain, mask);
- return vector;
+
+ goto found_one;
}
+
return -ENOSPC;
+
+found_one:
+ if (old_vector >= 0) {
+ cpumask_t old_mask;
+ int old_cpu;
+ cpus_and(old_mask, irq_domain[irq], cpu_online_map);
+ for_each_cpu_mask(old_cpu, old_mask)
+ per_cpu(vector_irq, old_cpu)[old_vector] = -1;
+ }
+ for_each_cpu_mask(new_cpu, new_mask)
+ per_cpu(vector_irq, new_cpu)[vector] = irq;
+ irq_vector[irq] = vector;
+ irq_domain[irq] = domain;
+ cpus_and(*result, domain, mask);
+ return vector;
+
}
static int assign_irq_vector(int irq, cpumask_t mask, cpumask_t
*result)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists