Re: SMP irq question

Linus Torvalds (
Sun, 18 May 1997 17:02:32 -0700 (PDT)

On Sun, 18 May 1997, Victor Yodaiken wrote:
> In the following code you ack _after_ clearing the tlb.
> A) Why? On all other interrupts we ack first.

All other interrupts tend to do some real work, and we want to ack as soon
as possible. In contrast, "smp_invalidate_interrupt()" only does about 5
instructions worth of work (ok, I guess it's closer to 10), so whether we
ACK before or after makes no difference.

So no, there is no real reason for this. It doesn't really matter.

> B) How time critical is this event? On the one hand, I don't
> want to hang Linux on the other processors while theRT system
> runs, but on the other hand I don't want to pay the performance
> cost during a rt process .

It's not really time critical in whether it works or not, but this event
is pretty special: it's the _only_ "full synchronization" event in the SMP
code (apart from the bootup code). TLB flushes is the only case where all
CPU's wait for each other.

I have been considering making the invalidate interrupt a NMI, because
that would simplify some of the other stuff. Look at the file
arch/i386/kernel/irq.c, and the "check_smp_invalidate()" stuff in
particular. If we made invalidation a NMI interrupt, the need for
"check_smp_invalidate()" would go away completely.

> C) Am I correct in assuming that the critical material to flush,
> fter bootup, will be in user space.

Most of the time, yes. That is the case you should optimize for, but you
cannot _assume_ it - there are kernel page tables that get updated too by
vmalloc() and friends. Those need to do cross-CPU invalidates as well (it
doesn't happen often, and you may or may not be able to special case