ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Affinity broken due to vector space exhaustion 问题

2021-12-17 19:02:20  阅读:309  来源: 互联网

标签:kernel x86 space irq mask due broken vector affinity


dmesg 中异常打印:

 kernel: irq 632: Affinity broken due to vector space exhaustion.
 kernel: irq 633: Affinity broken due to vector space exhaustion.

这个打印并不是申请不到中断号,而是已经申请到了中断号,但是配置中断路由的时候,
想要生效的中断绑核与预期不一致,代码为:

commit 743dac494d61d991967ebcfab92e4f80dc7583b3
Author: Neil Horman <nhorman@tuxdriver.com>
Date:   Thu Aug 22 10:34:21 2019 -0400

    x86/apic/vector: Warn when vector space exhaustion breaks affinity

    On x86, CPUs are limited in the number of interrupts they can have affined
    to them as they only **support 256 interrupt** vectors per CPU. 32 vectors are
    reserved for the CPU and the kernel reserves another 22 for internal
    purposes. That leaves 202 vectors for assignement to devices.

    When an interrupt is set up or the affinity is changed by the kernel or the
    administrator, the vector assignment code attempts to honor the requested
    affinity mask. If the vector space on the CPUs in that affinity mask is
    exhausted the code falls back to a wider set of CPUs and assigns a vector
    on a CPU outside of the requested affinity mask silently.

    While the effective affinity is reflected in the corresponding
    /proc/irq/$N/effective_affinity* files the silent breakage of the requested
    affinity can lead to unexpected behaviour for administrators.

    Add a pr_warn() when this happens so that adminstrators get at least
    informed about it in the syslog.

    [ tglx: Massaged changelog and made the pr_warn() more informative ]

    Reported-by: djuran@redhat.com
    Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Tested-by: djuran@redhat.com
    Link: https://lkml.kernel.org/r/20190822143421.9535-1-nhorman@tuxdriver.com

diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c
index fdacb864c3dd..2c5676b0a6e7 100644
--- a/arch/x86/kernel/apic/vector.c
+++ b/arch/x86/kernel/apic/vector.c
@@ -398,6 +398,17 @@ static int activate_reserved(struct irq_data *irqd)
                if (!irqd_can_reserve(irqd))
                        apicd->can_reserve = false;
        }
+
+       /*
+        * Check to ensure that the effective affinity mask is a subset
+        * the user supplied affinity mask, and warn the user if it is not
+        */
+       if (!cpumask_subset(irq_data_get_effective_affinity_mask(irqd),
+                           irq_data_get_affinity_mask(irqd))) {
+               pr_warn("irq %u: Affinity broken due to vector space exhaustion.\n",
+                       irqd->irq);
+       }
+
        return ret;
 }

原因作者也解释得很清楚,就是x86的cpu,各个核能够接收的中断个数是有限制的,在centos7中,我们经常遇到配置中断路由失败的情况,没有异常打印,
所以针对这个问题,目前在内核中增加了这个打印。然后centos 8.3也移植了这个打印。

遇到这个问题,由于我们0号核一般是重灾区,所以要尽量将中断不要路由到0号核。

标签:kernel,x86,space,irq,mask,due,broken,vector,affinity
来源: https://www.cnblogs.com/10087622blog/p/15703497.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有