Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1202169ybm; Tue, 21 May 2019 10:09:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwycnG6syMqYFPWz1GXs4GKv/crSOczNLZdJgCIbOUKN5TlZFwUiQBtosaUoAV765sF5faT X-Received: by 2002:a62:38cc:: with SMTP id f195mr88699817pfa.15.1558458548139; Tue, 21 May 2019 10:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558458548; cv=none; d=google.com; s=arc-20160816; b=ZMaP/wCm0IkM78uwbXl2FE9+iVYzEd6Ek+MJzNbluggudsquX2kASAAB5peTuvC0HH JLpZAzEt2N2U314E9NHqYdrhC5fvQZMsaXS5UJO6+SGpvV9DSIdMdgvY4q9uSu0BxpoG uSgc4aB84si+VuYWtiOKMhXq7uHPQYwMgDDmwpt7B14CBRPYi77iOGSiF/8btUp7nF35 RFTIo2npQHpOcz8JOBjp+zeSfyJ9RGYrH9WTMKXeyr3MPoJ469tipKpWAu4WUlzZI+Um eVpnLQaQJyeY1BeBMq2tPGR9g8TOVB27WAlxHF9nzv2nLJ2GdhLN9BzC9agV8NcxPi2d OaGA== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=9uPTbP2BF+UpteaL2KhM3aAj7QjRcnMmKHeI6Yh9EPI=; b=wpjTzA0QbE8w9gJkNN4jhrsUFQCouClHXooL29RzfcAXYnKYQYtvC6/MyOZwvqPDam ISwtPX9zDS6dIRFcwWRa7KJU6U15bM9zt8B7ob9n5Kon0Mm+6YDOKTBkxPKr1kRFSOAh okkPP3xeU86ZlGgkJ3s9cHVtbfK9uW9EEOERCi2ToTuw1646jLsLOaA3H9I1PHZi/neR fyUBrM4WOyrZVctRVoJk0zGuKQats5WGulm+LVwatFFa/ub0zCiH8CT65iqxAoHC1lcS VokyjSqfJsZdEhiKjo7PpnchB/F65DMKymDDshqUHlhM6Tl/hJKHPViYyqRQOHlQrGNb IPGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=iDZLE7yN; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24si20193478pgw.395.2019.05.21.10.08.50; Tue, 21 May 2019 10:09:08 -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; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=iDZLE7yN; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729080AbfEURH0 (ORCPT + 99 others); Tue, 21 May 2019 13:07:26 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:36583 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728980AbfEURH0 (ORCPT ); Tue, 21 May 2019 13:07:26 -0400 Received: by mail-qt1-f196.google.com with SMTP id a17so21417444qth.3 for ; Tue, 21 May 2019 10:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=9uPTbP2BF+UpteaL2KhM3aAj7QjRcnMmKHeI6Yh9EPI=; b=iDZLE7yNQ4lDtD0XYGkkl4K2STILfN2iFJ4sfOJWHZcNwYcoj01MXQAuZDOz8ypaRK gQ2al+DExF3ndweDKlzGJ6S8sh3a4I1jE9yZebCzr/OaHgirNisBjWSFzzZ0aN37o2PE bQq5ubtJDozzrq4fm4E7hHtO8mLFyoaA8Qex24dH+DQ36QAkCCXKVyOKiuGyL+WEUoit I0O7bjcNirgWpLwqrE3kiuzk0lVusS/1S4J8ZocRTyM1V2+Hm8DaSmHQcZFgHDmya+Bv hRISJqciG/x9jHFQJfYLXz+UjXrCfL/2L4BytVMEOGs4abeYw5KrgDt4gbfB+1SGo49B /xHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=9uPTbP2BF+UpteaL2KhM3aAj7QjRcnMmKHeI6Yh9EPI=; b=jnUfe7D/Ihzg66W6OJWrQPgX89zeQ2exVuigKyTMIzjR8K7rpGaSUuV61QWix9fYYi jk2NiGtkYHnKlsTDfRlCfknre+JR0e7c/Sz260vKG43TvUWR/gaanJ4WkfGRc43IXNmi KLZkzeif4BKYXNXNI473jscH6G6x/P0npRd8yAz1ePp9TQ+gGFovmSPNEqUSJzfi9BX1 ap4Nyxxe3bRfWyCOIav9v4/6zP3MGFavoMZjqq8iofSkZ56PTYRKdVlO4x67COr7xp7h 7FOjl6MyhVkEsnxt0GEwhN9b1FS4VFgzO2KQgB9fXZ6YOFFMb0Bs7SerXR9h1Ku0F07w ghvQ== X-Gm-Message-State: APjAAAXkc+z5peT7l6zmTqksuTFUxgsBa0EFY5MC7D/XvtBSejS8VmCP kYylNqIEtgRoo47JQU822R9n4Q== X-Received: by 2002:ac8:1671:: with SMTP id x46mr47261518qtk.240.1558458444792; Tue, 21 May 2019 10:07:24 -0700 (PDT) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id l127sm9247563qkc.81.2019.05.21.10.07.23 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 21 May 2019 10:07:24 -0700 (PDT) Date: Tue, 21 May 2019 10:06:48 -0700 From: Jakub Kicinski To: Matteo Croce Cc: Daniel Borkmann , xdp-newbies@vger.kernel.org, bpf@vger.kernel.org, LKML , netdev , Alexei Starovoitov Subject: Re: [PATCH 1/5] samples/bpf: fix test_lru_dist build Message-ID: <20190521100648.1ce9b5be@cakuba.netronome.com> In-Reply-To: References: <20190518004639.20648-1-mcroce@redhat.com> <20190520133830.1ac11fc8@cakuba.netronome.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 21 May 2019 17:36:17 +0200, Matteo Croce wrote: > On Tue, May 21, 2019 at 5:21 PM Daniel Borkmann wr= ote: > > > > On 05/20/2019 10:38 PM, Jakub Kicinski wrote: =20 > > > On Mon, 20 May 2019 19:46:27 +0200, Matteo Croce wrote: =20 > > >> On Sat, May 18, 2019 at 2:46 AM Matteo Croce wro= te: =20 > > >>> > > >>> Fix the following error by removing a duplicate struct definition: = =20 > > >> > > >> 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. =20 > > > > > > samples depend on headers being locally installed: > > > > > > make headers_install > > > > > > Are you intending to change that? =20 > > > > +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= =3D/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=3D= 'rm -rf' LDFLAGS=3D srctree=3D/home/darkstar/trees/bpf/samples/bpf/../../ O= =3D > > HOSTCC /home/darkstar/trees/bpf/samples/bpf/test_lru_dist > > HOSTCC /home/darkstar/trees/bpf/samples/bpf/sock_example > > =20 >=20 > Hi all, >=20 > I have kernel-headers installed from master, but yet the samples fail to = build: >=20 > matteo@turbo:~/src/linux/samples/bpf$ rpm -q kernel-headers > kernel-headers-5.2.0_rc1-38.x86_64 >=20 > matteo@turbo:~/src/linux/samples/bpf$ git describe HEAD > v5.2-rc1-97-g5bdd9ad875b6 >=20 > matteo@turbo:~/src/linux/samples/bpf$ make > make -C ../../ /home/matteo/src/linux/samples/bpf/ > BPF_SAMPLES_PATH=3D/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=3D'rm > -rf' LDFLAGS=3D srctree=3D/home/matteo/src/linux/samples/bpf/../../ O=3D > 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 =E2=80=98struct list_head=E2=80=99 > 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 >=20 > 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 =20 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 =3D $(CROSS_COMPILE)gcc CLANG_ARCH_ARGS =3D -target $(ARCH) endif =20 +HDR_PROBE :=3D $(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 :=3D $(shell $(LLC) -march=3Dbpf -mattr=3Dhelp 2>&1 | grep d= warfris) BTF_PAHOLE_PROBE :=3D $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF) BTF_OBJCOPY_PROBE :=3D $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usag= e.*llvm')