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=-8.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 7B6A9CA9EC1 for ; Mon, 28 Oct 2019 16:13:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 502C9208C0 for ; Mon, 28 Oct 2019 16:13:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HsnUcr7S" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390824AbfJ1QNX (ORCPT ); Mon, 28 Oct 2019 12:13:23 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:38149 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729832AbfJ1QNW (ORCPT ); Mon, 28 Oct 2019 12:13:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572279201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DFiblGAKSFgYEKWTph3vJ5WK7UUGnBjGo40Q9X49580=; b=HsnUcr7SRU523bBP2FFZPH32QniKI+tOTIPyivbD8msqb0jeeNsSsWxaOYL0K12wuovyfd XJnOt21mBgC075NCmCCoSn3YnbyNMVBlMHAeTGbTnn3QodwjMpOa3KJTGCY5XP0B49MJ/w qYrcB+ziW721bMtc7s71HRtKoRb3AS4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-243-BCnI5LkbOV28b2LVSkNTTg-1; Mon, 28 Oct 2019 12:13:18 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 980F1107AD28; Mon, 28 Oct 2019 16:13:16 +0000 (UTC) Received: from carbon (ovpn-200-19.brq.redhat.com [10.40.200.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FD5B5DA5B; Mon, 28 Oct 2019 16:13:04 +0000 (UTC) Date: Mon, 28 Oct 2019 17:13:03 +0100 From: Jesper Dangaard Brouer To: Yonghong Song Cc: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= , Daniel Borkmann , Alexei Starovoitov , Martin Lau , Song Liu , Andrii Nakryiko , "David Miller" , "netdev@vger.kernel.org" , "bpf@vger.kernel.org" , brouer@redhat.com, Anton Protopopov Subject: Re: [PATCH bpf-next v3 4/4] selftests: Add tests for automatic map pinning Message-ID: <20191028171303.3e7e4601@carbon> In-Reply-To: <483546c6-14b9-e1f1-b4c1-424d6b8d4ace@fb.com> References: <157220959547.48922.6623938299823744715.stgit@toke.dk> <157220959980.48922.12100884213362040360.stgit@toke.dk> <20191028140624.584bcc1e@carbon> <87imo9roxf.fsf@toke.dk> <483546c6-14b9-e1f1-b4c1-424d6b8d4ace@fb.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: BCnI5LkbOV28b2LVSkNTTg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Mon, 28 Oct 2019 15:32:26 +0000 Yonghong Song wrote: > On 10/28/19 6:15 AM, Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > Jesper Dangaard Brouer writes: > > =20 > >> On Sun, 27 Oct 2019 21:53:19 +0100 > >> Toke H=C3=B8iland-J=C3=B8rgensen wrote: > >> =20 > >>> diff --git a/tools/testing/selftests/bpf/progs/test_pinning.c b/tools= /testing/selftests/bpf/progs/test_pinning.c > >>> new file mode 100644 > >>> index 000000000000..ff2d7447777e > >>> --- /dev/null > >>> +++ b/tools/testing/selftests/bpf/progs/test_pinning.c > >>> @@ -0,0 +1,29 @@ > >>> +// SPDX-License-Identifier: GPL-2.0 > >>> + > >>> +#include > >>> +#include "bpf_helpers.h" > >>> + > >>> +int _version SEC("version") =3D 1; > >>> + > >>> +struct { > >>> +=09__uint(type, BPF_MAP_TYPE_ARRAY); > >>> +=09__uint(max_entries, 1); > >>> +=09__type(key, __u32); > >>> +=09__type(value, __u64); > >>> +=09__uint(pinning, LIBBPF_PIN_BY_NAME); > >>> +} pinmap SEC(".maps"); =20 > >> > >> So, this is the new BTF-defined maps syntax. > >> > >> Please remind me, what version of LLVM do we need to compile this? =20 > >=20 > > No idea what the minimum version is. I'm running LLVM 9.0 :) =20 >=20 > LLVM 9.0 starts to support .maps. > There is no dependency on pahole. LLVM 9.0.0 is still very new: - 19 September 2019: LLVM 9.0.0 is now available For my XDP-tutorial[1], I cannot required people to have this new llvm version. But I would like to teach people about this new syntax (note, I can upgrade libbpf version via git-submodule, and update bpf_helpers.h). To Andrii, any recommendations on how I can do the transition?=20 I'm thinking, it should be possible to define both ELF-object sections SEC "maps" and ".maps" at the same time. But how does libbpf handle that? (Who takes precedence?) (Alternatively, I can detect the LLVM version, in the Makefile, and have a #ifdef define in the code) --=20 Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer [1] https://github.com/xdp-project/xdp-tutorial