From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 89A9EA054F; Mon, 1 Mar 2021 17:32:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6CFA222A2D5; Mon, 1 Mar 2021 17:32:28 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 52F9C40041 for ; Mon, 1 Mar 2021 17:32:22 +0100 (CET) IronPort-SDR: v0jQ3gpDVIcJsZw2Hbi1fJyZVxZ+vtKVpSR4IAqqHNJ/nG9m4QI1GkDWS7aqJDVvuLZ+jvKxCl 5YH9k47xA6sQ== X-IronPort-AV: E=McAfee;i="6000,8403,9910"; a="184078010" X-IronPort-AV: E=Sophos;i="5.81,215,1610438400"; d="scan'208";a="184078010" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2021 08:32:20 -0800 IronPort-SDR: FotIYx6wLVViAHyFJsKZ2WqeCSPn0D4B/GbJ0az3CMlJDZxPDfqkb5vC10zz7/soZcs46HU8+9 vrZpM5j47dZw== X-IronPort-AV: E=Sophos;i="5.81,215,1610438400"; d="scan'208";a="397810194" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.216.186]) ([10.213.216.186]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2021 08:32:19 -0800 To: Ciara Loftus , dev@dpdk.org References: <20210218092307.29575-1-ciara.loftus@intel.com> <20210224111852.11947-1-ciara.loftus@intel.com> <20210224111852.11947-4-ciara.loftus@intel.com> From: Ferruh Yigit X-User: ferruhy Message-ID: <887a3d36-8197-61af-5b34-46f71921bc16@intel.com> Date: Mon, 1 Mar 2021 16:32:17 +0000 MIME-Version: 1.0 In-Reply-To: <20210224111852.11947-4-ciara.loftus@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH 3/3] net/af_xdp: preferred busy polling X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 2/24/2021 11:18 AM, Ciara Loftus wrote: > This commit introduces support for preferred busy polling > to the AF_XDP PMD. This feature aims to improve single-core > performance for AF_XDP sockets under heavy load. > > A new vdev arg is introduced called 'busy_budget' whose default > value is 64. busy_budget is the value supplied to the kernel > with the SO_BUSY_POLL_BUDGET socket option and represents the > busy-polling NAPI budget. To set the budget to a different value > eg. 256: > > --vdev=net_af_xdp0,iface=eth0,busy_budget=256 > > Preferred busy polling is enabled by default provided a kernel with > version >= v5.11 is in use. To disable it, set the budget to zero. > > The following settings are also strongly recommended to be used in > conjunction with this feature: > > echo 2 | sudo tee /sys/class/net/eth0/napi_defer_hard_irqs > echo 200000 | sudo tee /sys/class/net/eth0/gro_flush_timeout > > .. where eth0 is the interface being used by the PMD. > > Signed-off-by: Ciara Loftus > --- > doc/guides/nics/af_xdp.rst | 38 ++++++++++++- > drivers/net/af_xdp/compat.h | 13 +++++ > drivers/net/af_xdp/rte_eth_af_xdp.c | 85 ++++++++++++++++++++++++----- > 3 files changed, 121 insertions(+), 15 deletions(-) Can you please update the release notes too to announce the feature? <...> > @@ -39,3 +39,16 @@ create_shared_socket(struct xsk_socket **xsk_ptr __rte_unused, > return -1; > } > #endif > + > +#ifdef XDP_USE_NEED_WAKEUP > +static int > +syscall_needed(struct xsk_ring_prod *q, uint32_t busy_budget) > +{ > + return xsk_ring_prod__needs_wakeup(q) | busy_budget; > +} > +#else > +syscall_needed(struct xsk_ring_prod *q __rte_unused, uint32_t busy_budget) > +{ > + return busy_budget; > +} Is the return type missing in the definition? Also for the case when both 'XDP_USE_NEED_WAKEUP' & 'SO_PREFER_BUSY_POLL' this function will always return '0', but current implementation doesn't know this in the compile time and compiler can't optimize for it, do you think does it make sense to do this optimization? <...> > @@ -1628,8 +1670,22 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev) > return -EINVAL; > } > > +#ifdef SO_PREFER_BUSY_POLL > + busy_budget = busy_budget == -1 ? ETH_AF_XDP_DFLT_BUSY_BUDGET : > + busy_budget; > + if (!busy_budget) > + AF_XDP_LOG(ERR, "Preferred busy polling disabled\n"); Is this an error case? What do you think changing the log level to DEBUG or INFO? Also how these compile time flags will work if the compiled environment and run environment kernel version are different and incompatible? Overall can it be possible to detect the support on runtime via 'setsockopt()' without compile time macros and eliminate the compile time flags? Does it make sense?