Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6535657ybl; Wed, 15 Jan 2020 06:17:59 -0800 (PST) X-Google-Smtp-Source: APXvYqz1GqkFki/oPt353TutwY476++o2TsGafIfxnOCecIi5sCxlTdJVh7uUJm2K69JiGuJ1Nzf X-Received: by 2002:a05:6830:612:: with SMTP id w18mr1250569oti.264.1579097879532; Wed, 15 Jan 2020 06:17:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579097879; cv=none; d=google.com; s=arc-20160816; b=J1o+nbe+hJ+JVHhGeUNT1idxPQp0ACYEdzmGBZXctu4dusnapWZk3z2peL67TBAbRa yvUJZuRwnh++Su6DoBx6PNp2rKn8ULoUfToMX6zjRgVCDx2LFbvj25HMpo6KmfNc+lWp LUxgrlNjYnyP3Gkr2VCTPr0yEfAvsVqNrbsXt3T1oqBVDrCj1O1mN+FXWxGeKMIUYgbS sgAxLqbG363LqwaSFHYFw85V9h13PhWvyk6XrEYp4RzJ9rxKchmi7dHRfuivDCUvVflb SdCEjIcYSKjn2ykyB/4tcH46aqiZkcP3u6aUN09zfjWfqSesmE6SGsgf16vjTZVG4H1Z h6eQ== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=B9j+W7gDIaDJz39H0dsQUAJSNrjtTec2FhMoAkHknrs=; b=hQoQiwxnh4PRbeTF5dMejYjUElMub2oQndoJP5BgadqYQ8d28x/xf7/n09aZaMb2wk tR1J3VzS3oYHueToqfvDfJ21L53XSdkFB38uNOffLz05CgB24qox4rEJkSBOuLZWcaJy 1jFW0VKaYyt2frKQmUzS5EiA4UDzCKW52v6t136//mnXo+wxKstjVyfg1+n8O0E8SgAm LqVeL+DELJXO3p0Asbj5PZ6np30kGRNzpG1EBGUD88dV5AGy+EbP8DolBQH5Kf7KBkB4 Z93sXEnk+F5RS4L4SS1yFfjzp6og6zS3CtdACWDebGhuJ0FAJq2MnMuGdgZkfRLBKcFv sXJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L01R6wDj; 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 l14si9233446oic.222.2020.01.15.06.17.46; Wed, 15 Jan 2020 06:17:59 -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=L01R6wDj; 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 S1729319AbgAOOM7 (ORCPT + 99 others); Wed, 15 Jan 2020 09:12:59 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:55930 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729263AbgAOOM6 (ORCPT ); Wed, 15 Jan 2020 09:12:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579097576; 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=B9j+W7gDIaDJz39H0dsQUAJSNrjtTec2FhMoAkHknrs=; b=L01R6wDjrJUa2jsqeMymFoujfwEFMGcv9qQD0H3KFU3ZBpCxuBrSTef7zY9XiRw2hL7OX7 fbZL+nUOEGQj1nWQp81zBw4FFvOa+pniDb6OFZ6hKkNuxe13LXYIytZCR2m870tNhoEWzu whb/qzEcw2+7eXuF7GvT9iyx3DJkUTo= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-115-Rkw1x_04OL2BIOXEs4TVwg-1; Wed, 15 Jan 2020 09:12:55 -0500 X-MC-Unique: Rkw1x_04OL2BIOXEs4TVwg-1 Received: by mail-lf1-f71.google.com with SMTP id t8so3246490lfc.21 for ; Wed, 15 Jan 2020 06:12: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:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=B9j+W7gDIaDJz39H0dsQUAJSNrjtTec2FhMoAkHknrs=; b=iAyTM0Tdurq9cPiLjKRcRqRwMOH4sSEMsKWzlgUsnh9oEizWwJJ1kCSqAs/YNz0XMg gS8NgCT9Ld3dwj5+6nPYG+ouKJrLZHFefS4scoDhw4sVRDJEY5VjMRPMPYiiWAqgMEpY 3Dt3LKG+3UZesGDVCvtPxkyPggjBSQR6R3dm8+YOYFaigZNwCLI3aeFbyhO6kPTExqju ANskpi5KD0YFensWlEi8Zo3qXnOsRdUvbRaenirLJDdpsdF4Q5Bumc19Fu9MU968muO0 PSY0NAspnk3JgMnO20RAoFlHuRtZB3IeYG/b7wjHzAW5U1S3/PKR4OdIZgHSlsDicQvY AWmg== X-Gm-Message-State: APjAAAV+ig5VsFVwcTqTEnlT8AyOeAcOnUbx/Y4bbyrZCizL0qzwxGK3 HaqIl3W3XgPfqMMVoR8pzRNtr1YuDmZMVO3ien5qZG5xXi1Ul/pevD6P/cD9G4CUz4azYQfGlP/ EAv9KmrwSn2Tf5rBRTyHDbX5x X-Received: by 2002:a2e:a37c:: with SMTP id i28mr1772083ljn.118.1579097574010; Wed, 15 Jan 2020 06:12:54 -0800 (PST) X-Received: by 2002:a2e:a37c:: with SMTP id i28mr1772066ljn.118.1579097573864; Wed, 15 Jan 2020 06:12:53 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([2a0c:4d80:42:443::2]) by smtp.gmail.com with ESMTPSA id p136sm9082048lfa.8.2020.01.15.06.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2020 06:12:52 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id EE0AE1804D8; Wed, 15 Jan 2020 15:12:50 +0100 (CET) Subject: [PATCH bpf-next v2 02/10] tools/bpf/runqslower: Fix override option for VMLINUX_BTF From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: Alexei Starovoitov Cc: 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 , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kselftest@vger.kernel.org, clang-built-linux@googlegroups.com Date: Wed, 15 Jan 2020 15:12:50 +0100 Message-ID: <157909757089.1192265.9038866294345740126.stgit@toke.dk> In-Reply-To: <157909756858.1192265.6657542187065456112.stgit@toke.dk> References: <157909756858.1192265.6657542187065456112.stgit@toke.dk> User-Agent: StGit/0.21 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Toke Høiland-Jørgensen 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 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øiland-Jørgensen --- tools/bpf/runqslower/Makefile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile index cff2fbcd29a8..fb93ce2bf2fe 100644 --- a/tools/bpf/runqslower/Makefile +++ b/tools/bpf/runqslower/Makefile @@ -10,12 +10,16 @@ CFLAGS := -g -Wall # Try to detect best kernel BTF source KERNEL_REL := $(shell uname -r) -ifneq ("$(wildcard /sys/kernel/btf/vmlinux)","") -VMLINUX_BTF := /sys/kernel/btf/vmlinux -else ifneq ("$(wildcard /boot/vmlinux-$(KERNEL_REL))","") -VMLINUX_BTF := /boot/vmlinux-$(KERNEL_REL) -else -$(error "Can't detect kernel BTF, use VMLINUX_BTF to specify it explicitly") +ifeq ("$(VMLINUX_BTF)","") + ifneq ("$(wildcard /sys/kernel/btf/vmlinux)","") + VMLINUX_BTF := /sys/kernel/btf/vmlinux + else ifneq ("$(wildcard /boot/vmlinux-$(KERNEL_REL))","") + VMLINUX_BTF := /boot/vmlinux-$(KERNEL_REL) + else ifneq ("$(wildcard $(abspath ../../../vmlinux))","") + VMLINUX_BTF := $(abspath ../../../vmlinux) + else + $(error "Can't detect kernel BTF, use VMLINUX_BTF to specify it explicitly") + endif endif abs_out := $(abspath $(OUTPUT))