Setting IRQ SMP affinity on Rpi 5

The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.

Post Reply
User avatar
/RaspberryPi
Corporate
Posts: 2449
Joined: Wed Jun 05, 2019 1:29 am

Setting IRQ SMP affinity on Rpi 5

Post by /RaspberryPi »


Hi.

I'm optimizing a high NTP server accuracy project and one of the latest test willing to practice is reducing the PPS interrupt jitter. Checking the /proc/interrupt file, one can see that almost every system interrupt is being processed by the same CPU core, including the sensitive ones from PPS and UART (NMEA):

``` CPU0 CPU1 CPU2 CPU3

9: 0 0 0 0 GICv2 25 Level vgic

11: 0 0 0 0 GICv2 30 Level kvm guest ptimer

12: 0 0 0 0 GICv2 27 Level kvm guest vtimer

13: 27335 19073 22731 20463 GICv2 26 Level arch_timer

14: 709 0 0 0 GICv2 65 Level 107c013880.mailbox

21: 0 0 0 0 GICv2 119 Level DMA IRQ

22: 0 0 0 0 GICv2 120 Level DMA IRQ

23: 0 0 0 0 GICv2 121 Level DMA IRQ

24: 0 0 0 0 GICv2 122 Level DMA IRQ

26: 0 0 0 0 GICv2 48 Level arm-pmu

27: 0 0 0 0 GICv2 49 Level arm-pmu

28: 0 0 0 0 GICv2 50 Level arm-pmu

29: 0 0 0 0 GICv2 51 Level arm-pmu

38: 0 0 0 0 GICv2 261 Level PCIe PME, aerdrv

106: 27889 0 0 0 rp1_irq_chip 6 Level eth0

108: 1232 0 0 0 rp1_irq_chip 8 Level 1f00074000.i2c

125: 1233 0 0 0 rp1_irq_chip 25 Level uart-pl011

131: 0 0 0 0 rp1_irq_chip 31 Edge xhci-hcd:usb1

136: 0 0 0 0 rp1_irq_chip 36 Edge xhci-hcd:usb3

140: 7 0 0 0 rp1_irq_chip 40 Level dw_axi_dmac_platform

161: 15612 0 0 0 GICv2 305 Level mmc0

162: 0 0 0 0 107d508500.gpio 20 Edge pwr_button

163: 0 0 0 0 GICv2 150 Level 107d004000.spi

164: 0 0 0 0 intc@7d508380 1 Level 107d508200.i2c

165: 0 0 0 0 intc@7d508380 2 Level 107d508280.i2c

166: 1214 0 0 0 pinctrl-rp1 18 Edge [url=mailto:pps@12.-1]pps@12.-1[/url]

167: 0 0 0 0 GICv2 281 Level v3d_core0

168: 0 0 0 0 GICv2 282 Level v3d_hub

169: 0 0 0 0 GICv2 104 Level pispbe

170: 0 0 0 0 GICv2 130 Level 1000800000.codec

171: 0 0 0 0 interrupt-controller@7c502000 2 Level 107c580000.hvs

172: 0 0 0 0 interrupt-controller@7c502000 9 Level 107c580000.hvs

173: 0 0 0 0 interrupt-controller@7c502000 16 Level 107c580000.hvs

174: 0 0 0 0 interrupt-controller@7d510600 7 Level vc4 hdmi hpd connected

175: 0 0 0 0 interrupt-controller@7d510600 8 Level vc4 hdmi hpd disconnected

176: 0 0 0 0 interrupt-controller@7d510600 2 Level vc4 hdmi cec rx

177: 0 0 0 0 interrupt-controller@7d510600 1 Level vc4 hdmi cec tx

178: 0 0 0 0 interrupt-controller@7d510600 14 Level vc4 hdmi hpd connected

179: 0 0 0 0 interrupt-controller@7d510600 15 Level vc4 hdmi hpd disconnected

180: 0 0 0 0 interrupt-controller@7d510600 12 Level vc4 hdmi cec rx

181: 0 0 0 0 interrupt-controller@7d510600 11 Level vc4 hdmi cec tx

182: 0 0 0 0 interrupt-controller@7c502000 1 Level 107c500000.mop

183: 0 0 0 0 interrupt-controller@7c502000 0 Level 107c501000.moplet

184: 0 0 0 0 GICv2 133 Level vc4 crtc

185: 0 0 0 0 GICv2 142 Level vc4 crtc

IPI0: 691 849 898 874 Rescheduling interrupts

IPI1: 8120 15387 14926 17354 Function call interrupts

IPI2: 0 0 0 0 CPU stop interrupts

IPI3: 0 0 0 0 CPU stop (for crash dump) interrupts

IPI4: 0 0 0 0 Timer broadcast interrupts

IPI5: 0 0 0 0 IRQ work interrupts

IPI6: 0 0 0 0 CPU wake-up interrupts
```

Using the kernel documentation (https://www.kernel.org/doc/html/latest/core-api/irq/irq-affinity.html), the commands returns I/O errors:

```
cd /proc/irq/166 echo 4 > smp_affinity
-bash: echo: write error: Input/output error ```

Using the latest Rpi 5 kernel:

``` uname -a

Linux rpi5b-ntp-gps 6.1.0-rpi8-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.73-1+rpt1 (2024-01-25) aarch64 GNU Linux ```

What am I missing?
submitted by /u/redalert_pt
[link] [comments]

Source: https://www.reddit.com/r/raspberry_pi/c ... _on_rpi_5/
/RaspberryPi
Post Reply

Return to “Raspberry Pi Forum”