What are Linux local timer interrupts?

Everything is in the title. Any links to good documentation are welcome.

+5
source share
4 answers

A local timer interrupt is an APIC implemented timer that interrupts only a specific processor instead of raising an interrupt that can be handled by any CPU. It was discussed in Bovet and Cesati Understanding the Linux Kernel. Excerpt:

The local APIC is present in the latest 80x86 microprocessors (see the “Interrupts and Exceptions” section in Chapter 4) provides another time meter: a local CPU timer.

A local CPU timer is a device similar to a programmable interval The timer just described, which can issue single or periodic interrupts. However, there are several differences:

  • The APICs timer counter is 32 bits long and the PIT timer counter is 16 bits long; therefore, a local timer can be programmed to issue interrupts at very low frequencies (the counter stores the number of ticks that must pass before an interrupt is issued).
  • The local APIC timer sends an interrupt only to its processor, while the PIT causes a global interrupt, which can be processed by any CPU in the system.
  • The APICs timer is based on a bus bus signal (or APIC bus signal, on older machines). It can be programmed to reduce the timer counter every 1, 2, 4, 8, 16, 32, 64 or 128 bus clock signals. Conversely, a PIT that uses its own clock signals can be programmed in a more flexible way.
+7
source

Less technical answer than Michael Burr:

Some things need to be done every time, no matter what CPU.
Other things must be done every time on each processor. For example, check if we need to switch to another process.

The interruption of the local timer exists for the second type - whenever it is executed, we check them and do what is needed.

+5
source

I believe that local timers are used to handle IPI related functions. Perhaps I am mistaken in this assumption, you need to look at the code for what they are configured for and what the handler contains. But I feel that the system timer and jiffies are associated with one of the GP timers and, therefore, in SMP ARM, for example, interruption from this timer is connected with one core through registering GIC affinity. Will return more wit on local timers.

0
source

In SMP systems, apic timer is used for scheduler / migration threads.

In UP mode, a timer timer is used for scheduler / reschedule threads.

As a rule, PIT is no longer used in SMP systems.

0
source

Source: https://habr.com/ru/post/952338/


All Articles