Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 15: Time Management


idle time,tick_sched->tick_stoppedis set to 0 because the tick is now active again. Finally, the next
tick event needs to be programmed. This is necessary because the idle time might have ended before the
expected time because of an external interrupt.

15.6 Broadcast Mode


On some architectures, clock event devices will go to sleep when certain power-saving modes are
active. Thankfully, systems do not have only a single clock event device, so another device that
still works can replace the stopped devices. The global variabletick_broadcast_devicedefined in
kernel/tick/tick-broadcast.ccontains thetick_deviceinstance for the broadcast device.

An overview of broadcast mode is given in Figure 15-21.

CPU 0 CPU 1 CPU 2 CPU 3

LAPIC

broadcast

LAPIC LAPIC LAPIC

tick_handle_periodic_broadcast

tick_do_broadcast
event_handler

HPET

IPI

IPI

non-functional

(^111) apic_timer
interrupt
Figure 15-21: Overview of the situation when broadcasting replaces
nonfunctional tick devices.
The APIC devices are not functional, butthe broadcast event device still is.tick_handleperiodic
broadcastis used as the event handler. It deals with both periodic and one-shot modes of the broadcast
device, so this need not concern us any further. The handler will be activated after eachtick_period.
The broadcast handler usestick_do_periodic_broadcast. The code flow diagram is shown in
Figure 15-22. The function invokes theevent_handlermethod of the nonfunctional device on the
current CPU. The handler cannot distinguish if it was invoked from a clock interrupt or from the
broadcast device, and is thus executed as if the underlying event device were functional.
If there are more nonfunctional local tick devices, thentick_do_broadcastemploys thebroadcast
method of the first device in the list.^21 For local APICs, the broadcast method islapic_timer_broadcast.
It is responsible to send the inter-processor interrupt (IPI)LOCAL_TIMER_VECTORto all CPUs that
are associated with nonfunctional tick devices. The vector has been set up by the kernel to call
(^21) This is possible because at the moment the same broadcast handler is installed on all devices that can become nonfunctional.

Free download pdf