Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9518985ybl; Fri, 17 Jan 2020 13:32:00 -0800 (PST) X-Google-Smtp-Source: APXvYqyU+84XdwtAYn7qjc/tVHjZ8iC6AW07jAZge9tpFY+ESgYCHvn7cmf8IqUOIjt224rPyqxp X-Received: by 2002:a9d:7ad9:: with SMTP id m25mr7341465otn.13.1579296720424; Fri, 17 Jan 2020 13:32:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579296720; cv=none; d=google.com; s=arc-20160816; b=TmylSj/3LxzbA7ZYbhkqGFQy2N6w/a1t6zGk0RwyGKFyxOD2w56vWgNrtvjFoRYrWw tXRvSBAgLFS6R5DUxAh7pXmAr28Tin+0ClfAsgwE6PeDhOdFN4zFQ7FHZXtyYOeRIuIP sGPN3/V5KDRLbZhEVAN8cZ2ue31+c5l4AVXsV+YP15OXRg4apWcsT5WaxDP+9gHElZGZ PexJh+mPJj5OL/6TxWMNBnDyNwSms2p3f1D+TgeDA3XpMR2Mu5DGSr2DxeILCXd1O+f1 vd6sF/+LLD3fxyi2ZZZwWuorJdmD9QrnB1BBmRGS9bZoJ+f8yOtmzBA/WR4toJqVP28T 7bWQ== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=oKpJrpMP/WbiwVT8VF9eF4TKH+tXOjUsUEulh6dUpSw=; b=YC2uQ7RXA/OMozA2PWNVIDPN3PB2Qhv/gHmAQgbT/tcC120edObbexKkfiDFxK6uhb 3AFLwFZr7o4Prg0oBv41vGwiSgua1yCYIA4AmjPn7aQC7xS7z3izsMyP68yWOuFa1yss XhGSOurDhcFj2EmzBbIuV34Waz5LZBl5Fik5ySQbq15Ns+RmVAa68JbZuaf8YqgGJ9FS 6xWfbc8RmWOeLF5QS8rXkxsy2GvYQOcuE5iIdgGJsxMTRzGkhQ1cAwvdVkEpP4TBoRI+ vCNwxd0Txh/qZtL5WYjgha/stwrHkUtbriSJ+nCTVYk0QGL3PYBMgsDGl84ZOcekP5+E ioTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZtisCfjA; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x16si14478008otp.184.2020.01.17.13.31.48; Fri, 17 Jan 2020 13:32:00 -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=@gmail.com header.s=20161025 header.b=ZtisCfjA; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729080AbgAQVao (ORCPT + 99 others); Fri, 17 Jan 2020 16:30:44 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:35093 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726744AbgAQVao (ORCPT ); Fri, 17 Jan 2020 16:30:44 -0500 Received: by mail-qt1-f194.google.com with SMTP id e12so22931397qto.2; Fri, 17 Jan 2020 13:30:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=oKpJrpMP/WbiwVT8VF9eF4TKH+tXOjUsUEulh6dUpSw=; b=ZtisCfjADHKFGS8o8e4KIuHaDJC/xyclaJ5vqDJIXm5Wrpcq2jsu1dpGYrbMc0EiN5 aD2ZtqJ5kO3qMGy2kukqbaVq+bN2uyoA+FQK5QZa6GqyLIl5xj9kPoJsXh1NPy9mYWHZ Df7icJ+9GU0YMhkXtCe1sJ9emvzmzIfFi175xOHBsdwgP9zpTU6wtz+lLCkNVWis1/Ih f726gk7Az81OAW+ZSC3XvVr/LS8pJOvy5Da49AyeIuNTq33bDLdxBokHkKfq/XMxnAjn eM4xKe8nxEEl090/fSg4wPNpNHvCXlErB1Q89+KFi+uiVxMszLSLwfvHkeE0rwOd4u3r x8sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=oKpJrpMP/WbiwVT8VF9eF4TKH+tXOjUsUEulh6dUpSw=; b=S2o9JP+sQh8eFZwNW3F7v3DiIre2v4EcRw9BaNYNSfSEdTUokE3ozIBlH8F7H1gxIU FDpgz7maNKsFvn7T4oOx1jzpDAOz5VVRtxSxl8aG/75+qzGJN8g6PfF8LeKWIjs/j2Sk CeyyN32lr8P7O3/uGh3PZnbcKFommoN3kqR8JLezDWEqKCfdbJe5dpzW6Ff10n/3hD2l VXORmKHco7wkPcT0gOOBQwd8vggVDbr6qPmMVquxUd4lmL/zReq7U34uagxVDRsgUz4e /IwHIn/79wtkEl1JadoMyaG2jo6IDLjpTf9hzYytZc2QHj6+231Y/hTd+kxGg7Bm2m13 VFTg== X-Gm-Message-State: APjAAAXyOPwEfrgbHR9z51YOwiUWob8ltTCIwek+C2XPsbLHrMPbnzIF VHUKuGIimmRn/y8keyf2ex308F7StIEzmjlZmFA= X-Received: by 2002:ac8:7b29:: with SMTP id l9mr9287898qtu.141.1579296642749; Fri, 17 Jan 2020 13:30:42 -0800 (PST) MIME-Version: 1.0 References: <157926819690.1555735.10756593211671752826.stgit@toke.dk> <157926819920.1555735.13051810516683828343.stgit@toke.dk> In-Reply-To: <157926819920.1555735.13051810516683828343.stgit@toke.dk> From: Andrii Nakryiko Date: Fri, 17 Jan 2020 13:30:31 -0800 Message-ID: Subject: Re: [PATCH bpf-next v4 02/10] tools/bpf/runqslower: Fix override option for VMLINUX_BTF To: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Cc: Alexei Starovoitov , 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 , Networking , bpf , open list , linux-rdma@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , clang-built-linux@googlegroups.com 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 Fri, Jan 17, 2020 at 5:37 AM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > From: Toke H=C3=B8iland-J=C3=B8rgensen > > 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=C3=B8iland-J=C3=B8rgensen > --- approach looks good, thanks, few nits below > tools/bpf/runqslower/Makefile | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefil= e > index cff2fbcd29a8..b62fc9646c39 100644 > --- a/tools/bpf/runqslower/Makefile > +++ b/tools/bpf/runqslower/Makefile > @@ -10,13 +10,9 @@ CFLAGS :=3D -g -Wall > > # Try to detect best kernel BTF source > KERNEL_REL :=3D $(shell uname -r) > -ifneq ("$(wildcard /sys/kernel/btf/vmlinux)","") > -VMLINUX_BTF :=3D /sys/kernel/btf/vmlinux > -else ifneq ("$(wildcard /boot/vmlinux-$(KERNEL_REL))","") > -VMLINUX_BTF :=3D /boot/vmlinux-$(KERNEL_REL) > -else > -$(error "Can't detect kernel BTF, use VMLINUX_BTF to specify it explicit= ly") > -endif > +VMLINUX_BTF_PATHS :=3D /sys/kernel/btf/vmlinux /boot/vmlinux-$(KERNEL_RE= L) > +VMLINUX_BTF_PATH :=3D $(abspath $(or $(VMLINUX_BTF),$(firstword \ > + $(wildcard $(VMLINUX_BTF_PATHS))))) you can drop abspath, relative path for VMLINUX_BTF would work just fine > > abs_out :=3D $(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 \ $(Q), not @ > + echo "Couldn't find kernel BTF; set VMLINUX_BTF to specif= y its location."; \ > + exit 1;\ nit: please align \'s (same above for VMLONUX_BTF_PATH) at the right edge as it's done everywhere in this Makefile > + fi > + $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@ > > $(OUTPUT)/libbpf.a: | $(OUTPUT) > $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) = \ >