i386: Per node IDT
Quoted 20 lines · Zwane Mwaikambo
arch/i386/kernel/entry.S +4
-3- +/* Build the IRQ entry stubs */ vector=0 -ENTRY(irq_entries_start) + .align IRQ_STUB_SIZE,0x90 +ENTRY(interrupt) .rept NR_IRQS ALIGN -1: pushl $vector-256 + pushl $vector jmp common_interrupt
arch/i386/kernel/irq.c static union irq_ctx *softirq_ctx[NR_CPU · line 56
Quoted 6 lines
arch/i386/kernel/irq.c +1
-2@@ -53,8 +53,7 @@ static union irq_ctx *softirq_ctx[NR_CPU*/ fastcall unsigned int do_IRQ(struct pt_regs *regs) { -/* high bits used in ret_from_ code */ -int irq = regs->orig_eax &0xff ; +int irq = regs->orig_eax;
Could you explain this change? I think it breaks do_signal/handle_signal, they check orig_eax >= 0 to handle -ERESTARTSYS:
/* Are we from a system call? */
if (regs->orig_eax >= 0) {
/* If so, check system call restarting.. */
switch (regs->eax) {
case -ERESTART_RESTARTBLOCK:
case -ERESTARTNOHAND:Oleg.
Hello Oleg,
Quoted 31 lines · Oleg Nesterov
Quoted 20 lines · Zwane Mwaikambo
arch/i386/kernel/entry.S +4
-3- +/* Build the IRQ entry stubs */ vector=0 -ENTRY(irq_entries_start) + .align IRQ_STUB_SIZE,0x90 +ENTRY(interrupt) .rept NR_IRQS ALIGN -1: pushl $vector-256 + pushl $vector jmp common_interruptarch/i386/kernel/irq.c static union irq_ctx *softirq_ctx[NR_CPU · line 56
Quoted 6 lines
arch/i386/kernel/irq.c +1
-2@@ -53,8 +53,7 @@ static union irq_ctx *softirq_ctx[NR_CPU*/ fastcall unsigned int do_IRQ(struct pt_regs *regs) { -/* high bits used in ret_from_ code */ -int irq = regs->orig_eax &0xff ; +int irq = regs->orig_eax;Could you explain this change? I think it breaks do_signal/handle_signal, they check
orig_eax>= 0 to handle-ERESTARTSYS:
Quoted 6 lines
/* Are we from a system call? */
if (regs->orig_eax >= 0) {
/* If so, check system call restarting.. */
switch (regs->eax) {
case -ERESTART_RESTARTBLOCK:
case -ERESTARTNOHAND:The change is so that we can send IRQs higher than 256 to do_IRQ. That looks like it tries to check if we came in via system_call since we'd save the system call number as orig_eax. Now that i think about it, doesn't that path always get taken when we interrupt userspace and have pending signals on return from interrupt?
Hello Zwane,
Quoted 13 lines · Zwane Mwaikambo
Quoted 6 lines · Oleg Nesterov
Could you explain this change? I think it breaks do_signal/handle_signal, they check
orig_eax>= 0 to handle-ERESTARTSYS:Quoted 6 lines
/* Are we from a system call? */ if (regs->orig_eax >= 0) { /* If so, check system call restarting.. */ switch (regs->eax) { case -ERESTART_RESTARTBLOCK: case -ERESTARTNOHAND:
Quoted 5 lines
The change is so that we can send IRQs higher than 256 to
do_IRQ. That looks like it tries to check if we came in viasystem_callsince we'd save the system call number asorig_eax. Now that i think about it, doesn't that path always get taken when we interrupt userspace and have pending signals on return from interrupt?
As far as I can see, we always have orig_eax < 0 on interrupt, because
irq_entries_start:
pushl $vector-256 <----- orig_eax jmp common_interrupt
and NR_IRQS < 256. So if we have pending signals on return from interrupt, do_signal() will not corrupt userspace registers when regs->eax == -ERESTART... accidentally.
Probably it makes sense to change it to
pushl $vector - 0xFFFF - 1
and in do_IRQ()
int irq = regs->orig_eax & 0xFFFF
if you need to send IRQs higher than 256 to do_IRQ.
Oleg.
Hi Oleg,
Quoted 16 lines · Oleg Nesterov
Quoted 5 lines
The change is so that we can send IRQs higher than 256 to
do_IRQ. That looks like it tries to check if we came in viasystem_callsince we'd save the system call number asorig_eax. Now that i think about it, doesn't that path always get taken when we interrupt userspace and have pending signals on return from interrupt?As far as I can see, we always have
orig_eax< 0 on interrupt, because
irq_entries_start:pushl $vector-256 <----- orig_eax jmp common_interruptand
NR_IRQS< 256. So if we have pending signals on return from interrupt,do_signal()will not corrupt userspace registers whenregs->eax==-ERESTART... accidentally.
Quoted 7 lines
Probably it makes sense to change it to
pushl $vector - 0xFFFF - 1and in
do_IRQ()int irq = regs->orig_eax & 0xFFFFif you need to send IRQs higher than 256 to
do_IRQ.
Good catch, thanks i'll change that!
Zwane
Quoted 4 lines · Oleg Nesterov
Probably it makes sense to change it to
pushl $vector - 0xFFFF - 1
Please note that entry.S:BUILD_INTERRUPT() also does this trick:
pushl $nr-256;
so it should be changed as well.
Oleg.
Quoted 10 lines · Oleg Nesterov
Quoted 4 lines · Oleg Nesterov
Probably it makes sense to change it to
pushl $vector - 0xFFFF - 1Please note that entry.S:BUILD_INTERRUPT() also does this trick:
pushl $nr-256;so it should be changed as well.
I was making these changes and noticed that those were for the various SMP interrupts so they are real vectors. These will always remain within the 256 range.
Zwane
Quoted 11 lines · Zwane Mwaikambo
Quoted 4 lines · Oleg Nesterov
Please note that entry.S:BUILD_INTERRUPT() also does this trick:
pushl $nr-256;so it should be changed as well.
I was making these changes and noticed that those were for the various SMP interrupts so they are real vectors. These will always remain within the 256 range.
Yes, you are right. I suggested it for consistency only. Afaics, none of the smp_xxx_interrupt uses this value, so it it safe to change the pushed number.
But it is very minor issue indeed, and probably you are right not doing so.
Oleg.