[PATCH v2] docs/zh_CN: Add core-api/irq managed_irq Chinese translation
#ProposedFrom:Zixin Wang <w1355457260@gmail.com>
Date:
Message-ID:<20261120160539.103773-1-w1355457260@gmail.com>
Patch:v2 · 1/1
Language:zh_CN
Patch-ID:b383adf10e2708cbd1f460d1a53e0a478eae9ce5
Files:
Documentation/translations/zh_CN/core-api/irq/index.rstDocumentation/translations/zh_CN/core-api/irq/managed_irq.rstLinks:lore message ↗ · raw mail ↗
Patch content 2 changed files
Translate Documentation/core-api/irq/managed_irq.rst into Chineseand add it to the zh_CN irq toctree. Update the translation through commit bb6a85b4b652("Documentation: Add managed interrupts") Co-developed-by: Chao Liu <chao.liu@processmission.com>Signed-off-by: Chao Liu <chao.liu@processmission.com>Signed-off-by: Zixin Wang <w1355457260@gmail.com>---Thanks Zenghui for the review. v1 -> v2: - Use a Co-developed-by/Signed-off-by pair for Chao Liu and keep the author's Signed-off-by last, as suggested by Zenghui Yu. - Reflow the translation to use the available width more evenly. Testing: make SPHINXDIRS="translations/zh_CN" htmldocs and checkpatch.pl pass. .../translations/zh_CN/core-api/irq/index.rst | 1 + .../zh_CN/core-api/irq/managed_irq.rst | 107 ++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 Documentation/translations/zh_CN/core-api/irq/managed_irq.rst diff --git a/Documentation/translations/zh_CN/core-api/irq/index.rst b/Documentation/translations/zh_CN/core-api/irq/index.rstindex ba6acc4..7951d69 100644--- a/Documentation/translations/zh_CN/core-api/irq/index.rst+++ b/Documentation/translations/zh_CN/core-api/irq/index.rst@@ -20,3 +20,4 @@ IRQs irq-affinity irq-domain irqflags-tracing+ managed_irqdiff --git a/Documentation/translations/zh_CN/core-api/irq/managed_irq.rst b/Documentation/translations/zh_CN/core-api/irq/managed_irq.rstnew file mode 100644index 0000000..b1b7918--- /dev/null+++ b/Documentation/translations/zh_CN/core-api/irq/managed_irq.rst@@ -0,0 +1,107 @@+.. SPDX-License-Identifier: GPL-2.0+.. include:: ../../disclaimer-zh_CN.rst++:Original: Documentation/core-api/irq/managed_irq.rst++:翻译:++ Zixin Wang <w1355457260@gmail.com>++.. _cn_managed_irq.rst:++=============================+亲和性托管中断(managed IRQ)+=============================++IRQ core 支持按指定 CPU 亲和性管理中断。正常运行时,每个中断关联到+某个特定的 CPU。如果该 CPU 离线,中断会被迁移到另一个在线 CPU。++中断向量很多时,设备可能给可用的向量空间带来压力。例如,一块带 128 个+I/O 队列的 NVMe 设备,在至少有 128 个 CPU 的系统中,通常每个队列请求+一个中断。两个这样的设备就会请求 256 个中断。在 x86 上,中断向量空间+出了名地少:每个 CPU 只有 256 个向量,内核还要保留其中一部分,从而进一步+减少可供设备中断使用的数量。实际使用中通常没有问题,因为中断分散在许多+CPU 上,每个 CPU 只分到少量向量。++然而在系统挂起时,所有次级 CPU 都会离线,所有中断都被迁移到唯一保持在线+的那个 CPU 上。这可能会耗尽该 CPU 上可用的中断向量,从而导致挂起操作失败。++亲和性托管(affinity-managed)中断应对了这一限制。每个中断都分配一个+CPU 亲和性掩码,指定该中断可以定向到的 CPU 集合。当掩码中的某个 CPU 离线+时,中断会移到掩码中的下一个 CPU。如果掩码中的最后一个 CPU 也离线,那么+该中断会被关闭。使用亲和性托管中断的驱动程序必须确保,在中断被禁用之前+关联的队列已处于静默(quiesced)状态,以免再产生新的中断。当亲和性掩码+中的某个 CPU 重新上线时,中断会被重新使能。++实现+----++设备必须提供按实例划分的中断,例如 NVMe 等存储设备的按 I/O 队列中断。+驱动程序使用 struct irq_affinity 按所需的亲和性设置分配中断向量。对于+MSI-X 设备,需要设置 PCI_IRQ_AFFINITY 标志并调用+pci_alloc_irq_vectors_affinity() 来完成。++IRQ core 会根据提供的亲和性信息,尽量在整个系统上均匀分散中断。亲和性+掩码在这一分配阶段计算,但最终的 IRQ 分配是在调用 request_irq() 时完成的。++隔离 CPU+--------++托管中断的亲和性完全由内核处理,无法通过 /proc 接口从用户空间修改。+isolcpus 启动选项的 managed_irq 子参数可指定一个 CPU 掩码,托管中断会+尽量避开这些 CPU。这种隔离是尽力而为的:只有当自动分配的掩码中也包含+被避开掩码之外的在线 CPU 时才会生效。如果请求的掩码只包含隔离 CPU,+该设置就没有任何效果。++被避开掩码中的 CPU 仍属于该中断的亲和性掩码。也就是说,如果所有非隔离+CPU 都离线、而隔离 CPU 仍在线,中断就会被分配到某个隔离 CPU 上。++以下示例假设系统有 8 个 CPU。++- 使用 "-device virtio-scsi-pci" 启动一个 QEMU 实例。该 MSI-X 设备会+ 暴露 11 个中断:3 个“管理”中断和 8 个“队列”中断。驱动程序请求这 8 个+ 队列中断,每个中断恰好亲和到一个 CPU。如果该 CPU 离线,该中断就会被+ 关闭。++ 假设中断 48 是其中一个队列中断,那么会看到::++ /proc/irq/48/effective_affinity_list:7+ /proc/irq/48/smp_affinity_list:7++ 这表明该中断只由 CPU7 服务。关闭 CPU7 并不会把中断迁移到其他 CPU::++ /proc/irq/48/effective_affinity_list:0+ /proc/irq/48/smp_affinity_list:7++ 可以通过 debugfs 接口 (/sys/kernel/debug/irq/irqs/48) 验证这一点。+ dstate 字段会包含 IRQD_IRQ_DISABLED、IRQD_IRQ_MASKED 和+ IRQD_MANAGED_SHUTDOWN。++- 使用以下参数启动 QEMU 实例:+ "-device virtio-scsi-pci,num_queues=2"+ 并在内核命令行中加入:+ "irqaffinity=0,1 isolcpus=domain,2-7 isolcpus=managed_irq,1-3,5-7"。+ 该 MSI-X 设备会暴露 5 个中断:3 个管理中断和 2 个队列中断。管理中断+ 遵循 irqaffinity= 设置。队列中断分散到可用的 CPU 上::++ /proc/irq/47/effective_affinity_list:0+ /proc/irq/47/smp_affinity_list:0-3+ /proc/irq/48/effective_affinity_list:4+ /proc/irq/48/smp_affinity_list:4-7++ 这两个队列中断被均匀分配。中断 48 落在 CPU4 上,因为 managed_irq+ 掩码会尽可能避开 CPU 5-7。++ 将 managed_irq 参数换成+ "isolcpus=managed_irq,1-3,4-5,7" 后,结果是::++ /proc/irq/48/effective_affinity_list:6+ /proc/irq/48/smp_affinity_list:4-7++ 此时中断 48 由 CPU6 服务,因为系统避开了 CPU 4、5 和 7。如果 CPU6+ 离线,中断会迁移到某个“隔离”CPU::++ /proc/irq/48/effective_affinity_list:7+ /proc/irq/48/smp_affinity_list:4-7++ 一旦其 smp_affinity 掩码中列出的所有 CPU 都离线,该中断就会被关闭。-- 2.54.0