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 52E2AC7618B for ; Wed, 15 Mar 2023 10:56:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231441AbjCOK4Z (ORCPT ); Wed, 15 Mar 2023 06:56:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231398AbjCOK4Q (ORCPT ); Wed, 15 Mar 2023 06:56:16 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 337834BEBD; Wed, 15 Mar 2023 03:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678877775; x=1710413775; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SfWoz0ZiPRKNB9h/FyiFLW0v6vSMHdAFxkAxVk70Vqo=; b=g5n1eINzewFaT1MPlHsqfwama8FWmDEcFJtIbgXzyLUMw99m1is/7wwd 9JkFES48aXLCI3zaiIP0gBe7fetZ+rS0MUgwPniutFM1I6jqDf3GbC9op /ixoVN988vIx2VyFX5DmvGqZdoyMRulOMIVOdsid6KqXQwZ8m+JDKwGcw PqS5HEzhAYZ41HrIDqN4xA6IdkJSBYSeD0sye03OyXB6TY9ZUYIZ2buzT cfG8+kdeEQabXYMtzR67TfiOsbm8eyPWvBVE9lyaUOT+SOeA7KzW/iLKQ ErRwzPlRh1ZA+xGAq2JYV9USnBXORTCGPlyyY8ucIYniu56i6DA3O4iPx w==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="317324582" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="317324582" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 03:55:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="803240335" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="803240335" Received: from newjersey.igk.intel.com ([10.102.20.203]) by orsmga004.jf.intel.com with ESMTP; 15 Mar 2023 03:55:38 -0700 From: Alexander Lobakin To: Ilya Leoshkevich , Alexei Starovoitov Cc: Alexander Lobakin , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Maciej Fijalkowski , Larysa Zaremba , =?UTF-8?Q?Toke_H=c3=b8iland-J=c3=b8rgensen?= , Song Liu , Jesper Dangaard Brouer , John Fastabend , Menglong Dong , Mykola Lysenko , "David S. Miller" , Jakub Kicinski , Eric Dumazet , Paolo Abeni , bpf , Network Development , LKML Subject: Re: [PATCH bpf-next v3 0/4] xdp: recycle Page Pool backed skbs built from XDP frames Date: Wed, 15 Mar 2023 11:54:11 +0100 Message-Id: <2bda95d8-6238-f9ef-7dce-aa9320013a13@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <5b360c35-1671-c0b8-78ca-517c7cd535ae@intel.com> References: <20230313215553.1045175-1-aleksander.lobakin@intel.com> <5b360c35-1671-c0b8-78ca-517c7cd535ae@intel.com> Content-Type: text/plain; charset=UTF-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Lobakin Date: Wed, 15 Mar 2023 10:56:25 +0100 > From: Alexei Starovoitov > Date: Tue, 14 Mar 2023 16:54:25 -0700 > >> On Tue, Mar 14, 2023 at 11:52 AM Alexei Starovoitov >> wrote: > > [...] > >> test_xdp_do_redirect:PASS:prog_run 0 nsec >> test_xdp_do_redirect:PASS:pkt_count_xdp 0 nsec >> test_xdp_do_redirect:PASS:pkt_count_zero 0 nsec >> test_xdp_do_redirect:FAIL:pkt_count_tc unexpected pkt_count_tc: actual >> 220 != expected 9998 >> test_max_pkt_size:PASS:prog_run_max_size 0 nsec >> test_max_pkt_size:PASS:prog_run_too_big 0 nsec >> close_netns:PASS:setns 0 nsec >> #289 xdp_do_redirect:FAIL >> Summary: 270/1674 PASSED, 30 SKIPPED, 1 FAILED >> >> Alex, >> could you please take a look at why it's happening? >> >> I suspect it's an endianness issue in: >> if (*metadata != 0x42) >> return XDP_ABORTED; >> but your patch didn't change that, >> so I'm not sure why it worked before. > > Sure, lemme fix it real quick. Hi Ilya, Do you have s390 testing setups? Maybe you could take a look, since I don't have one and can't debug it? Doesn't seem to be Endianness issue. I mean, I have this (the below patch), but not sure it will fix anything -- IIRC eBPF arch always matches the host arch ._. I can't figure out from the code what does happen wrongly :s And it happens only on s390. Thanks, Olek --- diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c b/tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c index 662b6c6c5ed7..b21371668447 100644 --- a/tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c +++ b/tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c @@ -107,7 +107,7 @@ void test_xdp_do_redirect(void) .attach_point = BPF_TC_INGRESS); memcpy(&data[sizeof(__u32)], &pkt_udp, sizeof(pkt_udp)); - *((__u32 *)data) = 0x42; /* metadata test value */ + *((__u32 *)data) = htonl(0x42); /* metadata test value */ skel = test_xdp_do_redirect__open(); if (!ASSERT_OK_PTR(skel, "skel")) diff --git a/tools/testing/selftests/bpf/progs/test_xdp_do_redirect.c b/tools/testing/selftests/bpf/progs/test_xdp_do_redirect.c index cd2d4e3258b8..2475bc30ced2 100644 --- a/tools/testing/selftests/bpf/progs/test_xdp_do_redirect.c +++ b/tools/testing/selftests/bpf/progs/test_xdp_do_redirect.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include #include #define ETH_ALEN 6 @@ -28,7 +29,7 @@ volatile int retcode = XDP_REDIRECT; SEC("xdp") int xdp_redirect(struct xdp_md *xdp) { - __u32 *metadata = (void *)(long)xdp->data_meta; + __be32 *metadata = (void *)(long)xdp->data_meta; void *data_end = (void *)(long)xdp->data_end; void *data = (void *)(long)xdp->data; @@ -44,7 +45,7 @@ int xdp_redirect(struct xdp_md *xdp) if (metadata + 1 > data) return XDP_ABORTED; - if (*metadata != 0x42) + if (*metadata != __bpf_htonl(0x42)) return XDP_ABORTED; if (*payload == MARK_XMIT)