x86/ipipe: reserve irq num we use for IRQ_MOVE_CLEANUP_VECTOR
PATCH 1/1 x86/ipipe: reserve irq num we use for IRQ_MOVE_CLEANUP_VECTOR
vector_irq must not contain the same irq number for two different vectors because ipipe dispatches based on irq numbers.
For the special case of IRQ_MOVE_CLEANUP_VECTOR, the ipipe patch inserts a new entry in vector_irq. To ensure the required uniqueness we have to make sure Linux will never make a vector point to irq number IRQ_MOVE_CLEANUP_VECTOR.
Before that patch ipipe did dispatch device interrupts that happened to receive number 32 (IRQ_MOVE_CLEANUP_VECTOR) to the cleanup function, the device effectively lost its interrupts. Up to 3.18 that was no problem since the allocator did not hand out the number ipipe failed to reserve.
--- arch/x86/kernel/irqinit.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kernel/irqinit.c +3 -0
@@ -143,9 +143,12 @@ static void __init smp_intr_init(void)/* Low priority IPI to cleanup after moving an irq */ set_intr_gate (IRQ_MOVE_CLEANUP_VECTOR , irq_move_cleanup_interrupt);set_bit (IRQ_MOVE_CLEANUP_VECTOR , used_vectors); +#ifdef CONFIG_IPIPE +BUG_ON (IRQ_MOVE_CLEANUP_VECTOR !=irq_alloc_descs (IRQ_MOVE_CLEANUP_VECTOR ,0 ,1 ,0 ));for_each_possible_cpu (cpu)per_cpu (vector_irq, cpu)[IRQ_MOVE_CLEANUP_VECTOR ] =IRQ_MOVE_CLEANUP_VECTOR ; +#endif /* IPI used for rebooting/stopping */ alloc_intr_gate (REBOOT_VECTOR , reboot_interrupt);
Signature · 1 line
2.4.6
Quoted 22 lines · Henning Schild
vector_irqmust not contain the same irq number for two different vectors because ipipe dispatches based on irq numbers.
For the special case ofIRQ_MOVE_CLEANUP_VECTOR, the ipipe patch inserts a new entry invector_irq. To ensure the required uniqueness we have to make sure Linux will never make a vector point to irq numberIRQ_MOVE_CLEANUP_VECTOR.Before that patch ipipe did dispatch device interrupts that happened to receive number 32 (
IRQ_MOVE_CLEANUP_VECTOR) to the cleanup function, the device effectively lost its interrupts. Up to 3.18 that was no problem since the allocator did not hand out the number ipipe failed to reserve.Signed-off-by Henning Schild <[email protected]>--- arch/x86/kernel/irqinit.c | 3 +++ 1 file changed, 3 insertions(+)arch/x86/kernel/irqinit.c +0
-0
arch/x86/kernel/irqinit.c static void __init smp_intr_init(void) · line 151
Quoted 9 lines
arch/x86/kernel/irqinit.c +3
-0@@ -143,9 +143,12 @@ static void __init smp_intr_init(void)/* Low priority IPI to cleanup after moving an irq */ set_intr_gate (IRQ_MOVE_CLEANUP_VECTOR , irq_move_cleanup_interrupt);set_bit (IRQ_MOVE_CLEANUP_VECTOR , used_vectors); +#ifdef CONFIG_IPIPE +BUG_ON (IRQ_MOVE_CLEANUP_VECTOR !=irq_alloc_descs (IRQ_MOVE_CLEANUP_VECTOR ,0 ,1 ,0 ));for_each_possible_cpu (cpu)per_cpu (vector_irq, cpu)[IRQ_MOVE_CLEANUP_VECTOR ] =IRQ_MOVE_CLEANUP_VECTOR ; +#endif
Looks like you picked up the instrumentation hunk instead of the actual fix. ;)
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Quoted 28 lines · On Wed, 26 Aug 2015 20:32:57 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 27 lines · Henning Schild
vector_irqmust not contain the same irq number for two different vectors because ipipe dispatches based on irq numbers. For the special case ofIRQ_MOVE_CLEANUP_VECTOR, the ipipe patch inserts a new entry invector_irq. To ensure the required uniqueness we have to make sure Linux will never make a vector point to irq numberIRQ_MOVE_CLEANUP_VECTOR.Before that patch ipipe did dispatch device interrupts that happened to receive number 32 (
IRQ_MOVE_CLEANUP_VECTOR) to the cleanup function, the device effectively lost its interrupts. Up to 3.18 that was no problem since the allocator did not hand out the number ipipe failed to reserve.Signed-off-by Henning Schild <[email protected]>--- arch/x86/kernel/irqinit.c | 3 +++ 1 file changed, 3 insertions(+)arch/x86/kernel/irqinit.c +0
-0@@ -143,9 +143,12 @@ static void __init smp_intr_init(void)/* Low priority IPI to cleanup after moving an irq */ set_intr_gate (IRQ_MOVE_CLEANUP_VECTOR , irq_move_cleanup_interrupt); set_bit(IRQ_MOVE_CLEANUP_VECTOR,
used_vectors); +#ifdefCONFIG_IPIPE
Quoted 8 lines
Quoted 5 lines
arch/x86/kernel/irqinit.c +1
-0+ BUG_ON(IRQ_MOVE_CLEANUP_VECTOR !=
irq_alloc_descs(IRQ_MOVE_CLEANUP_VECTOR, 0, 1, 0));for_each_possible_cpu(cpu)per_cpu(vector_irq, cpu)[IRQ_MOVE_CLEANUP_VECTOR] =IRQ_MOVE_CLEANUP_VECTOR; +#endifLooks like you picked up the instrumentation hunk instead of the actual fix. ;)
Does it? No that is the fix. Alloc the irq number before using it and BUG if that fails.
Henning
Quoted 40 lines · Henning Schild
Quoted 28 lines · On Wed, 26 Aug 2015 20:32:57 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 27 lines · Henning Schild
vector_irqmust not contain the same irq number for two different vectors because ipipe dispatches based on irq numbers. For the special case ofIRQ_MOVE_CLEANUP_VECTOR, the ipipe patch inserts a new entry invector_irq. To ensure the required uniqueness we have to make sure Linux will never make a vector point to irq numberIRQ_MOVE_CLEANUP_VECTOR.Before that patch ipipe did dispatch device interrupts that happened to receive number 32 (
IRQ_MOVE_CLEANUP_VECTOR) to the cleanup function, the device effectively lost its interrupts. Up to 3.18 that was no problem since the allocator did not hand out the number ipipe failed to reserve.Signed-off-by Henning Schild <[email protected]>--- arch/x86/kernel/irqinit.c | 3 +++ 1 file changed, 3 insertions(+)arch/x86/kernel/irqinit.c +0
-0@@ -143,9 +143,12 @@ static void __init smp_intr_init(void)/* Low priority IPI to cleanup after moving an irq */ set_intr_gate (IRQ_MOVE_CLEANUP_VECTOR , irq_move_cleanup_interrupt); set_bit(IRQ_MOVE_CLEANUP_VECTOR,
used_vectors); +#ifdefCONFIG_IPIPEQuoted 8 lines
Quoted 5 lines
arch/x86/kernel/irqinit.c +1
-0+ BUG_ON(IRQ_MOVE_CLEANUP_VECTOR !=
irq_alloc_descs(IRQ_MOVE_CLEANUP_VECTOR, 0, 1, 0));for_each_possible_cpu(cpu)per_cpu(vector_irq, cpu)[IRQ_MOVE_CLEANUP_VECTOR] =IRQ_MOVE_CLEANUP_VECTOR; +#endifLooks like you picked up the instrumentation hunk instead of the actual fix. ;)
Quoted 2 lines
Does it? No that is the fix. Alloc the irq number before using it and BUG if that fails.
BUG is like an assert: disabling CONFIG_BUG should not change the behaviour.
Signature · 2 lines
Gilles. https://click-hack.org
Quoted 41 lines · Gilles Chanteperdrix
Quoted 40 lines · Henning Schild
Quoted 36 lines · On Wed, 26 Aug 2015 20:32:57 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 28 lines · Henning Schild
vector_irqmust not contain the same irq number for two different vectors because ipipe dispatches based on irq numbers. For the special case ofIRQ_MOVE_CLEANUP_VECTOR, the ipipe patch inserts a new entry invector_irq. To ensure the required uniqueness we have to make sure Linux will never make a vector point to irq numberIRQ_MOVE_CLEANUP_VECTOR.Before that patch ipipe did dispatch device interrupts that happened to receive number 32 (
IRQ_MOVE_CLEANUP_VECTOR) to the cleanup function, the device effectively lost its interrupts. Up to 3.18 that was no problem since the allocator did not hand out the number ipipe failed to reserve.Signed-off-by Henning Schild <[email protected]>--- arch/x86/kernel/irqinit.c | 3 +++ 1 file changed, 3 insertions(+)arch/x86/kernel/irqinit.c +0
-0@@ -143,9 +143,12 @@ static void __init smp_intr_init(void)/* Low priority IPI to cleanup after moving an irq */ set_intr_gate (IRQ_MOVE_CLEANUP_VECTOR , irq_move_cleanup_interrupt); set_bit(IRQ_MOVE_CLEANUP_VECTOR,
used_vectors); +#ifdefCONFIG_IPIPEarch/x86/kernel/irqinit.c +1
-0+ BUG_ON(IRQ_MOVE_CLEANUP_VECTOR !=Quoted 4 lines
irq_alloc_descs(IRQ_MOVE_CLEANUP_VECTOR, 0, 1, 0));for_each_possible_cpu(cpu)per_cpu(vector_irq, cpu)[IRQ_MOVE_CLEANUP_VECTOR] =IRQ_MOVE_CLEANUP_VECTOR; +#endifLooks like you picked up the instrumentation hunk instead of the actual fix. ;)
Quoted 5 lines
Quoted 2 lines
Does it? No that is the fix. Alloc the irq number before using it and BUG if that fails.
BUG is like an assert: disabling
CONFIG_BUGshould not change the behaviour.
Right. I actually ignored the BUG_ON while looking at the patch and, thus, missed the allocation. Don't put anything with side effects into such checks.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
PATCH v2 1/1 x86/ipipe: reserve irq num we use for IRQ_MOVE_CLEANUP_VECTOR
In reply to Gilles Chanteperdrixvector_irq must not contain the same irq number for two different vectors because ipipe dispatches based on irq numbers.
For the special case of IRQ_MOVE_CLEANUP_VECTOR, the ipipe patch inserts a new entry in vector_irq. To ensure the required uniqueness we have to make sure Linux will never make a vector point to irq number IRQ_MOVE_CLEANUP_VECTOR.
Before that patch ipipe did dispatch device interrupts that happened to receive number 32 (IRQ_MOVE_CLEANUP_VECTOR) to the cleanup function, the device effectively lost its interrupts. Up to 3.18 that was no problem since the allocator did not hand out the number ipipe failed to reserve.
--- arch/x86/kernel/irqinit.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/kernel/irqinit.c +5 -0
@@ -126,6 +126,7 @@ static void __init smp_intr_init(void)#ifdef CONFIG_SMP #if defined(CONFIG_X86_64 ) || defined(CONFIG_X86_LOCAL_APIC )unsigned cpu; +int ret;/* * The reschedule interrupt is a CPU-to-CPU reschedule-helper
@@ -143,9 +144,13 @@ static void __init smp_intr_init(void)/* Low priority IPI to cleanup after moving an irq */ set_intr_gate (IRQ_MOVE_CLEANUP_VECTOR , irq_move_cleanup_interrupt);set_bit (IRQ_MOVE_CLEANUP_VECTOR , used_vectors); +#ifdef CONFIG_IPIPE + ret =irq_alloc_descs (IRQ_MOVE_CLEANUP_VECTOR ,0 ,1 ,0 ); +BUG_ON (IRQ_MOVE_CLEANUP_VECTOR != ret);for_each_possible_cpu (cpu)per_cpu (vector_irq, cpu)[IRQ_MOVE_CLEANUP_VECTOR ] =IRQ_MOVE_CLEANUP_VECTOR ; +#endif /* IPI used for rebooting/stopping */ alloc_intr_gate (REBOOT_VECTOR , reboot_interrupt);
Signature · 1 line
2.4.6
Quoted 22 lines · Henning Schild
vector_irqmust not contain the same irq number for two different vectors because ipipe dispatches based on irq numbers.
For the special case ofIRQ_MOVE_CLEANUP_VECTOR, the ipipe patch inserts a new entry invector_irq. To ensure the required uniqueness we have to make sure Linux will never make a vector point to irq numberIRQ_MOVE_CLEANUP_VECTOR.Before that patch ipipe did dispatch device interrupts that happened to receive number 32 (
IRQ_MOVE_CLEANUP_VECTOR) to the cleanup function, the device effectively lost its interrupts. Up to 3.18 that was no problem since the allocator did not hand out the number ipipe failed to reserve.Signed-off-by Henning Schild <[email protected]>--- arch/x86/kernel/irqinit.c | 5 +++++ 1 file changed, 5 insertions(+)arch/x86/kernel/irqinit.c +0
-0
arch/x86/kernel/irqinit.c static void __init smp_intr_init(void) · line 129
Quoted 4 lines
arch/x86/kernel/irqinit.c +1
-0@@ -126,6 +126,7 @@ static void __init smp_intr_init(void)#ifdef CONFIG_SMP #if defined(CONFIG_X86_64 ) || defined(CONFIG_X86_LOCAL_APIC )unsigned cpu; +int ret;
__maybe_unused, or you'll get warnings when either IPIPE or BUG is disabled.
Jan
Quoted 18 lines
arch/x86/kernel/irqinit.c +4
-0/* * The reschedule interrupt is a CPU-to-CPU reschedule-helper @@ -143,9 +144,13 @@ static void __init smp_intr_init(void)/* Low priority IPI to cleanup after moving an irq */ set_intr_gate (IRQ_MOVE_CLEANUP_VECTOR , irq_move_cleanup_interrupt);set_bit (IRQ_MOVE_CLEANUP_VECTOR , used_vectors); +#ifdef CONFIG_IPIPE + ret =irq_alloc_descs (IRQ_MOVE_CLEANUP_VECTOR ,0 ,1 ,0 ); +BUG_ON (IRQ_MOVE_CLEANUP_VECTOR != ret);for_each_possible_cpu (cpu)per_cpu (vector_irq, cpu)[IRQ_MOVE_CLEANUP_VECTOR ] =IRQ_MOVE_CLEANUP_VECTOR ; +#endif /* IPI used for rebooting/stopping */ alloc_intr_gate (REBOOT_VECTOR , reboot_interrupt);
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
PATCH v3 1/1 x86/ipipe: reserve irq num we use for IRQ_MOVE_CLEANUP_VECTOR
vector_irq must not contain the same irq number for two different vectors because ipipe dispatches based on irq numbers.
For the special case of IRQ_MOVE_CLEANUP_VECTOR, the ipipe patch inserts a new entry in vector_irq. To ensure the required uniqueness we have to make sure Linux will never make a vector point to irq number IRQ_MOVE_CLEANUP_VECTOR.
Before that patch ipipe did dispatch device interrupts that happened to receive number 32 (IRQ_MOVE_CLEANUP_VECTOR) to the cleanup function, the device effectively lost its interrupts. Up to 3.18 that was no problem since the allocator did not hand out the number ipipe failed to reserve.
--- arch/x86/kernel/irqinit.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kernel/irqinit.c +6 -1
@@ -125,7 +125,8 @@ static void __init smp_intr_init(void) {#ifdef CONFIG_SMP #if defined(CONFIG_X86_64 ) || defined(CONFIG_X86_LOCAL_APIC ) -unsigned cpu; +unsigned __maybe_unused cpu; +int __maybe_unused ret;/* * The reschedule interrupt is a CPU-to-CPU reschedule-helper
@@ -143,9 +144,13 @@ static void __init smp_intr_init(void)/* Low priority IPI to cleanup after moving an irq */ set_intr_gate (IRQ_MOVE_CLEANUP_VECTOR , irq_move_cleanup_interrupt);set_bit (IRQ_MOVE_CLEANUP_VECTOR , used_vectors); +#ifdef CONFIG_IPIPE + ret =irq_alloc_descs (IRQ_MOVE_CLEANUP_VECTOR ,0 ,1 ,0 ); +BUG_ON (IRQ_MOVE_CLEANUP_VECTOR != ret);for_each_possible_cpu (cpu)per_cpu (vector_irq, cpu)[IRQ_MOVE_CLEANUP_VECTOR ] =IRQ_MOVE_CLEANUP_VECTOR ; +#endif /* IPI used for rebooting/stopping */ alloc_intr_gate (REBOOT_VECTOR , reboot_interrupt);
Signature · 1 line
2.4.6