Re: Patch for faster interrupt handling.

Linus Torvalds (torvalds@transmeta.com)
Tue, 4 Aug 1998 10:50:47 -0700 (PDT)


On Tue, 4 Aug 1998, Andi Kleen wrote:
> It seems to work on my PII/UP. Thank you.
>
> Some more comments after reviewing irq.c:
>
> - The comment in do_IRQ seems to refer to a previous version of the code
> and is confusing.

Noted, removed (apart from the top "generic" comment).

> - do_IRQ itself seems wasteful - it does nothing interesting. How about
> inlining the bottom half check and the interrupt counter increase into
> the low level IRQ handlers? Then common_irq could directly call the low
> level irq vector and some unnecessary code would be saved.

I'd prefer to keep as much in C as humanly possible, unless there is some
really overpowering reason not to.

When it comes to interrupts, there is no really overpowering reason to try
to get rid of the three or so instructions you'd save, and it would be
harder to change. In particular, the bottom half handling _will_ change
some day.

> - In do_8259A_IRQ I think enable_8259A_irq() should be inlined because it
> is so short.

I'll think about it. However, it's certainly large enough that I don't
believe inlining will help noticeably.

> I was also wondering if SAVE_ALL really needs to save all registers, because
> the C functions already save some. Do low level IRQ handlers really look
> at regs?

Yes. The ones that can cause a signal have to, at least. The reason for
saving all registers is not that we have to save them in order to restore
them per se, it's because we need to know where they are when we're at a
higher level. Some things muck around with "struct pt_regs". Not saving a
register means that it doesn't show up in pt_regs.

You can look at how the alpha version does this, by having a separate
"struct pt_regs" and a "struct switch_struct" to save all registers yet
save only a minimal set on kernel entry. It works, and it's more
efficient, but it's more efficient mainly because the alpha has so many
registers. On an x86 it doesn't make sense - we could save maybe two or
three cycles, but it would complicate signal delivery etc unnecessarily.

Again, note that if you really have a case where 5 cycles helps for
interrupt handling, there is something wrong with your machine. Just to
get a feel for this all - just sending the single ACK byte to the
interrupt controller (never mind all the masking etc that we have to do)
takes about a microsecond. In that microsecond you could save about a
hundred registers without breaking into a sweat.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html