Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3600924pxb; Mon, 24 Jan 2022 13:14:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwA4VuLi1kju1m7WByos11ZiexUBNUBf4Uy7dcPPlHcjg4q1h2zK3t+CMuiNJHa/yBw8WwI X-Received: by 2002:a62:b503:0:b0:4bc:657e:cfa6 with SMTP id y3-20020a62b503000000b004bc657ecfa6mr15259067pfe.25.1643058862788; Mon, 24 Jan 2022 13:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643058862; cv=none; d=google.com; s=arc-20160816; b=GjL/IMRKgbnnCa86EsfUBvk3oWwVXrhwY6wLHJGkxDZkyV5DGiknC6D41f0yUZDe+u Hj03JtkNIhjRVccAT0d3dXR0hlGhaDqfwWk7lc9ReeS/bTNbmecfH7jK2Cc+gqKRr5Bs XtQTj/lidRrEW82hXFRhRyI9k0EFgJ5e/p2WM+0jUHXiSJtRsdlE7Js3BVlIiKkPy/Ru rpnE5Oxxbs7X8dmOxeHHkR1Boeao3ofRKSBbVPWICc/o6tRgBjpo4E/9OoGPfo7q0oAN l4rr7pBUq4nK2GAzeX06llbmnCyECIOGo7Cd0yOylUJ2UghGw6MOXO6oe4hmBD5mFrhn 8S2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=P5dgoXDa83mdZS5tebAUCwjvHJG/IMieeIhiu0O5gio=; b=gn3Zh34WgC70QlZN00lIs9Bg4kWrfgzfX3i3cURpAr5lTgYEllGLG6nOFNVs7QhtWQ PToVafsIQNJn44d12rF5aaknADfgL5OaDMR1pwL9DEXN+rv4wzTo1Pxp8AFaa3dHfitv YzY4UIVLL0O/rI+ZKKdAhGVkJtsS15h6ICtsFxCME45JOUFJA/yknvQNgFdwg3XygPVD MawDil6FSYBuvc8ODoou4JHvmfP/0V/yP3Kdm4WQYifMdfa/tgvPPztxyM8b9UhF704A P6A7yQG+y/Zh7ltsWE+1ApESH9iVuAhy0p+uyJ/FwoD+RUWsayJg0yIWCxtlqARhNkkP 7blQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rtdEZ3Nf; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x6si15087960pgi.290.2022.01.24.13.14.10; Mon, 24 Jan 2022 13:14:22 -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=@linuxfoundation.org header.s=korg header.b=rtdEZ3Nf; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389251AbiAXUko (ORCPT + 99 others); Mon, 24 Jan 2022 15:40:44 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58724 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381365AbiAXUUN (ORCPT ); Mon, 24 Jan 2022 15:20:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4EEAFB811F9; Mon, 24 Jan 2022 20:20:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CA9CC340E5; Mon, 24 Jan 2022 20:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055611; bh=+EXpyvKm32xvisiAq/RoY1t3Z2SWkpE51+f4s4DEdBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rtdEZ3NfjrJ8/cr8YTELHbyxhzrhuhbqx9A0/ezIQ9ijRwfliSNCdIit4BtgIASQT gKkUBdipfJQMt3/l6iqn9PGtS7rWOU8R5oRnFl6l1x07LI+tLhFYF9uW17Ua89wllH AHOCyz+CWnl5Qp1CB1OHvNoMs3HA3zJ+es+QPzXQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.15 207/846] samples/bpf: Clean up samples/bpf build failes Date: Mon, 24 Jan 2022 19:35:24 +0100 Message-Id: <20220124184108.062857358@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrii Nakryiko [ Upstream commit 527024f7aeb683ce7ef49b07ef7ce9ecf015288d ] Remove xdp_samples_user.o rule redefinition which generates Makefile warning and instead override TPROGS_CFLAGS. This seems to work fine when building inside selftests/bpf. That was one big head-scratcher before I found that generic Makefile.target hid this surprising specialization for for xdp_samples_user.o. Main change is to use actual locally installed libbpf headers. Also drop printk macro re-definition (not even used!). Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20211201232824.3166325-8-andrii@kernel.org Signed-off-by: Sasha Levin --- samples/bpf/Makefile | 13 ++++++++++++- samples/bpf/Makefile.target | 11 ----------- samples/bpf/hbm_kern.h | 2 -- samples/bpf/lwt_len_hist_kern.c | 7 ------- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 01993b502f6a4..8ac8573946e1a 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -325,7 +325,7 @@ $(BPF_SAMPLES_PATH)/*.c: verify_target_bpf $(LIBBPF) $(src)/*.c: verify_target_bpf $(LIBBPF) libbpf_hdrs: $(LIBBPF) -$(obj)/$(TRACE_HELPERS): | libbpf_hdrs +$(obj)/$(TRACE_HELPERS) $(obj)/$(CGROUP_HELPERS) $(obj)/$(XDP_SAMPLE): | libbpf_hdrs .PHONY: libbpf_hdrs @@ -340,6 +340,17 @@ $(obj)/hbm_out_kern.o: $(src)/hbm.h $(src)/hbm_kern.h $(obj)/hbm.o: $(src)/hbm.h $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h +# Override includes for xdp_sample_user.o because $(srctree)/usr/include in +# TPROGS_CFLAGS causes conflicts +XDP_SAMPLE_CFLAGS += -Wall -O2 -lm \ + -I$(src)/../../tools/include \ + -I$(src)/../../tools/include/uapi \ + -I$(LIBBPF_INCLUDE) \ + -I$(src)/../../tools/testing/selftests/bpf + +$(obj)/$(XDP_SAMPLE): TPROGS_CFLAGS = $(XDP_SAMPLE_CFLAGS) +$(obj)/$(XDP_SAMPLE): $(src)/xdp_sample_user.h $(src)/xdp_sample_shared.h + -include $(BPF_SAMPLES_PATH)/Makefile.target VMLINUX_BTF_PATHS ?= $(abspath $(if $(O),$(O)/vmlinux)) \ diff --git a/samples/bpf/Makefile.target b/samples/bpf/Makefile.target index 5a368affa0386..7621f55e2947d 100644 --- a/samples/bpf/Makefile.target +++ b/samples/bpf/Makefile.target @@ -73,14 +73,3 @@ quiet_cmd_tprog-cobjs = CC $@ cmd_tprog-cobjs = $(CC) $(tprogc_flags) -c -o $@ $< $(tprog-cobjs): $(obj)/%.o: $(src)/%.c FORCE $(call if_changed_dep,tprog-cobjs) - -# Override includes for xdp_sample_user.o because $(srctree)/usr/include in -# TPROGS_CFLAGS causes conflicts -XDP_SAMPLE_CFLAGS += -Wall -O2 -lm \ - -I./tools/include \ - -I./tools/include/uapi \ - -I./tools/lib \ - -I./tools/testing/selftests/bpf -$(obj)/xdp_sample_user.o: $(src)/xdp_sample_user.c \ - $(src)/xdp_sample_user.h $(src)/xdp_sample_shared.h - $(CC) $(XDP_SAMPLE_CFLAGS) -c -o $@ $< diff --git a/samples/bpf/hbm_kern.h b/samples/bpf/hbm_kern.h index 722b3fadb4675..1752a46a2b056 100644 --- a/samples/bpf/hbm_kern.h +++ b/samples/bpf/hbm_kern.h @@ -9,8 +9,6 @@ * Include file for sample Host Bandwidth Manager (HBM) BPF programs */ #define KBUILD_MODNAME "foo" -#include -#include #include #include #include diff --git a/samples/bpf/lwt_len_hist_kern.c b/samples/bpf/lwt_len_hist_kern.c index 9ed63e10e1709..1fa14c54963a1 100644 --- a/samples/bpf/lwt_len_hist_kern.c +++ b/samples/bpf/lwt_len_hist_kern.c @@ -16,13 +16,6 @@ #include #include -# define printk(fmt, ...) \ - ({ \ - char ____fmt[] = fmt; \ - bpf_trace_printk(____fmt, sizeof(____fmt), \ - ##__VA_ARGS__); \ - }) - struct bpf_elf_map { __u32 type; __u32 size_key; -- 2.34.1