在Linux内核上禁用计时器中断

问题描述 投票:2回答:1

我想在机器上的某些内核(1-2)上禁用计时器中断,这是运行带有rt补丁的x86 centos 7的x86,两个内核都是具有nohz_full的独立内核,(您可以看到cmdline)但是计时器中断继续中断在core1和core2上运行的实时进程。

1. uname -r
3.10.0-693.11.1.rt56.632.el7.x86_64

2. cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.10.0-693.11.1.rt56.632.el7.x86_64 \
   root=/dev/mapper/centos-root ro crashkernel=auto \
   rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet \ 
   default_hugepagesz=2M hugepagesz=2M hugepages=1024 \
   intel_iommu=on isolcpus=1-2 irqaffinity=0 intel_idle.max_cstate=0 \
   processor.max_cstate=0 idle=mwait tsc=perfect rcu_nocbs=1-2 rcu_nocb_poll \
   nohz_full=1-2 nmi_watchdog=0

 3. cat /proc/interrupts
           CPU0       CPU1       CPU2
  0:         29          0          0   IO-APIC-edge      timer
.....
......

NMI:          0          0          0   Non-maskable interrupts
LOC:  835205157  308723100  308384525   Local timer interrupts
SPU:          0          0          0   Spurious interrupts
PMI:          0          0          0   Performance monitoring interrupts
IWI:          0          0          0   IRQ work interrupts
RTR:          0          0          0   APIC ICR read retries
RES:  347330843  309191325  308417790   Rescheduling interrupts
CAL:          0        935        935   Function call interrupts
TLB:        320         22         58   TLB shootdowns
TRM:          0          0          0   Thermal event interrupts
THR:          0          0          0   Threshold APIC interrupts
DFR:          0          0          0   Deferred Error APIC interrupts
MCE:          0          0          0   Machine check exceptions
MCP:          2          2          2   Machine check polls

的CPU / Clocksource:

4. lscpu | grep CPU.s
CPU(s):                3
On-line CPU(s) list:   0-2
NUMA node0 CPU(s):     0-2

5. cat /sys/devices/system/clocksource/clocksource0/current_clocksource
tsc

非常感谢您的帮助。摩西

linux-kernel centos real-time
1个回答
1
投票

即使使用nohz_full=,在隔离的CPU上也会出现一些滴答声:

某些流程处理操作仍然需要偶尔的调度时钟滴答。这些操作包括计算CPU负载,维护预定的平均值,计算CFS实体vruntime,计算avenrun以及执行负载平衡。目前,通过调度时钟滴答声每秒钟左右来容纳它们。正在进行的工作将消除对这些不频繁的计划时钟滴答声的需求。(Documentation/timers/NO_HZ.txt,请参阅(Nearly) full tickless operation in 3.10 LWN,2013)

因此,您必须检查本地计时器的速率,例如:

$ perf stat -a -A -e irq_vectors:local_timer_entry sleep 120

((在您隔离的线程/进程正在运行时)

此外,nohz_full=仅在每个隔离的内核上只有一个可运行任务时才有效。您可以使用例如ps -L -e -o pid,tid,user,state,psr,cmdcat /proc/sched_debug

也许您需要将一些(内核)任务移至内部管理核心,例如:

# tuna -U -t '*' -c 0-4 -m

通过查看/proc/timer_list,您可以深入了解哪些计时器仍处于活动状态。

调查可能中断原因的另一种方法是使用功能跟踪器(ftrace)。有关某些示例,另请参见Reducing OS jitter due to per-cpu kthreads

我在您的内核参数中看到nmi_watchdog=0,但您没有禁用软看门狗。也许这是另一个计时器滴答声源,将显示为ftrace。

您可以使用nowatchdog禁用所有看门狗。

顺便说一句,您的某些内核参数似乎已关闭:

  • tsc=perfect-您是指tsc=reliable吗?内核文档中未记录“完美”值
  • idle=mwait-您是指idle=poll吗?同样,我在内核文档中找不到'mwait'值
  • intel_iommu=on-这是什么目的?
© www.soinside.com 2019 - 2024. All rights reserved.