Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7769239ybl; Thu, 16 Jan 2020 05:23:43 -0800 (PST) X-Google-Smtp-Source: APXvYqyq2sjqgbd7x84dNJ37QjrnenlUMDSPkui5r8ucT8+HonO6Vthge6Biw6adw8mP68Tm3UIs X-Received: by 2002:a9d:ee2:: with SMTP id 89mr1826519otj.270.1579181023525; Thu, 16 Jan 2020 05:23:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579181023; cv=none; d=google.com; s=arc-20160816; b=vQUgjY1dMlEz8vNr0oUS7HsHE1YLLAEvr6B7kRF3BPO5R0nqHkCM8OLGiOTVWi8vEL c0gT5LgEV+cbx+ULqwONFkinWMK6nAAN9MthbrKcJG0ZXCBMyM9tvh72iiuNri/NNeRR syXJwXYOCl16CQTr6evZoFT4rZ6DjNFBzPiEVCDlf+znlBwwqjNzQB/+PCdLNjAZhDwa dhWQDTDugOBVM9AaDwRbGUx5RNicz7iK9llcYf/yf5VTZi7fqRYbrf2W3/PsHWX2mulA 5zixQRXcs+4TpTAUJCTYM5GcSG+Mh5ldF5+pisdxd6xkC4gP5ZM6UTgWfgvnSYezVKZb 5p+w== 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=gzqQE7mWfqS9gbpZpl6m88cnGx3MlkQu/XGO40kZXJg=; b=DbJZ92lDP5xxWxYxBAJrlrJhqMARoVryxxJDXxCjowr77KCf7lNVk6du/vvFXDhrNe hH5zN99wBdY9UncfrWEaClNl3GMSr6TxHdcRs6ibNRMnOFLwFT2xzt0Wagsk7cSTnJPs zSnqSpvAdztNSeRsbYC/RVDOkvvjSm++D5OH3Eo1aClY018OMCp5bVi4nUYoUl8OcBDB HlosDRQ0lJOo/IbZ2Fta6/xjuco+M8ABauDL5ogdfD8DwUxfQdlwzxQdLZYVRLWFweSK KyN+AiQEGnnSqOp2fs9EMJO307ejFCDboq/xKRTrahF9sRx/vZWMZvVSsvJl2mENGKUL A1+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UXEU91qB; 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 l11si11573191oie.231.2020.01.16.05.23.31; Thu, 16 Jan 2020 05:23:43 -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=UXEU91qB; 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 S1726329AbgAPNWW (ORCPT + 99 others); Thu, 16 Jan 2020 08:22:22 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:25510 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726994AbgAPNWV (ORCPT ); Thu, 16 Jan 2020 08:22:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579180940; 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=gzqQE7mWfqS9gbpZpl6m88cnGx3MlkQu/XGO40kZXJg=; b=UXEU91qBsZH2Yae4zANsgldAmEGv1qjlKfmtl4HP3DXb+1RxwCn0uYBpiybS7hskg4RzW7 n2Qw/LNyFeCIZ8zqjQ9HG4GUkIMYKomYgltlvrHH1fkUII5gs+4yVbxzeRMTFw0uVYTly0 aHMw/1M6ZpyZo1Aqr+ZbTiUeCuwzXMQ= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-59-jy2sBboYP1Wsn-3jN7-amg-1; Thu, 16 Jan 2020 08:22:17 -0500 X-MC-Unique: jy2sBboYP1Wsn-3jN7-amg-1 Received: by mail-lj1-f199.google.com with SMTP id f19so5149884ljm.0 for ; Thu, 16 Jan 2020 05:22:17 -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=gzqQE7mWfqS9gbpZpl6m88cnGx3MlkQu/XGO40kZXJg=; b=JhhS7TRJSHaw7V7C8uNvN0wvt0/Qax9tJkL6g37aIhbEZqjlEoun6P5cFCEblwsTI5 DsbWsQ7Gb+Mzn/l9xA452q+JgDNzQukG9ft2iY9//yQxHN1eAYfAuF+esbCCqm5sRI6V lVjf/zJpUI4+tL7Vkdm7u+LvBykaxE3yhPTupfIbfDKFIG5X/Fq2DiY3FXjPPE8DvgXm ONKTRsAWN86fXauq+ZVFmiC+q0s3MOkvT+xFl+Fq/q39l6TYaL/FAbUi3m3Sno6LDdEf lNiLc4ucx9uzHDKAnb2GgRMatpU4VE6V47pCSqE0/0mN7aGEKdLzn9Trjxb1hbdJurII zccA== X-Gm-Message-State: APjAAAUOHrFDAEsUvscOjpTi/p0uRSVN7LZrFT2tz4JryAYc+aViqLtR VxrRXXpRhcgS5D/e7oq8zIrBD8pQMH/H69CZMIoV2NQk8cc4khOwQhUKQfsUWnxi6UKEKqdn/gP 8Hf5HoyBRW8JUqh5lKQVeYsNj X-Received: by 2002:a2e:2c16:: with SMTP id s22mr2305739ljs.248.1579180936040; Thu, 16 Jan 2020 05:22:16 -0800 (PST) X-Received: by 2002:a2e:2c16:: with SMTP id s22mr2305732ljs.248.1579180935891; Thu, 16 Jan 2020 05:22:15 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([2a0c:4d80:42:443::2]) by smtp.gmail.com with ESMTPSA id n3sm10612990lfk.61.2020.01.16.05.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 05:22:15 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 03CC51804D8; Thu, 16 Jan 2020 14:22:14 +0100 (CET) Subject: [PATCH bpf-next v3 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: Thu, 16 Jan 2020 14:22:13 +0100 Message-ID: <157918093389.1357254.10041649215380772130.stgit@toke.dk> In-Reply-To: <157918093154.1357254.7616059374996162336.stgit@toke.dk> References: <157918093154.1357254.7616059374996162336.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, 10 insertions(+), 8 deletions(-) diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile index cff2fbcd29a8..89fb7cd30f1a 100644 --- a/tools/bpf/runqslower/Makefile +++ b/tools/bpf/runqslower/Makefile @@ -10,12 +10,14 @@ 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") +VMLINUX_BTF_PATHS := $(VMLINUX_BTF) /sys/kernel/btf/vmlinux /boot/vmlinux-$(KERNEL_REL) +VMLINUX_BTF_PATH := $(firstword $(wildcard $(VMLINUX_BTF_PATHS))) + +ifeq ("$(VMLINUX_BTF_PATH)","") +ifneq ($(MAKECMDGOALS),clean) +$(error Could not find kernel BTF file (tried: $(VMLINUX_BTF_PATHS)). \ + Try setting $$VMLINUX_BTF) +endif endif abs_out := $(abspath $(OUTPUT)) @@ -67,9 +69,9 @@ $(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)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@ $(OUTPUT)/libbpf.a: | $(OUTPUT) $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) \