Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8830798ybl; Fri, 17 Jan 2020 01:47:06 -0800 (PST) X-Google-Smtp-Source: APXvYqxudLwTHRWXVTHOUScmtBQLdmRhG512ks+vkKDzMwlZX0EzgmTCu7aGOMFK+3GHCIOjOb3B X-Received: by 2002:aca:ea43:: with SMTP id i64mr2824432oih.30.1579254426047; Fri, 17 Jan 2020 01:47:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579254426; cv=none; d=google.com; s=arc-20160816; b=uM7xbM9BTLjuh9GsBqb5GbXZX3BTJlQ2MRC9O7tQ8oBdn4IJtsLmclwthPr5CIowoU CEC3y35Bd9Oy/AaRY99K0vhcAZMP/2aH4zwfnywndzJQ7GahKntE+L9Ib0e/dXH5h2Qh fgKucu9j9z2v190e2BrHTLl7frunHIzbFAjcLggaa/euazUWOkiZE9paLXsQGwjScHwo rdP4BaMNPDZgKzALmIEufQDCMzmayzxKKo6lMwJ/1g4DSd+CeiVQzHvdoeoKIGPpEnFQ Sa02qcaaQZyQa5cqq6HyhuZghc9qxAvBqhd3ZCuw7Fc6L6l7ewrWQcrQdojSfgH7pEes RDfQ== 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=5e60O70yf6Qomf9+YnDTvYmEipGiMR/O0K5ZenifWPA=; b=ICzAimy03ks+4BML6CBgLTj1HxXAEZr8N5xm5AQ03F5AjzZ2po+x4BrQiQUl7Hf2Pf THq3JBuia0b3hcXAr3yMi1rTeECoMfbZUlQrd2+9mNHSpKNO2GIVCufz0sElI37yFZWo qyLGLcRpDBeq3TEbZFWkMM4GyK6+O5+yJyHk4v/WY1qka9PLXcLH5XSS9R6qkeIwJxDP sShpRlMaCii10OaHD04Hm5hLMxdl1gPCcFPd0hOehzmjnPoXMRJcmFAJGdCCO6RmSpaG tMIkTuoZEBl6t41M2xT+oLrJtBVa8krVh5DwYm+7Noqf7g3LAf7TgL8S0XGs3l5prLJY w7nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XZSlbFNH; 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 w10si15354068otg.295.2020.01.17.01.46.54; Fri, 17 Jan 2020 01:47:06 -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=XZSlbFNH; 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 S1729019AbgAQJpF (ORCPT + 99 others); Fri, 17 Jan 2020 04:45:05 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:42436 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727580AbgAQJpD (ORCPT ); Fri, 17 Jan 2020 04:45:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579254302; 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=5e60O70yf6Qomf9+YnDTvYmEipGiMR/O0K5ZenifWPA=; b=XZSlbFNH/GC/G6PWXEom+Cxcif0+Bjxhs32baK6z1sVgpRPcuR/dsjEi01AwndIFPX1/mF sYit0WikFWmoyuidX1Dsvqp7KHEOgLpBEaqFCFIs0PaPguSHW850ztRyI8BM3rGsEUL4EA j/XOWxDGhWu+Q6IwZ4I+T85NzF66T2s= 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-3-WJG6E3V_PL2CoB1h1zFGmw-1; Fri, 17 Jan 2020 04:44:55 -0500 X-MC-Unique: WJG6E3V_PL2CoB1h1zFGmw-1 Received: by mail-lj1-f200.google.com with SMTP id r14so6011720ljc.18 for ; Fri, 17 Jan 2020 01:44:55 -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=5e60O70yf6Qomf9+YnDTvYmEipGiMR/O0K5ZenifWPA=; b=tRlaTsjbfsFh0rQJ9qOxkofInTPJu4JlPaInzGm3/7ljATKbV6kefb0/2iUJAXGYoZ Ky4p35ZZQrWmsqaOzl+QBbPdUhkY8z8o5Gya80aENtSMuld1wCbk5YZsiWX/Jk4IkX++ U2vlN7xmjm177TwJkoBZGhdq5z0mzIaah6hYSzGTZkdeNFLzVbJoqT9IZ2jrUca8HXYU r4ipDJJfiEYqoLCQDK4zQlyHCAewyF/wO52PWWpfmtBB1VfvtbpE90nuTXYqf6IVW0X2 hN7p/gyWmbEVBOoqjNz5lhXkeoJ/O0BJsypMZ5FEJJyve5SyC4LBZYumtXWEZ39E9bqv Hnvw== X-Gm-Message-State: APjAAAXfv5QOgnq8ypfpNDRz4SzD8DAUFUilAd0l3GBJHxOYhRIN+l76 +JpzsuBCkMDXPZMhw6H46VD342rLPVDmPd8O3chwpssAPda8Sj04iK9lcCfdkxTgJXjrnhmU/Sg PvEDAZSjFlBTf4aoAr6wvS49x X-Received: by 2002:a2e:87ca:: with SMTP id v10mr5158817ljj.253.1579254294381; Fri, 17 Jan 2020 01:44:54 -0800 (PST) X-Received: by 2002:a2e:87ca:: with SMTP id v10mr5158794ljj.253.1579254294206; Fri, 17 Jan 2020 01:44:54 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id z13sm12089623ljh.21.2020.01.17.01.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2020 01:44:53 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id E29BD1804D6; Fri, 17 Jan 2020 10:44: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 v3 02/11] tools/bpf/runqslower: Fix override option for VMLINUX_BTF In-Reply-To: References: <157918093154.1357254.7616059374996162336.stgit@toke.dk> <157918093389.1357254.10041649215380772130.stgit@toke.dk> X-Clacks-Overhead: GNU Terry Pratchett Date: Fri, 17 Jan 2020 10:44:52 +0100 Message-ID: <87wo9qquwb.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 Thu, Jan 16, 2020 at 5:23 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 >> --- >> tools/bpf/runqslower/Makefile | 18 ++++++++++-------- >> 1 file changed, 10 insertions(+), 8 deletions(-) >> >> diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefi= le >> index cff2fbcd29a8..89fb7cd30f1a 100644 >> --- a/tools/bpf/runqslower/Makefile >> +++ b/tools/bpf/runqslower/Makefile >> @@ -10,12 +10,14 @@ 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") >> +VMLINUX_BTF_PATHS :=3D $(VMLINUX_BTF) /sys/kernel/btf/vmlinux /boot/vml= inux-$(KERNEL_REL) >> +VMLINUX_BTF_PATH :=3D $(firstword $(wildcard $(VMLINUX_BTF_PATHS))) > > If user specifies VMLINUX_BTF pointing to non-existing file, but the > system has /sys/kernel/btf/vmlinux, the latter will still be used, > which is a very surprising behavior. Hmm, yeah, good point. > Also MAKECMDGOALS feels like a fragile hack to me. How about we move > this VMLINUX_BTF guessing (without $(error)) into vmlinux.h rule > itself and use shell if conditional after it to check for file > existance and print nice error. That way we'll be checking VMLINUX_BTF > only when it's really needed. OK, sure, can do. -Toke