Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2442903ybl; Mon, 20 Jan 2020 03:05:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwrQoDtDv14rR2/AyMZpa/KHpbpMyy15+LCIrspYiZxiABFgBJy6UIqnBCqXDph+jqfqm36 X-Received: by 2002:a9d:7448:: with SMTP id p8mr14792435otk.96.1579518346428; Mon, 20 Jan 2020 03:05:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579518346; cv=none; d=google.com; s=arc-20160816; b=EtqcCUS6ipX7IfiSHd2mNoPq1qsZF+YtNkFdMzZal94xayStz+QTrGpCNJIczhWgd+ +iGUJLCDMJCYedRHt2Bwm8tKu6ePMslBHL9lbL0C7xp0cZDagmwRrGB1HN73s9m/MFDm qGoGVKYrOsXUyXrT0rDKf10I+TEoVNpYPs+FpOTCIdJ85Fiwc/S493Fp9sOR2wnxz8cl wSnsBOz0uURRh9bhUBHCJKcLesQkoqNlJ3wVVpfZwuq8JGzA/81syCseR25sRLtf0nCq iob8KHwMD5Dil4CU3x9VugJPr6KMxfMaqKOM8HgN9I4yGZhXJxtZALWq2jiddyRRUWA5 arOA== 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 :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=0D2NV9EyT8+bRJWlmQx32SvVPgUYttr3IYvJpCG0gTo=; b=gdFKBmw2FuwT2/uM8QvI0O+HORoMSISTmrAqF3gqR3T46t6ADRhSXLyOoYPmoAL67y 0IA5iRPQtdcGFWuQL/Tb1HW2D0M2OBr2Ju4UY/pTIOCEwhG95JVQCuKGatOcznoPGhhq 9J7vGHJZGJPqMt9tz1/MqjmM1dOXwp/2fR9yWoscSUopFD1pT6UPAJnzp2L4Abuf0aEW +7g5X6WFDcWxOHsWb+Ohbn68ldCvmuREFl1NmTYysnJlm1tPQ9PK8lYQ5JYLqhHFS/pw MrLN7lVOoUO/kPf09f25nRmD55oxJqVhz2vbqELEgp+fixLdqVxxZY5dvNRP6mWAsyuH impA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UlzPZXXk; 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 e3si19741002otr.245.2020.01.20.03.05.34; Mon, 20 Jan 2020 03:05: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=UlzPZXXk; 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 S1727041AbgATLER (ORCPT + 99 others); Mon, 20 Jan 2020 06:04:17 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32153 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726465AbgATLEQ (ORCPT ); Mon, 20 Jan 2020 06:04:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579518255; 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=0D2NV9EyT8+bRJWlmQx32SvVPgUYttr3IYvJpCG0gTo=; b=UlzPZXXkfStwOUTOhlmhLUgn8H1x/D1EM04ioleX1smxggN/QOfkA4IFvQnk1Ysf4my3F/ sDhm8lZNLzJMUFGBiuRL6tAaQelttCOy7LH1BePcqNiuQ2Gm1hi5d2FK76AB0y/CPJGVyO v9foDTcMzfQjZeR4udPm7juF1/+8JkU= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-327-iQRfkm1rM16s0BYntCgkYw-1; Mon, 20 Jan 2020 06:04:14 -0500 X-MC-Unique: iQRfkm1rM16s0BYntCgkYw-1 Received: by mail-lj1-f200.google.com with SMTP id k21so7476180ljg.3 for ; Mon, 20 Jan 2020 03:04:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=0D2NV9EyT8+bRJWlmQx32SvVPgUYttr3IYvJpCG0gTo=; b=tGgKPgZDGbgKNcRxrOGq8KQ6RkUjZLgbQIsZ36pf2ZmDH0CiaDP3nn9DP/s7JoQyTy w6iyxn3a9lF+DRjax0vwo/MLrKtFBqnr6LdpI8T/XTdlsT9Z7v9rtH5l1h8J2Drfptd4 PyZJgu2xF83ZapwirsS54PEiP1pvYrvMU39Xxi7gbiSWIAUN87X6AUjMiRotLlW7Sr02 5S6v7Govok5+LuM2WUe4mUVaPtHTeXgd9HWEEbDt+hrXwC6Z6oUuii68cv4klpJNI64r tNRLbJG3TpcgG9yqspUV8SQ75lwjQ1WMz+DhpLkG7MA/XlrRbm7UuXnGmqsYs6VzQBms WPNQ== X-Gm-Message-State: APjAAAU8/Zb3AsuN6U4LUnsRhvOdUf/1J4qGlFUbRICSJw71qOukQTTu sjBM3xnIpaW8xV0T2EMaisYuhAbMAYw9BYx129yI4ySxTQUIAvRDyTxE0bpD3/uE8aX7BT5hZTZ uvtR3a/gMcqb4mddzPtQTDwTi X-Received: by 2002:a2e:2c16:: with SMTP id s22mr13113870ljs.248.1579518252322; Mon, 20 Jan 2020 03:04:12 -0800 (PST) X-Received: by 2002:a2e:2c16:: with SMTP id s22mr13113829ljs.248.1579518251933; Mon, 20 Jan 2020 03:04:11 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([85.204.121.218]) by smtp.gmail.com with ESMTPSA id z5sm16616586lji.40.2020.01.20.03.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2020 03:04:11 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 50B871804D6; Mon, 20 Jan 2020 12:04:09 +0100 (CET) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Andrii Nakryiko 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 Subject: Re: [PATCH bpf-next v4 02/10] tools/bpf/runqslower: Fix override option for VMLINUX_BTF In-Reply-To: References: <157926819690.1555735.10756593211671752826.stgit@toke.dk> <157926819920.1555735.13051810516683828343.stgit@toke.dk> X-Clacks-Overhead: GNU Terry Pratchett Date: Mon, 20 Jan 2020 12:04:09 +0100 Message-ID: <87blqypexi.fsf@toke.dk> MIME-Version: 1.0 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 Andrii Nakryiko writes: > 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/Makefi= le >> 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 explici= tly") >> -endif >> +VMLINUX_BTF_PATHS :=3D /sys/kernel/btf/vmlinux /boot/vmlinux-$(KERNEL_R= EL) >> +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 OK. >> >> 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 @ This was actually deliberate, since I was replacing an $(error) (which doesn't show up in V=3D1 output). But OK, I guess we can output the whole if statement as well on verbose builds... >> + echo "Couldn't find kernel BTF; set VMLINUX_BTF to speci= fy 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 Right, I'll try to fix those up (for the whole series). My emacs is being a bit weird with displaying tabstops, so some of these look aligned when I'm editing. I'll see if I can figure out how to fix this so it becomes obvious while I'm making changes... -Toke