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 B37D5C33CA1 for ; Mon, 20 Jan 2020 11:04:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8079A208E4 for ; Mon, 20 Jan 2020 11:04:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UlzPZXXk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727065AbgATLER (ORCPT ); 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-Google-Smtp-Source: APXvYqzXI2yd2Oi5VKXpLVh9lATHnVWtfkEINyqNvSzJ0CGsMQ8EPIgo05xlthJ7jXSiWSfn+eDmEA== 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