x86_64: typo in __assign_irq_vector when update pos for vector and offset
PATCH 1/1 x86_64: typo in __assign_irq_vector when update pos for vector and offset
typo with cpu instead of new_cpu when update the pos struct.
arch/x86_64/kernel/io_apic.c +2 -2
@@ -655,8 +655,8 @@ next: goto next;/* Found one! */ for_each_cpu_mask (new_cpu, domain) { - pos[cpu].vector = vector; - pos[cpu].offset = offset; + pos[new_cpu].vector = vector; + pos[new_cpu].offset = offset; }if (old_vector >=0 ) {int old_cpu;
Please use this one
typo with cpu instead of new_cpu
arch/x86_64/kernel/io_apic.c +3 -3
@@ -651,12 +651,12 @@ next:if (vector ==IA32_SYSCALL_VECTOR ) goto next;for_each_cpu_mask (new_cpu, domain) -if (per_cpu (vector_irq, cpu)[vector] !=-1 ) +if (per_cpu (vector_irq, new_cpu)[vector] !=-1 ) goto next;/* Found one! */ for_each_cpu_mask (new_cpu, domain) { - pos[cpu].vector = vector; - pos[cpu].offset = offset; + pos[new_cpu].vector = vector; + pos[new_cpu].offset = offset; }if (old_vector >=0 ) {int old_cpu;
arch/x86_64/kernel/io_apic.c +3 -3
@@ -651,12 +651,12 @@ next:if (vector ==IA32_SYSCALL_VECTOR ) goto next;for_each_cpu_mask (new_cpu, domain) -if (per_cpu (vector_irq, cpu)[vector] !=-1 ) +if (per_cpu (vector_irq, new_cpu)[vector] !=-1 ) goto next;/* Found one! */ for_each_cpu_mask (new_cpu, domain) { - pos[cpu].vector = vector; - pos[cpu].offset = offset; + pos[new_cpu].vector = vector; + pos[new_cpu].offset = offset; }if (old_vector >=0 ) {int old_cpu;
PATCH 1/1 x86_64: typo in __assign_irq_vector when update pos for vector and offset
Please check the patch.
Also I have a question about TARGET_CPUS in io_apic.c.
for a 16 sockets system with 32 non coherent ht chain. and if every chain have 8 irq for devices, the genapic will use physflat. and it should use you new added "different cpu can have same vector for different irq". --- in the i8259.c
but the setup_IOAPIC_irqs and arch_setup_ht_irq and arch_setup_msi_irq is still using TARGET_CPUS ( it is cpumask_of_cpu(0) for physflat), so the assign_irq_vector will not get vector for them, becase cpu 0 does not have that much vector to be alllocated. and later setup_affinity_xxx_irq can not be used because before irq is not there and show on /proc/interrupts.
So I want to
1. for arch_setup_ht_irq and arch_setup_msi_irq, we can use the dev it takes to get bus and use bus->sysdata to get bus->node mapping that is created in fillin_cpumask_to_bus, to get real target_cpus instead of cpu0.
2. for ioapics, may need to add another array, ioapic_node[MAX_IOAPICS], and use ioapic address to get the numa node for it. So later can use it to get real targets cpus when need to use TARGET_CPUS.
Please comments.
Thanks
Yinghai Lu
---------- Forwarded message ----------
From: yhlu <[email protected]>
Date: Oct 15, 2006 12:21 PM
Subject: re: [PATCH] x86_64: typo in __assign_irq_vector when update pos for vector and offset
To: "Eric W. Biederman" <[email protected]>, Andi Kleen <[email protected]>
Cc: linux kernel mailing list <[email protected]>, [email protected]
Please use this one
typo with cpu instead of new_cpu
arch/x86_64/kernel/io_apic.c +3 -3
@@ -651,12 +651,12 @@ next:if (vector ==IA32_SYSCALL_VECTOR ) goto next;for_each_cpu_mask (new_cpu, domain) -if (per_cpu (vector_irq, cpu)[vector] !=-1 ) +if (per_cpu (vector_irq, new_cpu)[vector] !=-1 ) goto next;/* Found one! */ for_each_cpu_mask (new_cpu, domain) { - pos[cpu].vector = vector; - pos[cpu].offset = offset; + pos[new_cpu].vector = vector; + pos[new_cpu].offset = offset; }if (old_vector >=0 ) {int old_cpu;
arch/x86_64/kernel/io_apic.c +3 -3
@@ -651,12 +651,12 @@ next:if (vector ==IA32_SYSCALL_VECTOR ) goto next;for_each_cpu_mask (new_cpu, domain) -if (per_cpu (vector_irq, cpu)[vector] !=-1 ) +if (per_cpu (vector_irq, new_cpu)[vector] !=-1 ) goto next;/* Found one! */ for_each_cpu_mask (new_cpu, domain) { - pos[cpu].vector = vector; - pos[cpu].offset = offset; + pos[new_cpu].vector = vector; + pos[new_cpu].offset = offset; }if (old_vector >=0 ) {int old_cpu;
Quoted 1 line · Yinghai Lu
Please check the patch.
It looks good. I think I was having a bad day when I introduced those thinkos. I'm a bit distracted at the moment so I don't trust myself to forward the patch on. Hopefully later today.
Quoted 7 lines
Also I have a question about
TARGET_CPUSinio_apic.c.for a 16 sockets system with 32 non coherent ht chain. and if every chain have 8 irq for devices, the genapic will use physflat. and it should use you new added "different cpu can have same vector for different irq". --- in the
i8259.c
Quoted 6 lines
but the
setup_IOAPIC_irqsandarch_setup_ht_irqandarch_setup_msi_irqis still usingTARGET_CPUS( it iscpumask_of_cpu(0)for physflat), so theassign_irq_vectorwill not get vector for them, becase cpu 0 does not have that much vector to be alllocated. and latersetup_affinity_xxx_irqcan not be used because before irq is not there and show on/proc/interrupts.
Yep, that is a bug. I hadn't realized real systems that exhausted the number of vectors were quite so close. That totally explains your interest. That is one I/O heavy development system you have YH.
Unless there is a reason not to, TARGET_CPUS should be cpu_online map. I don't know why it is restricted to a single cpu. I'm curious how that would affect the user space irq balancer.
Quoted 5 lines
So I want to
1. forarch_setup_ht_irqandarch_setup_msi_irq, we can use the dev it takes to get bus and usebus->sysdatato getbus->nodemapping that is created infillin_cpumask_to_bus, to get realtarget_cpusinstead of cpu0.
That sounds like a very reasonable approach.
Quoted 4 lines
2. for ioapics, may need to add another array, ioapic_node[MAX_IOAPICS], and use ioapic address to get the numa node for it. So later can use it to get real targets cpus when need to use
TARGET_CPUS.
Yes. Numa affinity for the ioapics seems to make sense. I don't think we can count on looking at the address though? Are your ioapics pci devices? If so that would be the easiest way to deal with this problem.
Quoted 1 line
Please comments.
So far that is the job of the user space irqbalancer, but I don't see why the kernel can't setup some reasonable defaults, if we have all of the information needed.
For 2.6.19 we should be able to get my typos fixed, and probably the default mask increased so that we are given a choice of something other than cpu 0.
Beyond that it is going to take some additional working and thinking and so it probably makes sense to have the code sit in the -mm or Andi's tree for a while, and let it mature for 2.6.20.
Eric
Quoted 7 lines · Eric W. Biederman
For 2.6.19 we should be able to get my typos fixed, and probably the default mask increased so that we are given a choice of something other than cpu 0.
Beyond that it is going to take some additional working and thinking and so it probably makes sense to have the code sit in the -mm or Andi's tree for a while, and let it mature for 2.6.20.
I admit I lost track of the patches for this new code which went in while I was away.
Is that the only patch needed or are there other known problems too?
-Andi
Quoted 5 lines · Andi Kleen
Quoted 4 lines · Eric W. Biederman
For 2.6.19 we should be able to get my typos fixed, and probably the default mask increased so that we are given a choice of something other than cpu 0.
Quoted 8 lines
Quoted 3 lines
Beyond that it is going to take some additional working and thinking and so it probably makes sense to have the code sit in the -mm or Andi's tree for a while, and let it mature for 2.6.20.
I admit I lost track of the patches for this new code which went in while I was away.
Is that the only patch needed or are there other known problems too?
The story.
The code went from -mm to -linus and everything was going smoothly until we found a hyperthreaded cpu that in lowest priority delivery mode would delivery mode would deliver irqs to hyperthreads even if they were not in the mask.
Because of that and because Linus really likes lowest priority delivery mode I submitted a patch that generalized the vector allocator to be able to work on multiple cpus.
The patch was good except I missed one spot in retrigger irqs, that YH caught, and I while the logic was fine in the vector allocator I had several cases of using the wrong variable in the vector allocator.
Grumble! I made the vector allocator too general....
The one thinko that really affects people I fixed. There are two more cases that YH caught this weekend, that are still to be pushed. Plus there is the case that YH just caught that TARGET_CPUS being only a single cpu is a real problem if you have more than 240 distinct irq sources.
So all that is pending are those two thinko fixes from YH. The first that fixes the retrigger irqs is a real bug fix. The second that started this thread is clearly the right thing to do, but I don't think there are actually any real side effects from it.
Given how many thinkos I made last time I attacked this I'm not wanting to do anything until I know I am thinking clearly :)
Eric