Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6709759ybl; Wed, 15 Jan 2020 09:00:36 -0800 (PST) X-Google-Smtp-Source: APXvYqxJAlKPYRR4BLmsfAdAYn/LJLQ2T0xdZWEasR0vuJgF5vbHljF6SdzQBISrJN37hAFmUaKz X-Received: by 2002:aca:cc55:: with SMTP id c82mr550663oig.165.1579107636770; Wed, 15 Jan 2020 09:00:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579107636; cv=none; d=google.com; s=arc-20160816; b=JY2+WlvnvV46n5aRZMfoCqJGs2UZ/EZUq+Lb4fS/4tfIXTs5SoP0XclL1Cgrjrb77R ciQJCO/KQrxNciX3NyB8ZaJe3De2lvtx8UYvRQAm0qJkrfuWCxNPFQjelet8tA6Ic9MM j/hVIEHIUHW/4GjwlACBPOurHUZMvg7+lhNfsY1CHfdKrWlw1vBved1TmBCBeg1czZiD H8ZKJZ5TckiL2f76RYBgj7I1RqCliVroeAO94TbfpLvWZyq3kRvzJF+MgyS/fNKpwDpj tSdmwFQlOEUAyJD7mJWdYQguXBVZ2wYuLFYrV+L3tGQeHls758f+7WYWVo9txyzU2V70 +rKQ== 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=zXrVKnuJiXeQCR3gw20F62xg2np3z08kfj/7nG55paY=; b=LLRdv+wRauKcV7A69NW6pw/bp6Vix1I9iB0N7CTOJzbC6akangOfjzRcekPb7Tn0xO cffC6H98agTdxMTyTaoCCA85MlDmDBoYquzF2Xh2sG0wDW9oR/EWWqrKkY9ow5fSAbjk BfVWp8zcGFkiOcb/X0KI/SqgO8OQyKPhvNkKIPLeCFqniAJU2M5PyqGtba+f7AM4BZ2p kBl2vuzRkyus5JJr97KNOa91McEIKFVSHBjyr++8qBi/kSZzEJf/uz+p37gLULELZIlf SYYPLj14SqQUCqaBd3+zx8xVmCJ0SrwCLW6iLxFiapTQd5FgL0YoTQll4S9DlqmRBp14 ZiHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="OSUmC/dY"; 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 i2si9701316otc.130.2020.01.15.09.00.23; Wed, 15 Jan 2020 09:00: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=@gmail.com header.s=20161025 header.b="OSUmC/dY"; 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 S1729010AbgAOQ73 (ORCPT + 99 others); Wed, 15 Jan 2020 11:59:29 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:35961 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726566AbgAOQ72 (ORCPT ); Wed, 15 Jan 2020 11:59:28 -0500 Received: by mail-qk1-f194.google.com with SMTP id a203so16318205qkc.3; Wed, 15 Jan 2020 08:59:27 -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=zXrVKnuJiXeQCR3gw20F62xg2np3z08kfj/7nG55paY=; b=OSUmC/dYP9RIlJCOVjfv/a2ZhRCa/XB3teZH6z9cTlpa2INK4lmXFx7a7gmgRTDsrH XHsV9vPzoCRYqP4WOtk/OaTnbdVzXYn07lB76lDBcUF9iDNNB5NUfM5medXGt9zKAxlL V2Nrn3JZ2rvGTGW/rLuJOyVPFhrAfrIQ81c10nP0eVXKtfeeoq9AWdXLlqthZhhudP5C Hr06gGZIn/xF51ZRbGZIT3gKDlM5fO2a0Tw4XTFygoUvgX5Zrk2+Ub8UuINh9tMB/PqK fUoM/aAxz1W5jijfpabq4sgr7V2JQ3OhOott+NfJkhQ+5VGS5J9OjhLVtdRdDi8KPM6l CMcg== 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=zXrVKnuJiXeQCR3gw20F62xg2np3z08kfj/7nG55paY=; b=hS9jhCGJQd/5/visierr9+EDcPkghpZqAxKzEygKhZe6IypPgw2awBxQTnGzqifY36 fXBAq8ZNqZvFAQmZtYEQpKxHIX12q3tVtEzsbnTh0NHnSg179AfwDzosIggv7O5+0S8Q TFFED6LME8ttaoqrcc4Mki940a7G4vAvyWTQhDBhdI+ZAcTOUbAXtlaBKpyMt95MSZql t9bPIhHLIMrl4PKYpA6Xy6hJbqtmv7n9jquSXRMhl4ytl2CQte4m/remjNkJ1L64iVpM zCrc3LPWAjT4uNnQgzxuT1PZGl6nTlQkX/l1hxrozaazdIavQX3wgUlBhtnoD1L7kNFZ kIDA== X-Gm-Message-State: APjAAAVFmJhLXMUQgAGZKMLtgZPOBccM6BawzSOrBSqX80LIAvLc9yo1 G6JjIk8/SNzHvLZZRK5lqArRjXS8gft4IOVP2rc= X-Received: by 2002:a05:620a:14a2:: with SMTP id x2mr28643046qkj.36.1579107567235; Wed, 15 Jan 2020 08:59:27 -0800 (PST) MIME-Version: 1.0 References: <157909756858.1192265.6657542187065456112.stgit@toke.dk> <157909757089.1192265.9038866294345740126.stgit@toke.dk> In-Reply-To: <157909757089.1192265.9038866294345740126.stgit@toke.dk> From: Andrii Nakryiko Date: Wed, 15 Jan 2020 08:59:15 -0800 Message-ID: Subject: Re: [PATCH bpf-next v2 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 Wed, Jan 15, 2020 at 6:13 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. Do you have example command with VMLINUX_BTF override that didn't work (and what error message was emitted)? > > Fix this by only doing auto-detection if no override is set. And while > we're at it, also look for a vmlinux file in the current kernel build dir > if none if found on the running kernel. > > Fixes: 9c01546d26d2 ("tools/bpf: Add runqslower tool to tools/bpf") > Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen > --- > tools/bpf/runqslower/Makefile | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefil= e > index cff2fbcd29a8..fb93ce2bf2fe 100644 > --- a/tools/bpf/runqslower/Makefile > +++ b/tools/bpf/runqslower/Makefile > @@ -10,12 +10,16 @@ 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") > +ifeq ("$(VMLINUX_BTF)","") > + 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 ifneq ("$(wildcard $(abspath ../../../vmlinux))","") > + VMLINUX_BTF :=3D $(abspath ../../../vmlinux) I'm planning to mirror runqslower into libbpf Github repo and this ../../../vmlinux piece will be completely out of place in that context. Also it only will help when building kernel in-tree. So I'd rather not add this. > + else > + $(error "Can't detect kernel BTF, use VMLINUX_BTF to specify it explic= itly") > + endif > endif > > abs_out :=3D $(abspath $(OUTPUT)) >