From 7c399aef1506a5b51067538950c36880f48d81a4 Mon Sep 17 00:00:00 2001 From: Michael Greenberg Date: Mon, 23 Nov 2026 16:13:16 -0500 Subject: [PATCH] skip unwritable IRQs --- pyperf/_system.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pyperf/_system.py b/pyperf/_system.py index d0f8e526..b5546047 100644 --- a/pyperf/_system.py +++ b/pyperf/_system.py @@ -2,6 +2,7 @@ import os.path import platform import re +import stat import struct import subprocess import sys @@ -822,6 +823,13 @@ def write_irq(self, irq, cpus): path = self.irq_affinity_path % irq mask = format_cpus_as_mask(cpus) try: + # The kernel makes smp_affinity read-only for an IRQ whose + # affinity can't be set, such as the cascade IRQ 2 or a + # kernel-managed IRQ. Since Linux 6.12, writing to it fails + # with EPERM rather than EIO, which looks like a permission + # error and would stop the loop over IRQs. Skip it instead. + if not os.stat(path).st_mode & stat.S_IWUSR: + return False write_text(path, mask) return True except OSError as exc: