Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2671469ybk; Tue, 12 May 2020 05:24:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqe6SwuWrhazDDw4oYsuiNYrGZhF4vkruPP4grgrHEyWTuoYZ43GxAf9sciWFhvFciIAa8 X-Received: by 2002:aa7:c3d7:: with SMTP id l23mr3067197edr.125.1589286299626; Tue, 12 May 2020 05:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589286299; cv=none; d=google.com; s=arc-20160816; b=JYbc3unlLy5VOtgLQWXHlZUtgz0V8bfokiNpNO9eilyIFS7NV+y96v/vtDz8Y4Oay1 ZiATOrR/ji8fuNRmugXwR1sx8sl9aDOufOHM/RUIhmKlmNiXcS0tBWJ9hEnDVPNfRS6P n8fgwwla5L8W5SF5qMFwNEvj/bDd5OlkLZAzX/nixpBNG0iTqhGueILJSL+DDXm4NSZf 3n7S1xmF8Rl6lMM4re+rPaK2ao8LFbrBRW5oGuP2VnC/bbBA7SWQTZn+DR67AQGGioQw sgzP1HdfejkHaZ3mMKF1u8Lw0B1I2KrCf6gKws302Djj6tWe2RMhARGPWujI+H6/fVOQ /JpQ== 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:subject:cc:to:from; bh=DvI1BcODuVmvV3AojHThvUeg/zNuyS6NBhE2iUuUKRU=; b=l25FaXGPv6sVDg1WHG1jjxqcFomuYqjmZh/aP59xJaVPYtSp6oH1rDuj5lxGlrJGRK aeu2ZJL6EZtGC2eTE/QYRDk/HgSRkBYxRc19wjOYbTgiip77wIgWBgI1iHpsxYt2NjxU +RLQS6JB02FE6C5r5AQ9ftbZrUmX/RCGsbYb84Z3oNqiKiSaur0RsWmPMY7C0oJtAr0C ZA3WZqaPoGcuJL1DUMnx7gVrxU4zphxkQo0gJDyCLbGcTXeVOrVcNwr9cDjwB6aVHu71 gFp2kVxRgqrHeb2V5GY8yGsRsSADa+aPGUTefbVVQK7vhZt5leL4iFtwIZ+92L5yaeGO R9Qg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g24si4888536edm.53.2020.05.12.05.24.35; Tue, 12 May 2020 05:24:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729692AbgELMXW convert rfc822-to-8bit (ORCPT + 99 others); Tue, 12 May 2020 08:23:22 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:48437 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729336AbgELMXU (ORCPT ); Tue, 12 May 2020 08:23:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-152-nNL0z_51Ooqf9-uGLT0vjQ-1; Tue, 12 May 2020 08:23:15 -0400 X-MC-Unique: nNL0z_51Ooqf9-uGLT0vjQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C76C6461; Tue, 12 May 2020 12:23:13 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id BBC657055E; Tue, 12 May 2020 12:23:11 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Adrian Hunter , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH perf/urgent] perf tools: Fix is_bpf_image function logic Date: Tue, 12 May 2020 14:23:10 +0200 Message-Id: <20200512122310.3154754-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 4 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adrian reported that is_bpf_image is not working the way it was intended - passing on trampolines and dispatcher names. Instead it returned true for all the bpf names. The reason even this logic worked properly is that all bpf objects, even trampolines and dispatcher, were assigned DSO_BINARY_TYPE__BPF_IMAGE binary_type. The later for bpf_prog objects, the binary_type was fixed in bpf load event processing, which is executed after the ksymbol code. Fixing the is_bpf_image logic, so it properly recognizes trampoline and dispatcher objects. Reported-by: Adrian Hunter Signed-off-by: Jiri Olsa --- tools/perf/util/machine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 8ed2135893bb..d5384807372b 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -738,8 +738,8 @@ int machine__process_switch_event(struct machine *machine __maybe_unused, static int is_bpf_image(const char *name) { - return strncmp(name, "bpf_trampoline_", sizeof("bpf_trampoline_") - 1) || - strncmp(name, "bpf_dispatcher_", sizeof("bpf_dispatcher_") - 1); + return strncmp(name, "bpf_trampoline_", sizeof("bpf_trampoline_") - 1) == 0 || + strncmp(name, "bpf_dispatcher_", sizeof("bpf_dispatcher_") - 1) == 0; } static int machine__process_ksymbol_register(struct machine *machine, -- 2.25.4