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 942F3C33CB3 for ; Wed, 15 Jan 2020 14:16:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65AF42073A for ; Wed, 15 Jan 2020 14:16:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="L01R6wDj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729014AbgAOOQV (ORCPT ); Wed, 15 Jan 2020 09:16:21 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:54898 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729253AbgAOOM5 (ORCPT ); Wed, 15 Jan 2020 09:12:57 -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-363-VrrldrkeNjK6bFtSbLtnhQ-1; Wed, 15 Jan 2020 09:12:55 -0500 X-MC-Unique: VrrldrkeNjK6bFtSbLtnhQ-1 Received: by mail-lf1-f71.google.com with SMTP id d6so3277785lfl.3 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=BJ74cYvORXVOcvgmyecmwT2oZWLs36cNZRhmv7rUR4EYJqRonqZpnpNSwrTaaxr298 yyHuH+EUREJgSB5tLfYGvZUDyVJtnZO2yrB85zQMBBdOpH/NQlkzJeIz2Q7B3+83YBrZ k8PEmJqtnGtV0mVTjampdEgwYxvbQ002hpGmyzOTRaK2w0qWV2a72zojkdt+Hyypsx9i 3UY51NkS3OjvDTIICyNKiS5U+BB418TsjcZS6ppBN3+8J/Dict7slEMVqnKtfW7th31b kei2jgGSqaLVdAF63M9GlJL9TuZJaq8YDw5E7VeH9PloExebif+oPu//MXrtXBIRm5WI uRSg== X-Gm-Message-State: APjAAAXq8FXwFs9EB8uk51mFasbBEQj471n2PbKNV4jFsNlXoIiQE6K7 FmvfJnatt7tozajogHm0LZwo0bbSIXVoLSjsjFeBe5NbgDsHFETihoJAuDODDMCAKgshK/7N3Z3 xGYPy2o3bHhVKQxQc7x3PUA== X-Received: by 2002:a2e:a37c:: with SMTP id i28mr1772084ljn.118.1579097574011; Wed, 15 Jan 2020 06:12:54 -0800 (PST) X-Google-Smtp-Source: APXvYqyUW0Ep6uEXtLij//fHtTp+5adTa9pXL0f4oBHP8qleNZhf8ZN29IWsfrnAs2scQN/yNWVb2Q== 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-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@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))