Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7084372ybl; Wed, 15 Jan 2020 15:21:20 -0800 (PST) X-Google-Smtp-Source: APXvYqy3Tu86AGRy94/FnLDDSg3vBa/FaGJIbsPRSo4h+4GC/LqKdh6QrhyH5b03es2ZShttpu2N X-Received: by 2002:a05:6808:52:: with SMTP id v18mr1891918oic.152.1579130480538; Wed, 15 Jan 2020 15:21:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579130480; cv=none; d=google.com; s=arc-20160816; b=JPvBu12ucV9N3nM1pxwDLPzOuXVW76lsQOG4Zuj660tZ7+tNVKO/axU0RIuLBoE4w9 kupa6lunB5X9LzGXR8H3dj5KspjN++WqQZAdUfRjdDu5iSyohnXqSP3hkyU/lmTmM8Wq 2KckBOKdQmqKlTWMJ2dhu5oh4q+c06PSigP9vRKn47KiFHiOgmnDPSD94OeNKWxkLtp8 4UHtpLmJyZnHN+neW2MpNeMJdSZ1HUmB8ZqIr5LXpf5sZVl5hv3B8S2SLCYJDEx7iM8z XrBx5c9QkL6SpdOdKMYTzsyVJfy7f8bgpoxtHYhnpeZyiwQmYgEYOCyBQOV08qoxDgCM DgLg== 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=2oZ0/KEDQ6dTwiAcIr2E5jK3OjJKgPjKG2s+1U8IzDY=; b=DqPvAukcHR0nV5xO76eRW5vccJT4h7eyr49fZ6sht8QJlyT8nIIe0ozPTUtId2xDkH htqTPzFopYhzyY40oiKV13kXYo6/EBzG8TbaCt6CEq9p0L9H9hqBWcLv+dkVnSeUatIs Y5VmS4Dp1PI8ouTipMsL4EwT/Qb+IReHZsFPJverS4j01LHwEhUcSGWO4Vgkm8xZbVU6 Xe3a5fiKBaj6hkiOUBRA1JEr0H7urEwffoyN30+NAvbj44+EyXhQLRc4flaiKR6QWPLw 2h901IslWBVUt6KC98yBAjw+X3/dPlms8G2ASvMFkYfCp8FF7Mp87QwJjJiguyw4omON nbGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F7CD6zPg; 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 j19si9940386oij.51.2020.01.15.15.21.08; Wed, 15 Jan 2020 15:21:20 -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=F7CD6zPg; 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 S1729970AbgAOWHB (ORCPT + 99 others); Wed, 15 Jan 2020 17:07:01 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40259 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729016AbgAOWG6 (ORCPT ); Wed, 15 Jan 2020 17:06:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579126017; 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=2oZ0/KEDQ6dTwiAcIr2E5jK3OjJKgPjKG2s+1U8IzDY=; b=F7CD6zPgqEcj45Vc3Y5yVQs1h8jAohsbwZat45fNNg8W5YBLs8phGcT6ceCgxiQ2IlQNuo D3Lj1pBPbhno8r1eEJ4A+4959bU9tatNcFHf1P4ajQ9tsMeGI+PG6haZY7XONT0fEZL8HZ R3EJy18qylTINOJcIa+5ctd5b/t+Tf4= 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-351-YYQIgyw9Pi-DbZI6-LtiGg-1; Wed, 15 Jan 2020 17:06:56 -0500 X-MC-Unique: YYQIgyw9Pi-DbZI6-LtiGg-1 Received: by mail-lj1-f199.google.com with SMTP id h23so4464097ljk.14 for ; Wed, 15 Jan 2020 14:06:56 -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=2oZ0/KEDQ6dTwiAcIr2E5jK3OjJKgPjKG2s+1U8IzDY=; b=loc/ecAl8KCge/1x0xjsu2cbK8/fCPsgeBFbiI8Oi9ViX9n8B2Ig93xLjW+tgsP28e lurv97TCGkhxJXtB9f7vxUSxX0hESdbUxLnf0kWK1oJ4p0CT8hq9etkFzJQdRG4JHt2a n2ceX/0udJXUMindCe1JqAAfISORoO42lg0ODQl7up5zRq2QOopcOEFciDUFQJ2z6IOv aedNRK+IzNhyyknssUPApjszarUIpDoMNzEFhNB6RAG2WISJTkTzWHSsMomdBwvMtvVM 3FDpobNDw0jwMOEqXXkHKthDvW4ZGlJ1/M/pevwa4yTUB0fRKPea2Y6avV8fL5f3xza3 kG/A== X-Gm-Message-State: APjAAAXGtgCFpav01SEyd1lS8+ccxgDx+N3AvBrxvjcsvDjrC/nCuiFo k7KNYog9nqwKz5kbgc+VVb+LYbc+jm7ZSVYXbYEvXXRiqo9EqMS+89qTOikD8wqgA9uoY0P1e9S ZDmidTmh1bOvJNRtUUVqmeB8T X-Received: by 2002:a2e:3e03:: with SMTP id l3mr298591lja.237.1579126014930; Wed, 15 Jan 2020 14:06:54 -0800 (PST) X-Received: by 2002:a2e:3e03:: with SMTP id l3mr298563lja.237.1579126014662; Wed, 15 Jan 2020 14:06:54 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([2a0c:4d80:42:443::2]) by smtp.gmail.com with ESMTPSA id k5sm9561045lfd.86.2020.01.15.14.06.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2020 14:06:53 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id BEFA11804D6; Wed, 15 Jan 2020 23:06:52 +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 v2 02/10] tools/bpf/runqslower: Fix override option for VMLINUX_BTF In-Reply-To: References: <157909756858.1192265.6657542187065456112.stgit@toke.dk> <157909757089.1192265.9038866294345740126.stgit@toke.dk> X-Clacks-Overhead: GNU Terry Pratchett Date: Wed, 15 Jan 2020 23:06:52 +0100 Message-ID: <87v9pctlvn.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 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)? Before this patch: $ cd ~/build/linux/tools/bpf/runqslower $ make Makefile:18: *** "Can't detect kernel BTF, use VMLINUX_BTF to specify it ex= plicitly". Stop. $ make VMLINUX_BTF=3D~/build/linux/vmlinux Makefile:18: *** "Can't detect kernel BTF, use VMLINUX_BTF to specify it ex= plicitly". Stop. >> 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/Makefi= le >> 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 explici= tly") >> +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. Well building the kernel in-tree is something people sometimes want to do ;) Specifically, the selftests depend on this, so we should at least fix those; but I guess it could work to just pass in VMLINUX_BTF as part of the make -C from the selftests dir? I'll try that... -Toke