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=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 A3211C433E1 for ; Fri, 26 Mar 2021 18:10:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5359161A13 for ; Fri, 26 Mar 2021 18:10:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230240AbhCZSKB (ORCPT ); Fri, 26 Mar 2021 14:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230197AbhCZSJm (ORCPT ); Fri, 26 Mar 2021 14:09:42 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 731D4C0613AA; Fri, 26 Mar 2021 11:09:42 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id j198so6689008ybj.11; Fri, 26 Mar 2021 11:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ZhDceGf5EPwxqOmSXw7vSwKwAN2oE3kPh5APLhrkFoc=; b=rZ5aSSs1FMJf5GOkwaIlzevMhDtIv7GWGcyp/tMZriePwT5YUyIaPyEGKp2gaPLE2l QJNagORWX24s9kDaMB8RWeFqZ5FQpu9tN4mO3Cg3A2kqJfgu7uX822GyYYNo9JvDZjJz 6JVN6mF8zW4m8a95krBY959jji1or981S1VIn1uGOnvq1aJ58VLwtr9d2MNIQ/k6gJbs fFNWCW9ZEtoxN+71hkrz07cWEKdhifXdRVS/QYRojYXy7/stfTVT/8CHCRt/L6htJX8g K0as0xRGm/ajFmHbeGvhACS4PRdWsX0Mhr+a6DmJreZzz9nt8AMShYtp6kfrMopsZ1Km WaOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ZhDceGf5EPwxqOmSXw7vSwKwAN2oE3kPh5APLhrkFoc=; b=QpJXwinGur9eUC1U2plPm5tb1R5daehCqD4VYazwcVGO5L7L3jUwNAHd52M5OJW9tq 4PHOiDlxw+YNzkh2+agOKqAdXvhxYP4zfWD/mzwohyXPxE+VpNY8WKO9jqmITvFTFobv BHNrbm1GCOjNNSvSpgrJk2TluVMvOtmFkhW6x3RMWCZNqcsuSYMhRB4OoHr13Wfq65nJ f6s4iYKIRxPLx0eBPHAGu2NoO0TNZ2OHm9qajZXRU8XnpgwKiesCeqozkkj3bmCcxM/X mJ5b6WSKbeLEkuZcZRY7ih93b/JDyWtpPFN60LZRA0M8503seWIu7huRgrKuvxQYef3z tp/Q== X-Gm-Message-State: AOAM530xEf5+P9V1TT59Xqb1/JwZLrb/0CuTXlgyBsJ1E8ChgIfAkus2 DHezlv4CBXcZ4ysnC7dJTS2hFGHVY2aFheSeQGA= X-Google-Smtp-Source: ABdhPJwZWcSa7JQvBA9hqNB5lZjLdckzgvKVymMhVosuDluUt0M9JwkAjau2sBLidm357xNSn5TXDUV43T3H05sAiIo= X-Received: by 2002:a25:ab03:: with SMTP id u3mr15164570ybi.347.1616782181703; Fri, 26 Mar 2021 11:09:41 -0700 (PDT) MIME-Version: 1.0 References: <86028d25-c3fe-3765-f7c3-12448523405a@csgroup.eu> In-Reply-To: <86028d25-c3fe-3765-f7c3-12448523405a@csgroup.eu> From: Andrii Nakryiko Date: Fri, 26 Mar 2021 11:09:30 -0700 Message-ID: Subject: Re: [PATCH v2 0/8] Implement EBPF on powerpc32 To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin Lau , Song Liu , Yonghong Song , john fastabend , KP Singh , naveen.n.rao@linux.ibm.com, sandipan@linux.ibm.com, open list , linuxppc-dev@lists.ozlabs.org, Networking , bpf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 26, 2021 at 7:42 AM Christophe Leroy wrote: > > > > Le 22/03/2021 =C3=A0 18:53, Andrii Nakryiko a =C3=A9crit : > > On Mon, Mar 22, 2021 at 9:37 AM Christophe Leroy > > wrote: > >> > >> This series implements extended BPF on powerpc32. For the implementati= on > >> details, see the patch before the last. > >> > >> The following operations are not implemented: > >> > >> case BPF_ALU64 | BPF_DIV | BPF_X: /* dst /=3D src */ > >> case BPF_ALU64 | BPF_MOD | BPF_X: /* dst %=3D src */ > >> case BPF_STX | BPF_XADD | BPF_DW: /* *(u64 *)(dst + o= ff) +=3D src */ > >> > >> The following operations are only implemented for power of two constan= ts: > >> > >> case BPF_ALU64 | BPF_MOD | BPF_K: /* dst %=3D imm */ > >> case BPF_ALU64 | BPF_DIV | BPF_K: /* dst /=3D imm */ > >> > >> Below are the results on a powerpc 885: > >> - with the patch, with and without bpf_jit_enable > >> - without the patch, with bpf_jit_enable (ie with CBPF) > >> > >> With the patch, with bpf_jit_enable =3D 1 : > >> > >> [ 60.826529] test_bpf: Summary: 378 PASSED, 0 FAILED, [354/366 JIT'e= d] > >> [ 60.832505] test_bpf: test_skb_segment: Summary: 2 PASSED, 0 FAILED > >> > >> With the patch, with bpf_jit_enable =3D 0 : > >> > >> [ 75.186337] test_bpf: Summary: 378 PASSED, 0 FAILED, [0/366 JIT'ed] > >> [ 75.192325] test_bpf: test_skb_segment: Summary: 2 PASSED, 0 FAILED > >> > >> Without the patch, with bpf_jit_enable =3D 1 : > >> > >> [ 186.112429] test_bpf: Summary: 371 PASSED, 7 FAILED, [119/366 JIT'e= d] > >> > >> Couldn't run test_progs because it doesn't build (clang 11 crashes dur= ing the build). > > > > Can you please try checking out the latest clang from sources and use > > that one instead? > > The crash is fixed, it builds one step more, then fails at: > > [root@PC-server-ldb bpf]# make CROSS_COMPILE=3Dppc-linux- ARCH=3Dpowerpc = V=3D1 > /root/gen_ldb/linux-powerpc/tools/testing/selftests/bpf/host-tools/sbin/b= pftool gen skeleton > /root/gen_ldb/linux-powerpc/tools/testing/selftests/bpf/atomic_bounds.o > > /root/gen_ldb/linux-powerpc/tools/testing/selftests/bpf/atomic_bounds.ske= l.h > libbpf: elf: endianness mismatch in atomic_bounds. > Error: failed to open BPF object file: Endian mismatch > > I'm cross-building on x86 for powerpc/32 yeah, I'm not sure selftests/bpf supports cross-compiling. bpftool got some patches recently to enable cross-compiling, but probably not selftests/bpf. > > [root@PC-server-ldb bpf]# file atomic_bounds.o > atomic_bounds.o: ELF 64-bit MSB relocatable, eBPF, version 1 (SYSV), with= debug_info, not stripped > > Christophe 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=-0.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 22758C433C1 for ; Fri, 26 Mar 2021 18:10:21 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 326BB61A26 for ; Fri, 26 Mar 2021 18:10:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 326BB61A26 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4F6VPk2lVrz3c6J for ; Sat, 27 Mar 2021 05:10:18 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=rZ5aSSs1; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::b30; helo=mail-yb1-xb30.google.com; envelope-from=andrii.nakryiko@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=rZ5aSSs1; dkim-atps=neutral Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4F6VPB3s7Pz30CK for ; Sat, 27 Mar 2021 05:09:48 +1100 (AEDT) Received: by mail-yb1-xb30.google.com with SMTP id o66so6693049ybg.10 for ; Fri, 26 Mar 2021 11:09:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ZhDceGf5EPwxqOmSXw7vSwKwAN2oE3kPh5APLhrkFoc=; b=rZ5aSSs1FMJf5GOkwaIlzevMhDtIv7GWGcyp/tMZriePwT5YUyIaPyEGKp2gaPLE2l QJNagORWX24s9kDaMB8RWeFqZ5FQpu9tN4mO3Cg3A2kqJfgu7uX822GyYYNo9JvDZjJz 6JVN6mF8zW4m8a95krBY959jji1or981S1VIn1uGOnvq1aJ58VLwtr9d2MNIQ/k6gJbs fFNWCW9ZEtoxN+71hkrz07cWEKdhifXdRVS/QYRojYXy7/stfTVT/8CHCRt/L6htJX8g K0as0xRGm/ajFmHbeGvhACS4PRdWsX0Mhr+a6DmJreZzz9nt8AMShYtp6kfrMopsZ1Km WaOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ZhDceGf5EPwxqOmSXw7vSwKwAN2oE3kPh5APLhrkFoc=; b=XHmFbHEFUGzFF8wPx4zDDGx6/tRYPE0mziNoeEuLkZ2Q5GzSHf4sVts3Bqa/SBTv4K KaMsxYb6/1P7RVb5wAXdDcZ+ELxcW+HoxnhCiL7kFDWsLALx77BByhGO/bLBTB/7XxNq lUmyHaLFFAtHmypjE9/adMxTYh3DQFd1NnVNLhEXJZaHa+ePBTPBfYqRqPVBpImiJmlt u5N78RHai2lZdeSHQ7VoLPivT5GXNDvmofLTVO6F+OUFrxL5/uNYI7H3ge5GSZK2xY+x GRLXqmPBwhOUJxAistuZ1c1DOK62stNaA8cDd9MioU5rDWkA2gWXIfP/enXKefrPjX3B Ki7w== X-Gm-Message-State: AOAM530HE0+S1mGg2LdI94JiNNueyuvdM+lTpYzHQkC8YWQIZNARkcB4 O3/NH49f2nRD7t1HxWpUpGs3pytcB+QeEaYcIYo= X-Google-Smtp-Source: ABdhPJwZWcSa7JQvBA9hqNB5lZjLdckzgvKVymMhVosuDluUt0M9JwkAjau2sBLidm357xNSn5TXDUV43T3H05sAiIo= X-Received: by 2002:a25:ab03:: with SMTP id u3mr15164570ybi.347.1616782181703; Fri, 26 Mar 2021 11:09:41 -0700 (PDT) MIME-Version: 1.0 References: <86028d25-c3fe-3765-f7c3-12448523405a@csgroup.eu> In-Reply-To: <86028d25-c3fe-3765-f7c3-12448523405a@csgroup.eu> From: Andrii Nakryiko Date: Fri, 26 Mar 2021 11:09:30 -0700 Message-ID: Subject: Re: [PATCH v2 0/8] Implement EBPF on powerpc32 To: Christophe Leroy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Song Liu , Daniel Borkmann , john fastabend , Andrii Nakryiko , Alexei Starovoitov , naveen.n.rao@linux.ibm.com, Networking , Paul Mackerras , sandipan@linux.ibm.com, KP Singh , Yonghong Song , bpf , linuxppc-dev@lists.ozlabs.org, Martin Lau , open list Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, Mar 26, 2021 at 7:42 AM Christophe Leroy wrote: > > > > Le 22/03/2021 =C3=A0 18:53, Andrii Nakryiko a =C3=A9crit : > > On Mon, Mar 22, 2021 at 9:37 AM Christophe Leroy > > wrote: > >> > >> This series implements extended BPF on powerpc32. For the implementati= on > >> details, see the patch before the last. > >> > >> The following operations are not implemented: > >> > >> case BPF_ALU64 | BPF_DIV | BPF_X: /* dst /=3D src */ > >> case BPF_ALU64 | BPF_MOD | BPF_X: /* dst %=3D src */ > >> case BPF_STX | BPF_XADD | BPF_DW: /* *(u64 *)(dst + o= ff) +=3D src */ > >> > >> The following operations are only implemented for power of two constan= ts: > >> > >> case BPF_ALU64 | BPF_MOD | BPF_K: /* dst %=3D imm */ > >> case BPF_ALU64 | BPF_DIV | BPF_K: /* dst /=3D imm */ > >> > >> Below are the results on a powerpc 885: > >> - with the patch, with and without bpf_jit_enable > >> - without the patch, with bpf_jit_enable (ie with CBPF) > >> > >> With the patch, with bpf_jit_enable =3D 1 : > >> > >> [ 60.826529] test_bpf: Summary: 378 PASSED, 0 FAILED, [354/366 JIT'e= d] > >> [ 60.832505] test_bpf: test_skb_segment: Summary: 2 PASSED, 0 FAILED > >> > >> With the patch, with bpf_jit_enable =3D 0 : > >> > >> [ 75.186337] test_bpf: Summary: 378 PASSED, 0 FAILED, [0/366 JIT'ed] > >> [ 75.192325] test_bpf: test_skb_segment: Summary: 2 PASSED, 0 FAILED > >> > >> Without the patch, with bpf_jit_enable =3D 1 : > >> > >> [ 186.112429] test_bpf: Summary: 371 PASSED, 7 FAILED, [119/366 JIT'e= d] > >> > >> Couldn't run test_progs because it doesn't build (clang 11 crashes dur= ing the build). > > > > Can you please try checking out the latest clang from sources and use > > that one instead? > > The crash is fixed, it builds one step more, then fails at: > > [root@PC-server-ldb bpf]# make CROSS_COMPILE=3Dppc-linux- ARCH=3Dpowerpc = V=3D1 > /root/gen_ldb/linux-powerpc/tools/testing/selftests/bpf/host-tools/sbin/b= pftool gen skeleton > /root/gen_ldb/linux-powerpc/tools/testing/selftests/bpf/atomic_bounds.o > > /root/gen_ldb/linux-powerpc/tools/testing/selftests/bpf/atomic_bounds.ske= l.h > libbpf: elf: endianness mismatch in atomic_bounds. > Error: failed to open BPF object file: Endian mismatch > > I'm cross-building on x86 for powerpc/32 yeah, I'm not sure selftests/bpf supports cross-compiling. bpftool got some patches recently to enable cross-compiling, but probably not selftests/bpf. > > [root@PC-server-ldb bpf]# file atomic_bounds.o > atomic_bounds.o: ELF 64-bit MSB relocatable, eBPF, version 1 (SYSV), with= debug_info, not stripped > > Christophe