From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EF60C32771 for ; Wed, 15 Jan 2020 22:07:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64F0C2465A for ; Wed, 15 Jan 2020 22:07:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="F7CD6zPg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730061AbgAOWHB (ORCPT ); Wed, 15 Jan 2020 17:07:01 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49943 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729977AbgAOWG6 (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-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-209-9DxNNaqtNQC0I63YiX-nXw-1; Wed, 15 Jan 2020 17:06:56 -0500 X-MC-Unique: 9DxNNaqtNQC0I63YiX-nXw-1 Received: by mail-lj1-f198.google.com with SMTP id g10so3529278ljg.8 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=ounUqoiqYBNZ32QxfsaF3T7bYdU3msEEa3rTqTEgoQZ/fB1EkimFxdtk05R9axt6LA kra572Q4+mkIg3lHYn5dvw5TZtzyMopvsoMwbKhQgxlQDoSK2KwaUjrVK4b+ooBHU77V xDxp715+07dUVGWLd6yYqIlqr9R1qMavoAlxKwChfLrPG//onZF5QyjznHFAbfVo89kg m6hEnDNW2/R1SNcekTV4pms2ScfT+xvPjScKTItXfGhI19zFgm4bfuz4xGYBm8aqpxec eKKOyH3XDdWO3/E1T/B47+tufY/uqW5STD78er4VX4DA+qMe+LYLJDw/D19QpZQp8duX tBjQ== X-Gm-Message-State: APjAAAXLnuOzJvpnN8zPaFtUoSM9IOU5DnjP/pPbJEw+QRuEkKLElTbj GrDrSNnrFmZ6jLrlCH7bsgIZhQuOeY5tDDetWf6BIPRTCMtRNjYf1VjBRJWCt6i3t9Tc94KzPaM oCd8YVebj31Wa9yJlxS6zPg== X-Received: by 2002:a2e:3e03:: with SMTP id l3mr298589lja.237.1579126014923; Wed, 15 Jan 2020 14:06:54 -0800 (PST) X-Google-Smtp-Source: APXvYqyICy0H3yi0QO3D1AnqbT83z5lYl+AEoYsdeygh7OdbhjgdnK2+SYcwTz5CjSsgq/x/PPJOpQ== 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-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@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