Can Hard and Soft-IRQ for the same network-packet be executed on different CPU-Cores?

Viewed 1481

Can Hard and Soft-IRQ for the same network-packet be executed on different CPU-Cores when network packets are processed on Linux x86_64 kernel 3.16?


Does it mean that:

  • Ethernet-adapter (NIC) copy packet to the socket-buffer (mbuf) by using NIC-DMA and then NIC invoke Hard-IRQ on CPU Core-N

  • Then code of this Hard-IRQ do nothing more than invoke Soft-IRQ on the different CPU Core-M by using RPS

  • On this CPU Core-M the Soft-IRQ processes this packet by using TCP/IP-stack in kernel-space

  • Then our Application by using read(,buf,) get the data from the socket-buffer (mbuf) to the our buffer in user-space on CPU Core-K

Is that correct?

Can Hard and Soft-IRQ for the same network-packet be executed on different cores when used RPS?

1 Answers

I try to explain my understanding, however, maybe not correct. Please help to correct my answers.

First, RPS and RSS work as the same, that is mapping irq/packet to a specific CPU core via hashing, e.g., 4-tuple, V(X)LAN tag and etc. The difference is that RPS is implemented on software, while RSS is implemented on hardware, i.e., NIC. So the claim in this blog (http://balodeamit.blogspot.ru/2013/10/receive-side-scaling-and-receive-packet.html) may be contract with itself.

Second, RFS and aRFS also perform CPU steering. They map irq/packet to the same core as the upper layer application to achieve affinity, e.g., processed by the same NUMA node. aRFS is the hardware version of RFS. You can refer to this paper (https://dl.acm.org/doi/abs/10.1145/3452296.3472888) for more details.

In concolusion, the hard and soft irq may be mapped to the same CPU cores, however, with different steering mechanisms, e.g., RPS/RSS and RFS/aRFS.

Related