x86_64 irq: reuse vector for set_xxx_irq_affinity in phys flat mode
PATCH 1/1 x86_64 irq: reuse vector for set_xxx_irq_affinity in phys flat mode
in phys flat mode, when using set_xxx_irq_affinity to irq balance from one cpu to another, _assign_irq_vector will get to increase last used vector and get new vector. this will use up the vector if enough set_xxx_irq_affintiy are called. and end with using same vector in different cpu for different irq. (that is not what we want, we only want to use same vector in different cpu for different irq when more than 0x240 irq needed). To keep it simple, the vector should be resued from one cpu to another instead of getting new vector.
arch/x86_64/kernel/io_apic.c +21 -0
@@ -624,11 +624,32 @@ static int __assign_irq_vector(int irq,if (irq_vector[irq] >0 ) old_vector = irq_vector[irq];if (old_vector >0 ) { +cpumask_t domain, new_mask, old_mask; +int new_cpu, old_cpu;cpus_and (*result, irq_domain[irq], mask);if (!cpus_empty (*result))return old_vector; + +/* try to reuse vector for phys flat */ + domain =vector_allocation_domain (cpu); +cpus_and (new_mask, domain, cpu_online_map); +for_each_cpu_mask (new_cpu, new_mask) +if (per_cpu (vector_irq, new_cpu)[old_vector] !=-1 ) + goto new_vector; +/* We can reuse it */ +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)[old_vector] = irq; + irq_domain[irq] = domain; +cpus_and (*result, domain, mask); +return old_vector; + } +new_vector: +for_each_cpu_mask (cpu, mask) {cpumask_t domain;int first, new_cpu;
Quoted 10 lines · Yinghai Lu
in phys flat mode, when using
set_xxx_irq_affinityto irq balance from one cpu to another,_assign_irq_vectorwill get to increase last used vector and get new vector. this will use up the vector if enoughset_xxx_irq_affintiyare called. and end with using same vector in different cpu for different irq. (that is not what we want, we only want to use same vector in different cpu for different irq when more than0x240irq needed). To keep it simple, the vector should be resued from one cpu to another instead of getting new vector.Signed-off-by Yinghai Lu <[email protected]>
Should I give this a spin? with or without Eric's two patches?
Cheers,
Muli
Quoted 2 lines · Muli Ben-Yehuda
Should I give this a spin? with or without Eric's two patches?
should be with Eric's patch with cpu_online... consistent.
It should be helpful to phys_flat. and that code should be reached by flat (logical) mode.
YH
Quoted 10 lines · Yinghai Lu
in phys flat mode, when using
set_xxx_irq_affinityto irq balance from one cpu to another,_assign_irq_vectorwill get to increase last used vector and get new vector. this will use up the vector if enoughset_xxx_irq_affintiyare called. and end with using same vector in different cpu for different irq. (that is not what we want, we only want to use same vector in different cpu for different irq when more than0x240irq needed). To keep it simple, the vector should be resued from one cpu to another instead of getting new vector.Signed-off-by Yinghai Lu <[email protected]>
YH. I think the concept is sound. I don't think this is a bug fix, just an optimization so this may not be 2.6.19 material. But we are thrashing things so much it may make sense to include it, and it likely to keeps us from running into problems, so it can be called a bug preventative :)
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
Eric
Quoted 11 lines · Eric W. Biederman
Quoted 9 lines · Yinghai Lu
in phys flat mode, when using
set_xxx_irq_affinityto irq balance from one cpu to another,_assign_irq_vectorwill get to increase last used vector and get new vector. this will use up the vector if enoughset_xxx_irq_affintiyare called. and end with using same vector in different cpu for different irq. (that is not what we want, we only want to use same vector in different cpu for different irq when more than0x240irq needed). To keep it simple, the vector should be resued from one cpu to another instead of getting new vector.
Quoted 7 lines
Quoted 1 line
Signed-off-by Yinghai Lu <[email protected]>YH. I think the concept is sound. I don't think this is a bug fix, just an optimization so this may not be 2.6.19 material. But we are thrashing things so much it may make sense to include it, and it likely to keeps us from running into problems, so it can be called a bug preventative :)
...
Is this patch intended as fix for the 2.6.19-rc regression described in [1]?
Quoted 1 line
Eric
cu
Adrian
[1] http://lkml.org/lkml/2006/10/21/227
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 14 lines · Adrian Bunk
Quoted 13 lines · Eric W. Biederman
Quoted 10 lines · Yinghai Lu
in phys flat mode, when using
set_xxx_irq_affinityto irq balance from one cpu to another,_assign_irq_vectorwill get to increase last used vector and get new vector. this will use up the vector if enoughset_xxx_irq_affintiyare called. and end with using same vector in different cpu for different irq. (that is not what we want, we only want to use same vector in different cpu for different irq when more than0x240irq needed). To keep it simple, the vector should be resued from one cpu to another instead of getting new vector.Signed-off-by Yinghai Lu <[email protected]>
Quoted 8 lines
Quoted 5 lines
YH. I think the concept is sound. I don't think this is a bug fix, just an optimization so this may not be 2.6.19 material. But we are thrashing things so much it may make sense to include it, and it likely to keeps us from running into problems, so it can be called a bug preventative :)
...Is this patch intended as fix for the 2.6.19-rc regression described in [1]?
No, that regression is fixed by the two x86-64 patches Eric sent in
http://marc.theaimsgroup.com/?t=116157840300001&r=1&w=2.
Cheers,
Muli
Quoted 17 lines · Yinghai Lu
in phys flat mode, when using
set_xxx_irq_affinityto irq balance from one cpu to another,_assign_irq_vectorwill get to increase last used vector and get new vector. this will use up the vector if enoughset_xxx_irq_affintiyare called. and end with using same vector in different cpu for different irq. (that is not what we want, we only want to use same vector in different cpu for different irq when more than0x240irq needed). To keep it simple, the vector should be resued from one cpu to another instead of getting new vector.Signed-off-by Yinghai Lu <[email protected]>arch/x86_64/kernel/io_apic.c +0
-0@@ -624,11 +624,32 @@ static int __assign_irq_vector(int irq,if (irq_vector[irq] >0 )
arch/x86_64/kernel/io_apic.c static int __assign_irq_vector(int irq, · line 634
Quoted 10 lines
arch/x86_64/kernel/io_apic.c +5
-0old_vector = irq_vector[irq];if (old_vector >0 ) { +cpumask_t domain, new_mask, old_mask; +int new_cpu, old_cpu;cpus_and (*result, irq_domain[irq], mask);if (!cpus_empty (*result))return old_vector; + +/* try to reuse vector for phys flat */ + domain =vector_allocation_domain (cpu);
cpu is used unitialized here. Please send an updated patch and I'll give it a spin.
Cheers,
Muli