From patchwork Mon Mar 13 21:55:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 6564 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1432992wrd; Mon, 13 Mar 2023 15:10:01 -0700 (PDT) X-Google-Smtp-Source: AK7set+IbJ/ykgisLO80oFE7GiCSepalco0XfO7UovSp3ymvB9/1+PdknvOzjlMBkfNHNDdAf4Fr X-Received: by 2002:a17:902:ce92:b0:19e:27a1:dd94 with SMTP id f18-20020a170902ce9200b0019e27a1dd94mr44155294plg.35.1678745401272; Mon, 13 Mar 2023 15:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678745401; cv=none; d=google.com; s=arc-20160816; b=IKQ3gkAReylJCiFh/lTwwSqMH5KErhOsko/y1E7Fw/DPJj2AtTpzl9OPlhMrE0AGVA XnzZJIihEG979rnHv23gqxOL0HT8AScRhh+xmVLE/5j1K0TLMo1Y1NfNhmE15uxppmXF nvdJptsw82w0bC7DaxYNKBfiawgc0T6+dmSH2GGCeX3u6LG5hJMUMcHS/FhExRxJu/cN BFlf9TX1AfuFRMnoDhLH2lviyUQlk3IimAfQIhgRgazkrPrtC4ZhjYxBMByNomt3AFps yNc/8iFPWQ6TE6m16LyYWF7R78piWlRczBvzbKMGtwPWOT3j8OpsbTUdXeckZpwbHxxv UNXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Q10U2mlH8H4yAUTocSPwKTut23oRqgefnjKmoDESEdE=; b=Nn8WTtYiABxu1G92oxYNwxSyZkN20Cwlh69wVsfXnVrdpKT4luXPdMS+dtMyXxOfSL LyJXM1P+dtNWefQj3j6G+LZIzg+J785mARNtyChYkkwjaiA2PxTm9v8pU0K9HMCLnuwK FWjqohGpx5p7Fp+DSzqJQ5NMbUhLHMwIrISqoyCZFXMxai3LO0IErsNPiTb6409olrsZ WEDC2L7RvqjbrHvUMR+9quPvJadRztxQtSwNfgWyWNrwOteQpDZFt6JUBnNBNLVhnIGy uFfIl/cP8IX9VtaXapffzuurOoQNPIHeubuwcxspnjwmIkH/fIBBOba4Lb3yjr7f6Wqt Yq+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mOsXbz5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020a170902ba8700b0019ced5c611dsi683696pls.495.2023.03.13.15.09.44; Mon, 13 Mar 2023 15:10:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mOsXbz5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230034AbjCMV46 (ORCPT + 99 others); Mon, 13 Mar 2023 17:56:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229832AbjCMV44 (ORCPT ); Mon, 13 Mar 2023 17:56:56 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FD2F8C809; Mon, 13 Mar 2023 14:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678744615; x=1710280615; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=pLr4zyKR9mScniLFymNZ6LCQtLSp1OBPkBpafzPWR8w=; b=mOsXbz5TDqndvg4wXIxK2e7SU2/jOBqvcbGDyC22Pqcy7ltJZbHwRmxq xeDrO4LZTzFoNIHyYs3DjezYShjjEmdf1ph7Z26Z6E6d8L9VuWOUbjT/5 lRavEke66gW37MPPparPkIB6czB8TMbJQwvaoDA3VQH6dDV0rl0r/KPUk ffN87SG0PODJnKUCXa07f50gNk2sNNmXA7ujrvSy2MnY3RHzQ1OvCDftV 4ikTZVlJ8Ype5SJZTaqv+wEGll5t+ngj3LQk9bLROxXLrW6Lsv+76ZwDq twD8FgPQn/BNjui8lHLDqxXy5cIKsUmCQtSYWH4TVbwHXmalaSxSmzIRh A==; X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="364928600" X-IronPort-AV: E=Sophos;i="5.98,258,1673942400"; d="scan'208";a="364928600" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 14:56:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="747750966" X-IronPort-AV: E=Sophos;i="5.98,258,1673942400"; d="scan'208";a="747750966" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmsmga004.fm.intel.com with ESMTP; 13 Mar 2023 14:56:51 -0700 From: Alexander Lobakin To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau Cc: Alexander Lobakin , Maciej Fijalkowski , Larysa Zaremba , =?utf-8?q?Toke_H=C3=B8iland-J?= =?utf-8?q?=C3=B8rgensen?= , Song Liu , Jesper Dangaard Brouer , John Fastabend , Menglong Dong , Mykola Lysenko , "David S. Miller" , Jakub Kicinski , Eric Dumazet , Paolo Abeni , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next v3 0/4] xdp: recycle Page Pool backed skbs built from XDP frames Date: Mon, 13 Mar 2023 22:55:49 +0100 Message-Id: <20230313215553.1045175-1-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760292137802948721?= X-GMAIL-MSGID: =?utf-8?q?1760292137802948721?= Yeah, I still remember that "Who needs cpumap nowadays" (c), but anyway. __xdp_build_skb_from_frame() missed the moment when the networking stack became able to recycle skb pages backed by a page_pool. This was making e.g. cpumap redirect even less effective than simple %XDP_PASS. veth was also affected in some scenarios. A lot of drivers use skb_mark_for_recycle() already, it's been almost two years and seems like there are no issues in using it in the generic code too. {__,}xdp_release_frame() can be then removed as it losts its last user. Page Pool becomes then zero-alloc (or almost) in the abovementioned cases, too. Other memory type models (who needs them at this point) have no changes. Some numbers on 1 Xeon Platinum core bombed with 27 Mpps of 64-byte IPv6 UDP, iavf w/XDP[0] (CONFIG_PAGE_POOL_STATS is enabled): Plain %XDP_PASS on baseline, Page Pool driver: src cpu Rx drops dst cpu Rx 2.1 Mpps N/A 2.1 Mpps cpumap redirect (cross-core, w/o leaving its NUMA node) on baseline: 6.8 Mpps 5.0 Mpps 1.8 Mpps cpumap redirect with skb PP recycling: 7.9 Mpps 5.7 Mpps 2.2 Mpps +22% (from cpumap redir on baseline) [0] https://github.com/alobakin/linux/commits/iavf-xdp Alexander Lobakin (4): selftests/bpf: robustify test_xdp_do_redirect with more payload magics net: page_pool, skbuff: make skb_mark_for_recycle() always available xdp: recycle Page Pool backed skbs built from XDP frames xdp: remove unused {__,}xdp_release_frame() include/linux/skbuff.h | 4 +-- include/net/xdp.h | 29 --------------- net/core/xdp.c | 19 ++-------- .../bpf/progs/test_xdp_do_redirect.c | 36 +++++++++++++------ 4 files changed, 30 insertions(+), 58 deletions(-) --- From v2[1]: * fix the test_xdp_do_redirect selftest failing after the series: it was relying on that %XDP_PASS frames can't be recycled on veth (BPF CI, Alexei); * explain "w/o leaving its node" in the cover letter (Jesper). From v1[2]: * make skb_mark_for_recycle() always available, otherwise there are build failures on non-PP systems (kbuild bot); * 'Page Pool' -> 'page_pool' when it's about a page_pool instance, not API (Jesper); * expanded test system info a bit in the cover letter (Jesper). [1] https://lore.kernel.org/bpf/20230303133232.2546004-1-aleksander.lobakin@intel.com [2] https://lore.kernel.org/bpf/20230301160315.1022488-1-aleksander.lobakin@intel.com