Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1613619pxb; Thu, 4 Feb 2021 18:37:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwd0Z7qlGYgPpLi8esskS9tIkX+lbbLVp/Kg1rQMvxEJyasr9ZBnIxsvXNHVbWHmdkRJ7jA X-Received: by 2002:a17:906:fca:: with SMTP id c10mr2021304ejk.272.1612492655961; Thu, 04 Feb 2021 18:37:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612492655; cv=none; d=google.com; s=arc-20160816; b=JBpZDVoLkPlQdshM2ckWI5COq/bmyXj7YrZRz9l2KRgspFWqFzScnMoPQnu/+5+skg gls5h5Y6b+T5FMcuHoHbjA3j2725k5ycu+t+4DquVJMvG08Z4d7LCgPlnV2TIH1aVWLf AiwbqIe3H4MLHyNC3y7VtfCYPXKIDaRz8Dx3mZaQtjkvuq7BGYwQP/p8jju79JMJIs7+ TTVfddqpEVCtEtp+a2aGjEWrk5CBMmxpW916ZSb3NVSPTBavD/bzX0Q7hgGt4kByIzR3 YOtI27tWlxOR2kS6/ALrcvzD7pdMhb0ZdH7lEPfzqXBja7mxtjLOkOzg8siqEs4fwPYI VZtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oh1ncce3nSrKC6/DBk1RSRzmFi096ER7UQuf4BEJPSs=; b=KzdA6/36b746lCi95fCC/f1rmxHun0gvXHhBpG4FpA4RocmUcegpOYJAWXAclVWJfe JzZq6j4GGbc5ZWuUEyBjD4BtiXSkXeyojOsECzGIW/PA2zLYwLW9Wop0ynkYcBHXgfZ4 elRIZ4RYzj4NFs20Ur4qgHfkDEN4Q40U5of/IOSCVJGhCrz+SCLUc18Wfct9COJ87Lme avQHeURNetUbGeCUt1lQKtw7UU1B+ajZOCDI4TGgqVVx/Fk/90Xh9ux58sCZ0QW+EgYY x42a6sTdQ3NMNVrESsO4zfsfe7xtOIqn2wkZn/32rFEcEnXi/VqaKcmbtSHoEBGfZGKQ xAzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=STelQC2T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r21si4955883ejo.415.2021.02.04.18.37.11; Thu, 04 Feb 2021 18:37:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=STelQC2T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231139AbhBDXqm (ORCPT + 99 others); Thu, 4 Feb 2021 18:46:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231131AbhBDXqh (ORCPT ); Thu, 4 Feb 2021 18:46:37 -0500 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ADFAC061786; Thu, 4 Feb 2021 15:45:57 -0800 (PST) Received: by mail-yb1-xb33.google.com with SMTP id j84so5012053ybg.1; Thu, 04 Feb 2021 15:45:57 -0800 (PST) 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=oh1ncce3nSrKC6/DBk1RSRzmFi096ER7UQuf4BEJPSs=; b=STelQC2T1O3MtdVzjPN0nriGbjh3qVqu5OuB33OM/E3eGSv0/IXM5PKRRkeFaKZ+45 yG39m+bNwuCuQLMM6T20/qB2x/TPxi/8hu90Zp1JOTjpE+ao1afqmTYDWHH4bt1P8Xnj RqLY3cEso7ZFXSWIhNHZutnteQ07RzkbdQDwUp4LZaCxOlygW7D0+zli085qwLhLgir+ qF4KtwcIrXJSWBs2cv2LbXVoAGGu1An1dZkPKtCOj2gEX2RhWbnDESTKabRW+3mlTajW SEArgvVa26IkrHUgB/tTBbHE7ag2pGc9GG62BOSUk9Scw/YUzKWIlElYfu6MsZxEo1fT ZOmA== 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=oh1ncce3nSrKC6/DBk1RSRzmFi096ER7UQuf4BEJPSs=; b=MbdjYCSimkxLjQUkSyOJeCBGGyyX7ZK8+ZjnfRdE+9bIphEbai5T8Kvs2NGNkxpRly CT6V3n8xLRYucsFn1mHu6UfNbh0pUlTFAQ3zZ3/Urj5cfTTLU11hF0XA4N5DihCUsXED t2gV949vrHbBgOkjS7SCW0h6ncEx8Opk2/CZgmZXWtzgN3IiCcIokutXtDw4Oh3l5ABi ydFxZmKe3SFzp8gRC0dQhfKoeUC8yOjd0lFpdx3X6iJQXkztXFZqSn9NB8jtc7nnim0J t1qLbaJGRohTnXiRX16nOjuJj9m3NpDGwVY0PrdmAGSdXKWyF0WJyO/BF1aB85H60BVa A5/Q== X-Gm-Message-State: AOAM530kTUWuKrs88KhBSV/e4oPcW1PeTZ3fWhqcNTroQaLTKiDiLq9u 5pIgrZMBxGtiFlOFJsO5aEB4o5KHIQPtLHsS3wwpTQVZs6PRbw== X-Received: by 2002:a25:a183:: with SMTP id a3mr2394636ybi.459.1612482356445; Thu, 04 Feb 2021 15:45:56 -0800 (PST) MIME-Version: 1.0 References: <1612438753-30133-1-git-send-email-yangtiezhu@loongson.cn> In-Reply-To: From: Andrii Nakryiko Date: Thu, 4 Feb 2021 15:45:45 -0800 Message-ID: Subject: Re: [PATCH bpf-next] samples/bpf: Add hello world sample for newbies To: Song Liu Cc: Tiezhu Yang , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Networking , bpf , open list , Xuefeng Li Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 4, 2021 at 11:27 AM Song Liu wrote: > > On Thu, Feb 4, 2021 at 3:42 AM Tiezhu Yang wrote: > > > > The program is made in a way that everytime an execve syscall > > is executed it prints Hello, BPF World! > > > > This is inspired and based on the code example for the book > > Linux Observability with BPF [1], load_bpf_file() has been > > removed after commit ceb5dea56543 ("samples: bpf: Remove > > bpf_load loader completely"), so the old version can not > > work in the latest mainline kernel. > > > > Since it is very simple and useful for newbies, I think it is > > necessary to be upstreamed. > > I wonder how much value we will get from this sample. If the user is > able to compile and try the hello world, they are sure able to compile > other code in samples/bpf. Also, this code doesn't use BPF skeleton, > which is the recommended way to write BPF programs. Maybe an > minimal example with BPF skeleton will add more value here? > I agree with Song. Plus, we already have similar simple examples that are set up outside of kernel build infrastructure, which is simpler for newbies to pick up. Please check [0]: [0] https://github.com/libbpf/libbpf-bootstrap/tree/master/src > Thanks, > Song > > > > > > > [1] https://github.com/bpftools/linux-observability-with-bpf/tree/master/code/chapter-2/hello_world > > > > Signed-off-by: Tiezhu Yang > > --- > > samples/bpf/Makefile | 3 +++ > > samples/bpf/hello_kern.c | 14 ++++++++++++++ > > samples/bpf/hello_user.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 59 insertions(+) > > create mode 100644 samples/bpf/hello_kern.c > > create mode 100644 samples/bpf/hello_user.c > > [...]