On 21 Feb 2020, at 9:46, Magnus Karlsson wrote:
On Fri, Feb 21, 2020 at 9:40 AM Eelco Chaudron <echaudro@xxxxxxxxxx> wrote:On 21 Feb 2020, at 9:33, Magnus Karlsson wrote:On Fri, Feb 21, 2020 at 9:30 AM Eelco Chaudron <echaudro@xxxxxxxxxx> wrote:On 20 Feb 2020, at 23:49, William Tu wrote:Hi,I'm trying to save some CPU cycles when there is no packet arrives.I enable the poll syscall option of xdpsock, by doing $ ./xdpsock -r -p -S -i ens16 sock0@ens160:0 rxdrop xdp-skb poll() pps pkts 1.00 rx 0 0 tx 0 0 Since there is no packet coming, I though by calling poll()system call, the xdpsock process will be blocked and CPU utilizationshould be way under 100%. However, I'm still seeing 100% CPU utilization. Am I understanding this correctly?Hi William, I can remember I saw this in the past two with this code.Ithad something to do with the way xdpsock waits for the buffers to be free’ ed by the kernel. What I can remember it had something to dowith the veth interfaces also. I do remember that I fixed it in the tutorial for AF_XDP: https://github.com/xdp-project/xdp-tutorial/blob/master/advanced03-AF_XDP/af_xdp_user.cEelco, Do you remember exactly what you had to fix in the xdpsock sample?Your tutorial is quite a rewrite so it is hard for me to tell exactlywhich of all the changes that fix this problem. The reason I ask is that it would be nice to fix this in the sample too. Thanks: MagnusFrom an earlier email conversation we had this is where it looped in mycase:Thanks Eelco. Yes, the xdpsock sample is too simplistic in this case. I will put this on my backlog to fix so that we do not have this problem in the future. I might take some inspiration from your code :-). Hope you do not mind.
Its GPL so take whatever you need ;)