From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 924B3C169C4 for ; Tue, 29 Jan 2019 19:14:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4EDEC20880 for ; Tue, 29 Jan 2019 19:14:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="cWlF+TNi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729341AbfA2TOT (ORCPT ); Tue, 29 Jan 2019 14:14:19 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:37399 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726852AbfA2TOS (ORCPT ); Tue, 29 Jan 2019 14:14:18 -0500 Received: by mail-qt1-f194.google.com with SMTP id t33so23526739qtt.4 for ; Tue, 29 Jan 2019 11:14:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=LHW+Y6xazzzoLM/NmlsvvboaxY1oltI4Na/qlc1d6Wk=; b=cWlF+TNigbNInVCv0+g2x32eNMRXqhjewD3EARKYt72oqRacVvH1Id/l0Tc+uStuF1 eRjc1osjFD5FCws2R0/gdpnjWLVbS0NtBl1ODH8GeK0Gx6aL3mds9o9WJa9oMBZBXLys h2fAhxJcNNFqI9Pf92uf1gTjLjJFJEduaLcld1hi937gTJf4NL7PSLwL7z0gGqNaoXJF UbewnwZEtf4og9pjow6dmLgbxPrC61rFRbPO0vVe4DbJ+6yB0bRv4Bw3g2B86wmjlyNh uaBLX+rByQCoOaEyTi0kpnchDiOJu3cKi2lCnVwo6SnxN7IbqOIxt/rdIWkhgnS+k8UF dNkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=LHW+Y6xazzzoLM/NmlsvvboaxY1oltI4Na/qlc1d6Wk=; b=ulTc7b0G50BAdTgBys6sirqFfff9aeZBjDmBkg5OwWWaFcPAbS5Uz3u3CRF09bfH9E 32Y0qG0HQWrpjnz5XG+KKB3xmJTKxjW/qYtJJLJg+CyglwKupYA+ll/N+cQ5G84SPO83 EIvdgD/DQj/OXuN4fc+ddujRQux9ATOfmPrH4Ii/sJJ+wqoRch9i/eYBooiodF0df5hH uy2gApOiWhVvxXGzkoooLhXxZIPn0vAMExBOms1HJCaZUNExTjr3mt6Rn+cWJiUiCNMN EVzte+Gzo2Y47QRxHwpRLlEomqp5v682lhAvWbhTP8Mckf3wqqLzN4hvYFt73TMHpd4h gEag== X-Gm-Message-State: AJcUukfypWvPwcy6R8mtZA3AvQJQolrkm4vk6Z2Z25hGG6F8w2tgUChl TBAGb1RCAHUXwA9EkIjpBhR41iVkGGM= X-Google-Smtp-Source: ALg8bN5D5PJbHEgFLbUxSCrtoG0w3+YZq/6lYG44LVf4mVUvOALpNefgh+9xoEWZbkWoKik5UoHWwQ== X-Received: by 2002:aed:2c65:: with SMTP id f92mr26500286qtd.47.1548789257564; Tue, 29 Jan 2019 11:14:17 -0800 (PST) Received: from cakuba.hsd1.ca.comcast.net ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id q21sm92301187qtk.79.2019.01.29.11.14.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jan 2019 11:14:17 -0800 (PST) Date: Tue, 29 Jan 2019 11:14:11 -0800 From: Jakub Kicinski To: Magnus Karlsson Cc: bjorn.topel@intel.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: Re: [PATCH net] ixgbe: fix potential RX buffer starvation for AF_XDP Message-ID: <20190129111411.3a4c3599@cakuba.hsd1.ca.comcast.net> In-Reply-To: <1548770630-16189-1-git-send-email-magnus.karlsson@intel.com> References: <1548770630-16189-1-git-send-email-magnus.karlsson@intel.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, 29 Jan 2019 15:03:50 +0100, Magnus Karlsson wrote: > When the RX rings are created they are also populated with buffers so > that packets can be received. Usually these are kernel buffers, but > for AF_XDP in zero-copy mode, these are user-space buffers and in this > case the application might not have sent down any buffers to the > driver at this point. And if no buffers are allocated at ring creation > time, no packets can be received and no interupts will be generated so > the napi poll function that allocates buffers to the rings will never > get executed. > > To recitfy this, we kick the NAPI context of any queue with an > attached AF_XDP zero-copy socket in two places in the code. Once after > an XDP program has loaded and once after the umem is registered. This > take care of both cases: XDP program gets loaded first then AF_XDP > socket is created, and the reverse, AF_XDP socket is created first, > then XDP program is loaded. > > Fixes: d0bcacd0a130 ("ixgbe: add AF_XDP zero-copy Rx support") > Signed-off-by: Magnus Karlsson I may not understand the problem fully, but isn't it kind of normal that if you create a ring empty you'll never receive packets? And it should be reasonably easy to catch while writing an app from scratch (i.e. it behaves deterministically). Plus user space can already do the kick manually: create the ring empty, attach prog, put packets on the ring, and kick xmit - that would work, no? Putting the kick in ixgbe_xdp_setup() seems a tiny bit random to me, but perhaps I'm not seeing the rationale clearly.