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=-6.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 DD48BC48BE4 for ; Thu, 27 Jun 2019 17:48:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB94520644 for ; Thu, 27 Jun 2019 17:48:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LIO1JaSO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726722AbfF0RsK (ORCPT ); Thu, 27 Jun 2019 13:48:10 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:41172 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726557AbfF0RsK (ORCPT ); Thu, 27 Jun 2019 13:48:10 -0400 Received: by mail-qt1-f196.google.com with SMTP id d17so3381805qtj.8; Thu, 27 Jun 2019 10:48:09 -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; bh=8KacmKH3cAO5KqfGKUf465nKcuX4PFadp3LJhvSKwIs=; b=LIO1JaSOWhbmy1kvAJwKb4R99OykBWxYGbpMlusudxd3jz9ynRFJi2xKxYX1hbCTjv e3Mk8R8bq/s5ikWyb3YrBBZ5wbNtBbwQQkFZA8NebJP6oGBklu76Y8oh0h720MQV1yxB LNy5bHOaNng0sfiI81c13SOM6lqoJ8VhwDOYNG15+C1CDtF0bPo75rbbta8G/uH9UliB VQJMUZO29r6nykWsXNNqRpn3vHECq3Oqp+ku/KF4TE9ub6xE6C+vk5Nht8uPGREGZI8x HcFsrC2p5Zm4urqi17Ry+Yr6bPbqa8C6A2JaR3M7BvKH3m9pFNM+okdx98ImXAJm3ZO4 zIGA== 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; bh=8KacmKH3cAO5KqfGKUf465nKcuX4PFadp3LJhvSKwIs=; b=FX2dVZSOAwNgplMSw/+Idq1yj/A5+6ylslBCsAYX4E6bZwLuGNXZcSxE7ujLTcAGF/ SgePFW4NxEb7LzMjcQLAZnS2M3zWPxt2Lc+KEBuAXZnSKuN4xw1cWOhX4qplN2wHIlkD wE3azyu1Inp1cs4Lt0ClF9wsh2Hsnpz6qS2qE5y9jzSiPF5xI+qRF2hAG4gvoGsZFEmz kBvjqJrdyKBTf3jsTWdnWsxrFZ/CDm/JhvxEjgH/A5S1HZ9FL4LuTdivthx7cwwccWOT 4YMf4BO9v/ElZijPxGrbk2j+KlrNV+I/g3cb0ED8KP+EIQ/TWLrOFt4tyzFZweTjKakc ELUg== X-Gm-Message-State: APjAAAUi8Td5BJDPlpS6SPT9ny2kJ2uMt/Cd6nL/G6c0NU+5/LExO5hI ecLlOwTBpoOk7dFPE2BPSeBMcB9IaXTaslfkhXU= X-Google-Smtp-Source: APXvYqw2tJRG6DqVL95VyMi07GDvSgvk/Wbctb69x3VIWEQHo79Ah6mpijT7SNu/YAxiv8yR98Kkuf+KgI75ufYVmvQ= X-Received: by 2002:ac8:2d56:: with SMTP id o22mr4245279qta.171.1561657689407; Thu, 27 Jun 2019 10:48:09 -0700 (PDT) MIME-Version: 1.0 References: <20190626232133.3800637-1-andriin@fb.com> <20190626232133.3800637-2-andriin@fb.com> In-Reply-To: From: Andrii Nakryiko Date: Thu, 27 Jun 2019 10:47:58 -0700 Message-ID: Subject: Re: [PATCH bpf-next 1/3] libbpf: capture value in BTF type info for BTF-defined map defs To: Song Liu Cc: Andrii Nakryiko , Alexei Starovoitov , "daniel@iogearbox.net" , Kernel Team , "bpf@vger.kernel.org" , "netdev@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Jun 27, 2019 at 10:27 AM Song Liu wrote: > > > > > On Jun 26, 2019, at 4:21 PM, Andrii Nakryiko wrote: > > > > Change BTF-defined map definitions to capture compile-time integer > > values as part of BTF type definition, to avoid split of key/value type > > information and actual type/size/flags initialization for maps. > > If I have an old bpf program and compiled it with new llvm, will it > work with new libbpf? You mean BPF programs that used previous incarnation of BTF-defined maps? No, they won't work. But we never released them, so I think it's ok to change them. Nothing should be using that except for selftests, which I fixed. > > > > > > Signed-off-by: Andrii Nakryiko > > --- > > diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h > > index 1a5b1accf091..aa5ddf58c088 100644 > > --- a/tools/testing/selftests/bpf/bpf_helpers.h > > +++ b/tools/testing/selftests/bpf/bpf_helpers.h > > @@ -8,6 +8,9 @@ > > */ > > #define SEC(NAME) __attribute__((section(NAME), used)) > > > > +#define __int(name, val) int (*name)[val] > > +#define __type(name, val) val *name > > + > > I think we need these two in libbpf. Yes, but it's another story for another set of patches. We'll need to provide bpf_helpers as part of libbpf for inclusion into BPF programs, but there are a bunch of problems right now with existing bpf_heplers.h that prevents us from just copying it into libbpf. We'll need to resolve those first. But then again, there is no use of __int and __type for user-space programs, so for now it's ok. > > Thanks, > Song > > > /* helper macro to print out debug messages */ > > #define bpf_printk(fmt, ...) \ > > ({ \ > > -- > > 2.17.1 > > >