Real time Linux: disable local timer interrupts

前端 未结 1 1510
花落未央
花落未央 2020-12-31 17:18

TL;DR : Using Linux kernel real time with NO_HZ_FULL I need to isolate a process in order to have deterministic results but /proc/interrupts tell m

相关标签:
1条回答
  • 2020-12-31 18:04

    The thing is that a full-tickless CPU (a.k.a. adaptive-ticks, configured with nohz_full=) still receives some ticks.

    Most notably the scheduler requires a timer on an isolated full tickless CPU for updating some state every second or so.

    This is a documented limitation (as of 2019):

    Some process-handling operations still require the occasional scheduling-clock tick. These operations include calculating CPU load, maintaining sched average, computing CFS entity vruntime, computing avenrun, and carrying out load balancing. They are currently accommodated by scheduling-clock tick every second or so. On-going work will eliminate the need even for these infrequent scheduling-clock ticks.

    (source: Documentation/timers/NO_HZ.txt, cf. the LWN article (Nearly) full tickless operation in 3.10 from 2013 for some background)

    A more accurate method to measure the local timer interrupts (LOC row in /proc/interrupts) is to use perf. For example:

    $ perf stat -a -A -e irq_vectors:local_timer_entry ./my_binary
    

    Where my_binary has threads pinned to the isolated CPUs that non-stop utilize the CPU without invoking syscalls - for - say 2 minutes.

    There are other sources of additional local timer ticks (when there is just 1 runnable task).

    For example, the collection of VM stats - by default they are collected each seconds. Thus, I can decrease my LOC interrupts by setting a higher value, e.g.:

    # sysctl vm.stat_interval=60
    

    Another source are periodic checks if the TSC on the different CPUs doesn't drift - you can disable those with the following kernel option:

    tsc=reliable
    

    (Only apply this option if you really know that your TSCs don't drift.)

    You might find other sources by recording traces with ftrace (while your test binary is running).

    Since it came up in the comments: Yes, the SMI is fully transparent to the kernel. It doesn't show up as NMI. You can only detect an SMI indirectly.

    0 讨论(0)
提交回复
热议问题