Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00EC7C76196 for ; Mon, 10 Apr 2023 12:08:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229827AbjDJMH7 (ORCPT ); Mon, 10 Apr 2023 08:07:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjDJMH6 (ORCPT ); Mon, 10 Apr 2023 08:07:58 -0400 Received: from mail-ej1-x661.google.com (mail-ej1-x661.google.com [IPv6:2a00:1450:4864:20::661]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEDC05595 for ; Mon, 10 Apr 2023 05:07:55 -0700 (PDT) Received: by mail-ej1-x661.google.com with SMTP id qb20so11566761ejc.6 for ; Mon, 10 Apr 2023 05:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dectris.com; s=google; t=1681128474; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=7v43Rq8QtIQVPlLmfhiMAiQGZl0bJiLYuxpdQdVU7Bw=; b=JJ3EQf9KhNA390dNwa7lrAMTXl3bXlDJd5BuVZeFF/lu1wJZeg/d717gHaZICPwW2l Gcl+oN+gkHN3qIOvAop0432cyEvtWglv02ExiF69RsKjdk2LBP+wkEKFGhPU1O4RzD15 ELSRBk2Sl6qZlQK+tocc+CJw805Z/QfXpbkBE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681128474; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7v43Rq8QtIQVPlLmfhiMAiQGZl0bJiLYuxpdQdVU7Bw=; b=nMYrMyYcNFKRHXN1Vokf3uxJXOxmECi2TDz22fQ7sEPSZMGF4fKtOnC79s5DaGQNCF SVtDSO4HpuRSixBgYdb4qjFcGQHzvph8qpQzP0xKkmOC1dZktGhcc5yCi1U5jm27wTNW wBaMFvWYVuCSpj5ki7UAqOejKGev5eOc4ZJ8Gts0rwmeIz57biz3m2wvBtlRGzpT6fOW fSg1GZtJfJY4cURMrgQfz0NZUFH4rQSlZCTwbm06sXUMJrTqRJK7H0MXb5WQXzOKk/NW eW5cbbzK94MRL1YKXZ8NtfSFTxCqJ0dJ+rMgAewJeCaMBl5yhWnMDlFyXxGdSYhocqDH bHZA== X-Gm-Message-State: AAQBX9dMI3b/56y3+rHVZQoUvrbZuMgNEs7GCHs7q7haeNqL6k9CL1Ya PlBfIdnelbRjFlhzplk074JjW/cRfJTr1cxELEBVWHsYt/RW X-Google-Smtp-Source: AKy350aU8co7KQVqsL+B7ABmpTXsAasYQbNi1uG8xMgjlcVqfUW+N7iY/c+WT8w3uzURTvL+O2vVxvekCSMr X-Received: by 2002:a17:906:2605:b0:8aa:a9fe:a3fc with SMTP id h5-20020a170906260500b008aaa9fea3fcmr7848556ejc.8.1681128474126; Mon, 10 Apr 2023 05:07:54 -0700 (PDT) Received: from fedora.dectris.local (dect-ch-bad-pfw.cyberlink.ch. [62.12.151.50]) by smtp-relay.gmail.com with ESMTPS id nb39-20020a1709071ca700b008b1fc5abd08sm2089769ejc.56.2023.04.10.05.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 05:07:54 -0700 (PDT) X-Relaying-Domain: dectris.com From: Kal Conley To: Magnus Karlsson , Alexei Starovoitov , Daniel Borkmann , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend Cc: Kal Conley , netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH bpf-next v5 0/4] xsk: Support UMEM chunk_size > PAGE_SIZE Date: Mon, 10 Apr 2023 14:06:25 +0200 Message-Id: <20230410120629.642955-1-kal.conley@dectris.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org The main purpose of this patchset is to add AF_XDP support for UMEM chunk sizes > PAGE_SIZE. This is enabled for UMEMs backed by HugeTLB pages. Note, v5 fixes a major bug in previous versions of this patchset. In particular, dma_map_page_attrs used to be called once for each order-0 page in a hugepage with the assumption that returned I/O addresses are contiguous within a hugepage. This assumption is incorrect when an IOMMU is enabled. To fix this, v5 does DMA page accounting accounting at hugepage granularity. Changes since v4: * Use hugepages in DMA map (fixes zero-copy mode with IOMMU). * Use pool->dma_pages to check for DMA. This change is needed to avoid performance regressions). * Update commit message and benchmark table. Changes since v3: * Fix checkpatch.pl whitespace error. Changes since v2: * Related fixes/improvements included with v2 have been removed. These changes have all been resubmitted as standalone patchsets. * Minimize uses of #ifdef CONFIG_HUGETLB_PAGE. * Improve AF_XDP documentation. * Update benchmark table in commit message. Changes since v1: * Add many fixes/improvements to the XSK selftests. * Add check for unaligned descriptors that overrun UMEM. * Fix compile errors when CONFIG_HUGETLB_PAGE is not set. * Fix incorrect use of _Static_assert. * Update AF_XDP documentation. * Rename unaligned 9K frame size test. * Make xp_check_dma_contiguity less conservative. * Add more information to benchmark table. Thanks to Magnus Karlsson for all his support! Happy Easter! Kal Conley (4): xsk: Use pool->dma_pages to check for DMA xsk: Support UMEM chunk_size > PAGE_SIZE selftests: xsk: Use hugepages when umem->frame_size > PAGE_SIZE selftests: xsk: Add tests for 8K and 9K frame sizes Documentation/networking/af_xdp.rst | 36 ++++++++++------ include/net/xdp_sock.h | 2 + include/net/xdp_sock_drv.h | 12 ++++++ include/net/xsk_buff_pool.h | 12 +++--- net/xdp/xdp_umem.c | 55 +++++++++++++++++++----- net/xdp/xsk_buff_pool.c | 43 ++++++++++-------- tools/testing/selftests/bpf/xskxceiver.c | 27 +++++++++++- tools/testing/selftests/bpf/xskxceiver.h | 2 + 8 files changed, 142 insertions(+), 47 deletions(-) -- 2.39.2