Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9053363ybl; Fri, 17 Jan 2020 05:39:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxQhXrls46EpdZMzn7BslbIIS/cMbUFSXjA48OKqDWvky7JtEYyCRBXkJT9nI+a5hZSwZKG X-Received: by 2002:a05:6830:154c:: with SMTP id l12mr5970399otp.275.1579268386138; Fri, 17 Jan 2020 05:39:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579268386; cv=none; d=google.com; s=arc-20160816; b=piSU0ruNvouMEiLW9FEYHioGd37de/wmAmeVA7EyeHuKl3uxqvYH+1qAAjJiM7xnNe ViVITrNoXud1HO7QnqY5UAvXkpcs27rO/G/AsIGVzZ7Z/RaCtTyZ73zcE+DixhTRGXXH DOocMcyU/wIfBHQ0VnxKAu3YS1Xdfn0/aE75urNeQbsLCSypD+gPrZbg/oTzAiook4GD FYqXdAj425glLky++WaP9f16v60BTnvVOFGWlhBiRkI1KwmpoQ3Aa/iluZ18MjpVciip vY8AdI37jshv/sP0xavDUDTcmhb861lx+/DOmwG66EQvP4kRPEo9RIXwQrZ59OmjWy0T rh/A== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=VosVvChz478iuqQd8mY3MBbU9kJ6mOJCPMFLJtpQS9A=; b=YA+WHJRiQpASm5FBWnKB75DR/zDt18nxLTgGoPZ09lwKqiy71EVifZBu3yw2bkabBM hte9XHr6MD0EfSY+HUmEsPa1b43hIBsSsB94d9cAt68J7+NrGOQ5z/50WvcC73tYKyky DVWsYrQQHgC1W/xWJSiBcBbJCEsvGgiC5vEOGlDYybCzPU3koZT2HAycBz9/LnXIrKhp LdS/HPX6iy95CGpusLN4/S6pqqEI5TZ6w4l7+2kS7E3aRtcWrcDzwYxOYR1Bip8zP0CT Vkrx7jfYifGxKlLiA2TfkgoC5OjsCaK2FcT5fn1ClQ7VXaj1nuXLBqOEJjgP2pcpwTHe Rz7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JapctdLY; 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=pass (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 n11si13977836otk.290.2020.01.17.05.39.34; Fri, 17 Jan 2020 05:39:46 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=JapctdLY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729064AbgAQNh0 (ORCPT + 99 others); Fri, 17 Jan 2020 08:37:26 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:57882 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727691AbgAQNgp (ORCPT ); Fri, 17 Jan 2020 08:36:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579268204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VosVvChz478iuqQd8mY3MBbU9kJ6mOJCPMFLJtpQS9A=; b=JapctdLYmJlndbiifzMGssPVyMmyshuZw7pl0eza5u6eyiHXO6aBm3Z+tBZ6ulbQCgKv0l cDj/Oh6LbD4R0y0WK3G7wDe86dUNiAXgrsTxk06+2m5uoYiLqBbq37nFUwYrVGIUWF250Q 415rtzoT2WizfDu7Q978WXdsdndLQyc= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-335-eQPgdKNKPgKN-FAF05gs_A-1; Fri, 17 Jan 2020 08:36:43 -0500 X-MC-Unique: eQPgdKNKPgKN-FAF05gs_A-1 Received: by mail-lf1-f71.google.com with SMTP id w72so4367710lff.20 for ; Fri, 17 Jan 2020 05:36:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=VosVvChz478iuqQd8mY3MBbU9kJ6mOJCPMFLJtpQS9A=; b=CVGg43QweXBwG+itHxjdRe2nvkPn3//1IRoxZDt+GjMiqFW/yJOb4LmznOmP4tO9fo qrNJogH5Q76D15zub+G/3Y6oh5bYacTaw/ni4kHKSqsRZ0YnkEBp2QPZZjzRSSdWYAPj +sGNaSqVscplsimNYL42SU7rsYV8LVrG3LaNR+QNriKpO7tbHOcOa1uIMwPDvZfVKUlD M118kIMlUGuXZATD9T+F3s1VDbIQrxd9Osbc6WI8/v1w61W1DPnwVLSIzlcfTCdduJMF SxV/x3nJISh818N6Y+8KFgP1wjuKiGRbeSjWlWu/NSyewTb5oCJsa/1Ix6qhZFDGLOVl YLdg== X-Gm-Message-State: APjAAAX0uVW96DoaQ01Csr3/MA+6SL4jmN5reweRf8OcmEV8rkSYjUyW tbZ7h63nCQJuITfWRTjd0jaRSUE7XddtDsnJwltc0uBKW0aJqhYMozTSzbDmV+Lun2/ZFuaSUF0 S7Z/cx6+HKI+3xQxuyNxthrpK X-Received: by 2002:a2e:7a07:: with SMTP id v7mr5832260ljc.271.1579268201642; Fri, 17 Jan 2020 05:36:41 -0800 (PST) X-Received: by 2002:a2e:7a07:: with SMTP id v7mr5832239ljc.271.1579268201264; Fri, 17 Jan 2020 05:36:41 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id s1sm12420064ljc.3.2020.01.17.05.36.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2020 05:36:40 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 3EFB41804D8; Fri, 17 Jan 2020 14:36:39 +0100 (CET) Subject: [PATCH bpf-next v4 02/10] tools/bpf/runqslower: Fix override option for VMLINUX_BTF From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: Alexei Starovoitov Cc: Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , Doug Ledford , Jason Gunthorpe , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Shuah Khan , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kselftest@vger.kernel.org, clang-built-linux@googlegroups.com Date: Fri, 17 Jan 2020 14:36:39 +0100 Message-ID: <157926819920.1555735.13051810516683828343.stgit@toke.dk> In-Reply-To: <157926819690.1555735.10756593211671752826.stgit@toke.dk> References: <157926819690.1555735.10756593211671752826.stgit@toke.dk> User-Agent: StGit/0.21 MIME-Version: 1.0 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 From: Toke Høiland-Jørgensen The runqslower tool refuses to build without a file to read vmlinux BTF from. The build fails with an error message to override the location by setting the VMLINUX_BTF variable if autodetection fails. However, the Makefile doesn't actually work with that override - the error message is still emitted. Fix this by including the value of VMLINUX_BTF in the expansion, and only emitting the error message if the *result* is empty. Also permit running 'make clean' even though no VMLINUX_BTF is set. Fixes: 9c01546d26d2 ("tools/bpf: Add runqslower tool to tools/bpf") Signed-off-by: Toke Høiland-Jørgensen --- tools/bpf/runqslower/Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile index cff2fbcd29a8..b62fc9646c39 100644 --- a/tools/bpf/runqslower/Makefile +++ b/tools/bpf/runqslower/Makefile @@ -10,13 +10,9 @@ CFLAGS := -g -Wall # Try to detect best kernel BTF source KERNEL_REL := $(shell uname -r) -ifneq ("$(wildcard /sys/kernel/btf/vmlinux)","") -VMLINUX_BTF := /sys/kernel/btf/vmlinux -else ifneq ("$(wildcard /boot/vmlinux-$(KERNEL_REL))","") -VMLINUX_BTF := /boot/vmlinux-$(KERNEL_REL) -else -$(error "Can't detect kernel BTF, use VMLINUX_BTF to specify it explicitly") -endif +VMLINUX_BTF_PATHS := /sys/kernel/btf/vmlinux /boot/vmlinux-$(KERNEL_REL) +VMLINUX_BTF_PATH := $(abspath $(or $(VMLINUX_BTF),$(firstword \ + $(wildcard $(VMLINUX_BTF_PATHS))))) abs_out := $(abspath $(OUTPUT)) ifeq ($(V),1) @@ -67,9 +63,13 @@ $(OUTPUT): $(call msg,MKDIR,$@) $(Q)mkdir -p $(OUTPUT) -$(OUTPUT)/vmlinux.h: $(VMLINUX_BTF) | $(OUTPUT) $(BPFTOOL) +$(OUTPUT)/vmlinux.h: $(VMLINUX_BTF_PATH) | $(OUTPUT) $(BPFTOOL) $(call msg,GEN,$@) - $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@ + @if [ ! -e "$(VMLINUX_BTF_PATH)" ] ; then \ + echo "Couldn't find kernel BTF; set VMLINUX_BTF to specify its location."; \ + exit 1;\ + fi + $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@ $(OUTPUT)/libbpf.a: | $(OUTPUT) $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) \