Return-Path: Received: from postout2.mail.lrz.de ([129.187.255.138]:34195 "EHLO postout2.mail.lrz.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbgCYKp4 (ORCPT ); Wed, 25 Mar 2020 06:45:56 -0400 From: "Gaul, Maximilian" Subject: AW: Shared Umem and reducing ksoftirqd-Load Date: Wed, 25 Mar 2020 10:45:52 +0000 Message-ID: <35eed7a7481a44bc93e8e5f7e59d9e5a@hm.edu> References: <018e8071725b48399141cc46b63641e1@hm.edu> <9616cd5986c74058b51ffd1eb3311b85@hm.edu>, In-Reply-To: Content-Language: de-DE MIME-Version: 1.0 Sender: xdp-newbies-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Magnus Karlsson Cc: Xdp On Wed, Mar 25, 2020 at 11:24 AM Karlsson, Magnus wrote: =A0 =20 > On Wed, Mar 25, 2020 at 11:02 AM Gaul, Maximilian > wrote: > > > > On Wed, Mar 25, 2020 at 10:41 AM Karlsson, Magnus > > wrote: > > > > > On Wed, Mar 25, 2020 at 10:04 AM Gaul, Maximilian > > > wrote: > > > > > > > > I am running a Multi-AF-XDP-Socket approach per RX-Queue (using Sha= red Umem). > > > > > > > > Unfortunately I am noticing, that at around 650k pps, the *ksoftirq= d*-thread of that RX-Queue ramps up to 100% thus leading to packet loss. > > > > I tried setting *XDP_USE_NEED_WAKEUP* on *xsk_socket_cfg.bind_flags= * but those bind_flags are only taken into account if *umem->refcount > 1* = (libbpf/xsk.c - xsk_socket__create()). > > > > As far as I understand this correctly, only the first socket is abl= e to set *XDP_USE_NEED_WAKEUP* because for all sockets after, *umem->refcou= nt* is going to be at least 2. > > > > > > Yes, the other sockets just inherit the settings of the first one. > > > > > > Are you using the SKB mode? What is your packet size? Sounds like a > > > low number unless you have large packets and are using the SKB mode. > > > > > > > These are the flags I set right before calling `xsk_socket__create`: > > > >=A0=A0=A0=A0=A0=A0=A0=A0 xsk_socket_cfg.xdp_flags =3D cfg->xdp_flags | X= DP_FLAGS_DRV_MODE | XDP_ZEROCOPY; > >=A0=A0=A0=A0=A0=A0=A0=A0 xsk_socket_cfg.bind_flags =3D cfg->xsk_bind_fla= gs | XDP_USE_NEED_WAKEUP; >=20 > XDP_ZEROCOPY is a bind flag not an XDP flag, so please move it there. > If you get an error when you have it set, it means that your setup > does not support zero-copy for some reason. Check what kernel version > you are using and the the driver you are using supports zero-copy. I > believe you need to use a queue id>=3D32 in the Mellanox driver for it > to work in zero-copy mode. Below 32, you will get copy mode. >=20 > > Packet size is around 1492 bytes. >=20 > Seems that you are using SKB mode then, not zero-copy. >=20 > /Magnus > Thank you for the hint. As you correctly said, I get an error if I use *XDP= _ZEROCOPY*. But as far as I understand, packet rates should be higher in Dr= iver-Mode even without zero-copy? I just updated to the latest driver- and firmware version: $ sudo ethtool -i driver: mlx5_core version: 5.0-0 firmware-version: 16.27.1016 (MT_0000000012) I actually have to correct myself: Incomming packets are 1442 bytes. Can you give me the link between packet size and whether the NIC is running= in SKB or DRV mode? Mr. Brouer held a talk about (https://people.netfilter.org/hawk/presentatio= ns/driving-IT2017/driving-IT-2017_XDP_eBPF_technology_Jesper_Brouer.pdf) ab= out XDP, mentioning in slide 11/27 that *mlx5 (v4.9)* has native XDP suppor= t. =20 > > Just to make sure: Those 650k packets are arriving on the same RX-Queue= (even though this NIC has multiple RX-Queues I want to test maximum bandwi= th for a single RX-Queue). > > > > > > I didn't observe a dramatic change as I've hoped to. Are there some= other ways to reduce interrupt load (user-space application and ksoftirq a= re already running on different CPUs)? > > > > > > The need_wakeup flag has a big impact when you run the softirq and th= e > > > application thread on the same core. When using two cores for this, i= t > > > has less of an impact. > > > > > > /Magnus > > > > > > > NIC: Mellanox Technologies MT27800 > > > > > > > > Best regards > > > > > > > > Max > > > > > > =20