Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2550654ybl; Mon, 20 Jan 2020 05:09:36 -0800 (PST) X-Google-Smtp-Source: APXvYqwH/MHVwhMadn1RDpsMfw3PIxphq1X+3up0z18DNRGd32lBk8v0OC0HHOttsx6u6k/2ohaa X-Received: by 2002:a05:6830:128e:: with SMTP id z14mr15736520otp.184.1579525776274; Mon, 20 Jan 2020 05:09:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579525776; cv=none; d=google.com; s=arc-20160816; b=vAk2I7aE/W03ESj7PDBNcS2EvxPcCnCgIT5Mpa8Y7gcebePUDu0n+DTsQEM3PySqdV k0om7P2CazgXisKiUClocgUMtUFzPGpc34HAYt5WxQC/s96X2kzGSA59IRavSPTXK4Ic uWgOAodrqpJSzIx1am8KQlvsh7cHMq5peYif8+ZvW5jDn8fYy+wYswv0NC/qTmQkgGEq k7QeVR1xPpT1ZN3rHJVQ3IWxtIYicb4JD1zL13bP9DbwinQbH+g8mDHep0sv+JJXazSp oN2KthcbHUyyubgZkC4+xMNK8IRGQU2sjvwJ7nTkszyJU8inCO8xmpnlvzhtFBqwac0j 1uQg== 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=kMzta49FGi59zAWBh6JcpPryK5CAVyLgor/XGDFTJFQ=; b=xVinv3QTZBLRXbHutJ8ZF9Ale09EvjYYHLHzvW1otORzGGtDccT7ZfjLp+ZoBG+p4g Mra3myK6jHIBAJvqsiVfhcFDDftnt4FCqc+mIqF/CGCvcl+m9Z1YKqq/KxsF3viJMUgn Qrf9+KHmhCx3WXMNijA0amAWw+7xPB/7qJqLCrB6wCMcc2RrBddx2GKjdtduUHxaIZBP +KwbX/NBpwLJDYwg15VqknJLUM4jMXpuYSS5bn1pEUSbGxIxYHQGsVq7uJJAPgkEhGdS zhk9i4mK58H3WKEbSuteZyzRnuWQqihOD0QuM7RiWtKNCJttvtRAmMYSDNeWTfOrO0li agFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LgVUSukG; 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 l7si20925768oth.11.2020.01.20.05.09.22; Mon, 20 Jan 2020 05:09:36 -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=LgVUSukG; 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 S1729277AbgATNHt (ORCPT + 99 others); Mon, 20 Jan 2020 08:07:49 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:27891 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726954AbgATNGs (ORCPT ); Mon, 20 Jan 2020 08:06:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579525607; 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=kMzta49FGi59zAWBh6JcpPryK5CAVyLgor/XGDFTJFQ=; b=LgVUSukG3ik0ak2C5mNhG38qBjx0MO9+6zi17Yu3mLqiV9pl8sjWXbLPSAdDZjXKLpwLN2 g8rGo8iCyrU+YS7o/jpxkfTCO2sZLdXNHz+USbnTMom2HDCQY8l9yBLvtKQQ3w1LmAH1C1 9VBOUYigCWUYRIcYseq5P814EgXDog0= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-cI_amZQdOqeIcMM8BRzyWw-1; Mon, 20 Jan 2020 08:06:46 -0500 X-MC-Unique: cI_amZQdOqeIcMM8BRzyWw-1 Received: by mail-lf1-f69.google.com with SMTP id n24so6228441lfe.6 for ; Mon, 20 Jan 2020 05:06:46 -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=kMzta49FGi59zAWBh6JcpPryK5CAVyLgor/XGDFTJFQ=; b=m5wJE0ndEi+Z7UYU7Ef9EgDd8qZmiQHLAgpY22oIKnfklwd4iQYCL3GLS55dXeGObY ed/bx4cliFzaoi9tH9cKymU0vbqMANumFDN6bxDeHieME0otnyDR+fJOdaTBRUfhcvNZ huTmF1G30gbcHg7G5u+dFRgfOP8R5srtWcAPMHbQITXjSeYfKtl+Np5PFxtCR5BFIyZc epWQxOqX4I1bFMjN4ZyVW1eKx1cAZ+H3NuSlr8ziWyzD3H7x0ot6vD5EKazeZS+aGulK 3KXC57fam+yFnV6nE4Pw4DY3JFAlT32+I0GXsrLFzRenY6QafrFXGF79HhZ9FFWdf6cV 7c5g== X-Gm-Message-State: APjAAAXVHb3RCQSWXGuL4TKKZLaSqQ1yrirsLrSzRuAHUIunUXHClZVa +fq2rsJ9/qm9lF8PVIsz6SyglFoCTsByk8Tog/yHw5fELLbxcVrrnaVK3DqKfODjE0Pz/gA+mnD fkqUpM0L1H70SoKzpoZnRGD0W X-Received: by 2002:a05:651c:1a8:: with SMTP id c8mr13483677ljn.207.1579525604705; Mon, 20 Jan 2020 05:06:44 -0800 (PST) X-Received: by 2002:a05:651c:1a8:: with SMTP id c8mr13483642ljn.207.1579525604292; Mon, 20 Jan 2020 05:06:44 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([85.204.121.218]) by smtp.gmail.com with ESMTPSA id e8sm19898063ljb.45.2020.01.20.05.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2020 05:06:43 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 6CD9C1804D6; Mon, 20 Jan 2020 14:06:42 +0100 (CET) Subject: [PATCH bpf-next v5 02/11] 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: Mon, 20 Jan 2020 14:06:42 +0100 Message-ID: <157952560237.1683545.17771785178857224877.stgit@toke.dk> In-Reply-To: <157952560001.1683545.16757917515390545122.stgit@toke.dk> References: <157952560001.1683545.16757917515390545122.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 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile index cff2fbcd29a8..3242ab874ac0 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 := $(or $(VMLINUX_BTF),$(firstword \ + $(wildcard $(VMLINUX_BTF_PATHS)))) abs_out := $(abspath $(OUTPUT)) ifeq ($(V),1) @@ -67,9 +63,14 @@ $(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 > $@ + $(Q)if [ ! -e "$(VMLINUX_BTF_PATH)" ] ; then \ + echo "Couldn't find kernel BTF; set VMLINUX_BTF to" \ + "specify its location." >&2; \ + exit 1;\ + fi + $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@ $(OUTPUT)/libbpf.a: | $(OUTPUT) $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) \