Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1560426ybm; Tue, 21 May 2019 16:36:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxJoaLwLzA/+bepZcrdU9h5vfmaptQ8bB14LgqT0JXsXkFnpCvqt10KMZuI+fuw2PlV/Ne X-Received: by 2002:a65:4105:: with SMTP id w5mr86815454pgp.260.1558481766521; Tue, 21 May 2019 16:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558481766; cv=none; d=google.com; s=arc-20160816; b=E4PpYfloys7enHZLOV5DXfdt/eqoKOuw2KGtjLMPiD3RNSZcwn7keDsXGMmS986swR tYzk50Fa6l7TrWSmlF1DlVt54mlLWpE0cYYNFxkanHNxcNP5tX7aRZQiTgCLziQnT1LD V6Ak2kP20FKxSVjJLiF2L/mJwyVWB2rP7BOlaiZxjk1wF9iScGq+M4bb/OmwRP/nNqqm S6YJPWC4F7ccdOhpH5+sQgviR6ejx0X7SQbdI1EfLvh5tlnY7YgStLnnVSV+fb33xQiQ qFiY0FyBbTRVIt7IJ1iW1pfJ4CdSwJR1j+gOFz2M+cZDZfLnpPctxfmAB1sqItLl8pd+ fqyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=LA1sb/anQ2K72pMgn+Br6ty4pzvhOteTIdKJZozXi5U=; b=J9DjZ2t/5MnaJ+i+Vx7n2mbv4DfrujuCochye+B1jZP5SNqFobaaC3vdF9ndGYiV9f HIcf1uc7k7z/XA4PCEsXoK0y83IwtDfIyPSaWjnW15k0tRzab0cDKDDFzFP7REUkErOv 7RfTpuuMpRcZFJaYA5RxGl9hWPKnj+vkFbsQ10r+dYR/0P2WgSgh6/f3OvarsZGiDNdz ZZD5Nq9J8EZynSKwmF4ruuM+UqhArHN66aC1JLIuEzEwxlM2YHeN8xkUctvQdGU1VCZ0 r0GDNU2ZKYo1h0KaHV2yflNhS1PpWPXL1dA6jI95J5BMcg0UGTyBc++bnzQ26CPnYMV7 Y6zQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si27423053pfp.40.2019.05.21.16.35.50; Tue, 21 May 2019 16:36:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728183AbfEUXdh convert rfc822-to-8bit (ORCPT + 99 others); Tue, 21 May 2019 19:33:37 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:36699 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727453AbfEUXdg (ORCPT ); Tue, 21 May 2019 19:33:36 -0400 Received: by mail-lf1-f67.google.com with SMTP id y10so235629lfl.3 for ; Tue, 21 May 2019 16:33:34 -0700 (PDT) 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=EWNs7FuLz+EBZGJHO+hMowOuxfAj3IDqhoBMiSjNTxE=; b=TrsL/8bmAQxXEQIFKRjdnxzYbsGgMDahop6IsQ9gHNdvXSSxAIbR1LDE6uFjlhNPt2 FofgUGDRdchaC7EY+/6LF9BkQNnCCFmVyyqiJEkYivlZMvWxdVq9ghwA2vLuLBNlkIIe M3tAXwMC/jOm/zkAl7sYmHPzJOwluHUqUDd0k37quK7aXVpP6NjNsc5vyRKOEuNQAplk KHUQsVEU4rfVWHFp04ucGk7xxWfMfZd4MFj8NtW5bAeuA4g+ianLiY5rhm2CW4iUSJpR +9fyb2sSaZlhx1yq4r0KvKcatxOAbu2S/yItFf3QjZ3fxC8w7/XAH+iVRhUwfRmX5Rtx 5I2A== X-Gm-Message-State: APjAAAXAAs1ItMfsICDWShyS0/I2Ln0akugX4tkZ6RVeWxT8vHEW+4a4 NdzunkvQa0WS6ljDJWM+F20iuQns26bA8tqIJR7AWQ== X-Received: by 2002:a19:a50b:: with SMTP id o11mr28367269lfe.2.1558481613710; Tue, 21 May 2019 16:33:33 -0700 (PDT) MIME-Version: 1.0 References: <20190518004639.20648-1-mcroce@redhat.com> <20190520133830.1ac11fc8@cakuba.netronome.com> <20190521100648.1ce9b5be@cakuba.netronome.com> In-Reply-To: <20190521100648.1ce9b5be@cakuba.netronome.com> From: Matteo Croce Date: Wed, 22 May 2019 01:32:57 +0200 Message-ID: Subject: Re: [PATCH 1/5] samples/bpf: fix test_lru_dist build To: Jakub Kicinski Cc: Daniel Borkmann , xdp-newbies@vger.kernel.org, bpf@vger.kernel.org, LKML , netdev , Alexei Starovoitov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 21, 2019 at 7:07 PM Jakub Kicinski wrote: > > On Tue, 21 May 2019 17:36:17 +0200, Matteo Croce wrote: > > On Tue, May 21, 2019 at 5:21 PM Daniel Borkmann wrote: > > > > > > On 05/20/2019 10:38 PM, Jakub Kicinski wrote: > > > > On Mon, 20 May 2019 19:46:27 +0200, Matteo Croce wrote: > > > >> On Sat, May 18, 2019 at 2:46 AM Matteo Croce wrote: > > > >>> > > > >>> Fix the following error by removing a duplicate struct definition: > > > >> > > > >> Hi all, > > > >> > > > >> I forget to send a cover letter for this series, but basically what I > > > >> wanted to say is that while patches 1-3 are very straightforward, > > > >> patches 4-5 are a bit rough and I accept suggstions to make a cleaner > > > >> work. > > > > > > > > samples depend on headers being locally installed: > > > > > > > > make headers_install > > > > > > > > Are you intending to change that? > > > > > > +1, Matteo, could you elaborate? > > > > > > On latest bpf tree, everything compiles just fine: > > > > > > [root@linux bpf]# make headers_install > > > [root@linux bpf]# make -C samples/bpf/ > > > make: Entering directory '/home/darkstar/trees/bpf/samples/bpf' > > > make -C ../../ /home/darkstar/trees/bpf/samples/bpf/ BPF_SAMPLES_PATH=/home/darkstar/trees/bpf/samples/bpf > > > make[1]: Entering directory '/home/darkstar/trees/bpf' > > > CALL scripts/checksyscalls.sh > > > CALL scripts/atomic/check-atomics.sh > > > DESCEND objtool > > > make -C /home/darkstar/trees/bpf/samples/bpf/../../tools/lib/bpf/ RM='rm -rf' LDFLAGS= srctree=/home/darkstar/trees/bpf/samples/bpf/../../ O= > > > HOSTCC /home/darkstar/trees/bpf/samples/bpf/test_lru_dist > > > HOSTCC /home/darkstar/trees/bpf/samples/bpf/sock_example > > > > > > > Hi all, > > > > I have kernel-headers installed from master, but yet the samples fail to build: > > > > matteo@turbo:~/src/linux/samples/bpf$ rpm -q kernel-headers > > kernel-headers-5.2.0_rc1-38.x86_64 > > > > matteo@turbo:~/src/linux/samples/bpf$ git describe HEAD > > v5.2-rc1-97-g5bdd9ad875b6 > > > > matteo@turbo:~/src/linux/samples/bpf$ make > > make -C ../../ /home/matteo/src/linux/samples/bpf/ > > BPF_SAMPLES_PATH=/home/matteo/src/linux/samples/bpf > > make[1]: Entering directory '/home/matteo/src/linux' > > CALL scripts/checksyscalls.sh > > CALL scripts/atomic/check-atomics.sh > > DESCEND objtool > > make -C /home/matteo/src/linux/samples/bpf/../../tools/lib/bpf/ RM='rm > > -rf' LDFLAGS= srctree=/home/matteo/src/linux/samples/bpf/../../ O= > > HOSTCC /home/matteo/src/linux/samples/bpf/test_lru_dist > > /home/matteo/src/linux/samples/bpf/test_lru_dist.c:39:8: error: > > redefinition of ‘struct list_head’ > > 39 | struct list_head { > > | ^~~~~~~~~ > > In file included from /home/matteo/src/linux/samples/bpf/test_lru_dist.c:9: > > ./tools/include/linux/types.h:69:8: note: originally defined here > > 69 | struct list_head { > > | ^~~~~~~~~ > > make[2]: *** [scripts/Makefile.host:90: > > /home/matteo/src/linux/samples/bpf/test_lru_dist] Error 1 > > make[1]: *** [Makefile:1762: /home/matteo/src/linux/samples/bpf/] Error 2 > > make[1]: Leaving directory '/home/matteo/src/linux' > > make: *** [Makefile:231: all] Error 2 > > > > Am I missing something obvious? > > Yes ;) Samples use a local installation of headers in $objtree/usr (I > think, maybe $srctree/usr). So you need to do make headers_install in > your kernel source tree, otherwise the include path from tools/ takes > priority over your global /usr/include and causes these issues. I had > this path in my tree for some time, but I don't like enough to post it: > > commit 35fb614049e93d46af708c0eaae6601df54017b3 > Author: Jakub Kicinski > Date: Mon Dec 3 15:00:24 2018 -0800 > > bpf: maybe warn ppl about hrds_install > > Signed-off-by: Jakub Kicinski > > diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile > index 4f0a1cdbfe7c..f79a4ed2f9f7 100644 > --- a/samples/bpf/Makefile > +++ b/samples/bpf/Makefile > @@ -208,6 +208,15 @@ HOSTCC = $(CROSS_COMPILE)gcc > CLANG_ARCH_ARGS = -target $(ARCH) > endif > > +HDR_PROBE := $(shell echo "\#include \n struct list_head { int a; }; int main() { return 0; }" | \ > + gcc $(KBUILD_HOSTCFLAGS) -x c - -o /dev/null 2>/dev/null && \ > + echo okay) > + > +ifeq ($(HDR_PROBE),) > +$(warning Detected possible issues with include path.) > +$(warning Please install kernel headers locally (make headers_install)) > +endif > + > BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -mattr=help 2>&1 | grep dwarfris) > BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF) > BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usage.*llvm') Hi Jakub, I see now, It worked, thanks. This is a bit error prone IMHO, if you ever think about sending this patch, consider it ACKed by me. Thanks, -- Matteo Croce per aspera ad upstream