Hi, I implement IRQ affinity (aka interrupt routing) for amd64. Here is the implementation. https://github.com/knakahara/netbsd-src/compare/rfc/irq-affinity But the UI is rough, so could you comment aboud the UI?
The implementation is consist of following three pathes: (1) IRQ affinity implementation itself The usage is "sysctl -w kern.cpu_affinity.irq=18:1" ("18" is IRQ number, "1" is cpuid). This mean the IRQ 18 interrupts route to cpuid 1 cpu core. https://github.com/knakahara/netbsd-src/commit/2ccaf5152fe41175a9192164b939d00f957e42cb (2) new kernfs file to show interrupt numbers per cpu "vmstat -i" cannot show interrupt numbers per cpu. So I implement new kernfs file to show per cpu. The usage is "cat /kern/interrupts". For example, we can see below output which is like linux's /proc/interrupts ==================== IRQ CPU#00 CPU#01 1 0* 0 3 0* 0 4 0* 0 6 0* 0 7 0* 0 9 0* 0 12 0* 0 14 0* 0 15 0* 0 16 108* 0 17 1193055* 0 18 680358 150* ==================== "*" mean the cpu is routed the IRQ number interrupts. https://github.com/knakahara/netbsd-src/commit/dc7c17dd2f0cd78a03983849feb8fdd8cbe0d9c6 (3) add new API to show device name in /kern/interrupts To use efficiently interrupt routing, device name is needed. I implement new API borrow an idea from OpenBSD's pci_intr_establish(). If device drivers use this new API, /kern/interrupts can show device names as below ==================== IRQ CPU#00 CPU#01 1 0* 0 unknown 3 0* 0 unknown 4 0* 0 unknown 6 0* 0 unknown 7 0* 0 unknown 9 0* 0 unknown 12 0* 0 unknown 14 0* 0 unknown 15 0* 0 unknown 16 331* 0 unknown 17 1193149* 0 wm0 18 680358 436* vmx0 ==================== Device driver can use such as "device_xname(sc->sc_dev)" as "xname" parameter. https://github.com/knakahara/netbsd-src/commit/97adb1f9b2eea4c95cb6b3e6688c6639c17a025d Above implementation works well, but I think the UI is not so good. So, I am going to implement new command intrctl(8). The usage is consist of below two sub command. (A) "intrctl list" This sub command show interrupt numbers per cpu (like /kern/interrupts). (B) "intrctl -i 18 -c 1" This sub command let interrupts route other cpu. "18" is IRQ number, "1" is cpuid (like "sysctl -w kern.cpu_affinity.irq=18:1"). Could you comment which UI is good, current "sysctl and /kern/interrupts" or new "intrctl"? Thanks, -- ////////////////////////////////////////////////////////////////////// Internet Initiative Japan Inc. Device Engineering Section, Core Product Development Department, Product Division, Technology Unit Kengo NAKAHARA <k-nakah...@iij.ad.jp>