加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 如何在Ubuntu上使用IRQBALANCE_BANNED_CPUS禁止硬件中

发布时间:2020-12-13 18:37:15 所属栏目:Linux 来源:网络整理
导读:我想禁止某些CPU的中断.我听说过IRQBALANCE_BANNED_CPUS选项.我看到irqbalance正在我的机器后台运行.我在哪里编辑以及如何配置该选项?例如,我想从中断中排除cpus 2,3,4,5.参数 descriptor是: Provides a mask of cpus which irqbalance should ignore and
我想禁止某些CPU的中断.我听说过IRQBALANCE_BANNED_CPUS选项.我看到irqbalance正在我的机器后台运行.我在哪里编辑以及如何配置该选项?例如,我想从中断中排除cpus 2,3,4,5.参数 descriptor是:

Provides a mask of cpus which irqbalance should ignore and never
assign interrupts to

面具是什么意思?我在哪里配置irqbalance与该选项?

编辑1:如何知道我的配置生效,换句话说我的CPU没有收到中断?我正在检查/ proc / interrupts但是有些数字正在增加.

EDIT2:现在我用IRQBALANCE_BANNED_CPUS = 3e启动了我的机器,所以只有CPU 0不被禁止中断.所以我应该期待看到cpo0收到很多中断而另一个cpus没有收到中断,对吧?这是我的/ proc / interrupts.粗体的行正在改变所有cpu.第22,24,35和LOC行正在改变.

CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       
   0:         26          0          0          0          0          0   IO-APIC-edge      timer
   1:          2          0          0          0          0          0   IO-APIC-edge      i8042
   6:          3          0          0          0          0          0   IO-APIC-edge      floppy
   8:          1          0          0          0          0          0   IO-APIC-edge      rtc0
   9:          0          0          0          0          0          0   IO-APIC-fasteoi   acpi
  12:          4          0          0          0          0          0   IO-APIC-edge      i8042
  14:      13556          0          0          0          0          0   IO-APIC-edge      ata_piix
  15:          0          0          0          0          0          0   IO-APIC-edge      ata_piix
  18:          0          0          0          0          0          0   IO-APIC-fasteoi   ata_piix
  19:          2          0          0          0          0          0   IO-APIC-fasteoi   ohci1394
  20:          3          0          0          0          0          0   IO-APIC-fasteoi   ehci_hcd:usb2,uhci_hcd:usb3,uhci_hcd:usb6
  21:        197        635         39          0          0          0   IO-APIC-fasteoi   uhci_hcd:usb4,uhci_hcd:usb7,HDA Intel
  22:        344       3506          0        702          0          0   IO-APIC-fasteoi   ehci_hcd:usb1,uhci_hcd:usb5,uhci_hcd:usb8
  24:        162         48          0          0          0          0   IO-APIC-fasteoi   nvidia
  35:        174          0         47          0          0          0   IO-APIC-fasteoi   nvidia
  53:       3517          0          0          0          0          0   PCI-MSI-edge      eth0
 NMI:          0          0          0          0          0          0   Non-maskable interrupts
 LOC:      11007       8840       6480       5652       4272       3046   Local timer interrupts
 SPU:          0          0          0          0          0          0   Spurious interrupts
 PMI:          0          0          0          0          0          0   Performance monitoring interrupts
 PND:          0          0          0          0          0          0   Performance pending work
 RES:        292        169        217        125        122        126   Rescheduling interrupts
 CAL:         86        280        254        292        293        291   Function call interrupts
 TLB:       1147       1031       1348        616        177        322   TLB shootdowns
 TRM:          0          0          0          0          0          0   Thermal event interrupts
 THR:          0          0          0          0          0          0   Threshold APIC interrupts
 MCE:          0          0          0          0          0          0   Machine check exceptions
 MCP:          2          2          2          2          2          2   Machine check polls
 ERR:          5
 MIS:          0

EDIT3:看起来IRQBALANCE_BANNED_CPUS选项在Ubuntu上完全是IGNORED.我尝试用1,3e重启我的机器并且全部中断了.就在我通过设置ENABLED = 0来禁用irqbalance时,我在cpu0上得到一个干净/ proc /中断而没有其他cpu.

解决方法

您在/ etc / default / irqbalance中设置IRQBALANCE_BANNED_CPUS.我通过查看/etc/init.d/irqbalance找到了这个.但该设置的有效值是多少?来自Red Hat的手册页:

This is a hex mask without the leading ‘0x’,on systems with large
numbers of processors each group of eight hex digits is sepearated ba
a comma ‘,’. i.e. export IRQBALANCE_BANNED_CPUS=fc0 would prevent
irqbalance from assigning irqs to the 7th-12th cpus (cpu6-cpu11) or
export IRQBALANCE_BANNED_CPUS=ff000000,00000001 would prevent
irqbalance from assigning irqs to the 1st (cpu0) and 57th-64th cpus
(cpu56-cpu63).

concept of a mask在维基百科上有解释.阅读,然后回来.让我们分解一下Red Hat的第一个例子.以十六进制写入fc0的数字以二进制形式写为222221000000.从右到左扫描(即从least significant bit到most significant bit),有六个零.这意味着可以为1st-5th cpu(cpu0-cpu5)分配中断.然后,有六个.这意味着不会为第7-12个cpu(cpu6-cpu11)分配中断.

听起来你想让cpu0和cpu1接收中断但是阻止cpu2,cpu3,cpu4和cpu5被分配中断.这意味着你需要两个零和四个,或111100.这是十六进制的3C.所以,你要用内容创建/ etc / default / irqbalance

ENABLED="1"
ONESHOT="0"
IRQBALANCE_BANNED_CPUS="3f"

要了解发生了什么,请尝试

$sudo service irqbalance stop
Stopping SMP IRQ Balancer: irqbalance.
$source /etc/default/irqbalance 
$sudo irqbalance --debug

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读