Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13476976ybl; Sun, 29 Dec 2019 12:50:44 -0800 (PST) X-Google-Smtp-Source: APXvYqxI9eBTOcMa7xvEwQlb+MUEu2Uy7pfOhu6gYTYATa/JfGMay/xVSPfnIbqC8hcbtVwnir01 X-Received: by 2002:a9d:7a97:: with SMTP id l23mr67927536otn.34.1577652644769; Sun, 29 Dec 2019 12:50:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652644; cv=none; d=google.com; s=arc-20160816; b=sTzcYfFdU0cCaP3hDoTB/+8me5Tauh9C86lkPvNmnKpVWxOxn2tHiQzLptQYCRFrcE Z8KbE+PuJoCanNNW6G90m5ZLa0T4JEriIoARR7aWZVT3wqCDab3rC0v1f4hvmTm75GLL wkQwFQR7ERBZ3YUVi0x8P3VFQKjKBeGKAIB40S2ixVoHX0FGsVT7cy/zbTbNkngJcR8s jopL4md3IQlJnNLYrz2dzzDQH497fTv5l3v0rPDB3k7d1PY8xcueFOM+owyeAv+e3Zw6 dnLQqvrPfqQrAUnyqYiQ824Qoqg+ASAbO8IrKET0QnJ0BfbrBFqQO2xV1HhFFTkK9XOH HHbw== 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:subject:cc:to :from:dkim-signature; bh=aO1yz3zMeCXXyRusU+zthe/HoZvRXqqbolCRUMq2kik=; b=E/IK08FLjg/uy5oJIMCnWiEJAnscI3nEuq7iMf5wn4ZCnRS/1ZV+5KHevZKEp9b4az 53Tt+J5Deh+eKlKZMMoQqLtsSL2HEyrjRA4s1OpRlLl6PuthRQAFMC5tjFOb15wD7qxd n0sZGTW2CUwZLsi4/YOCIrI7HC1ARMwfLM3zon8QwG7ZlkkaB2PUReTI/mrClZjmdkpN yDyZynL536ZHyzNTVpoFCFEQPtu61VGCZNC78pw+U86YH4LEHmimDwnN84krvTypOsKH sPTDVhaMVVRPdhpa/hv7EsiSXRuxGtFLe55iGN13huVsl1J3ZD0J+msCA9xAy/zGIAMx 1+Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vx+amJTr; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si21004680otk.120.2019.12.29.12.50.33; Sun, 29 Dec 2019 12:50:44 -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=@kernel.org header.s=default header.b=vx+amJTr; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732720AbfL2SFe (ORCPT + 99 others); Sun, 29 Dec 2019 13:05:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:36118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732024AbfL2RvH (ORCPT ); Sun, 29 Dec 2019 12:51:07 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3A1BF206A4; Sun, 29 Dec 2019 17:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641866; bh=Fms0++2fgYIgEPp4j5dKIin41R46jM+7pq9Avku3TKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vx+amJTr/Sb1YSM44XyJNDjU1flI3rALaPNy8wiePvr5ijE3SDWk41wV1cXIKjrOq NuZ0WlKT7MN/36dnwaAmR9dl8/3xoWxZ5qO2GXM+3xi8bZAjIDXUmgzS1YS0dJSkpc ED7OHJ1ma93qVUaInwyr0/KV9DyenF0NrQUvpjbQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Sasha Levin Subject: [PATCH 5.4 245/434] perf probe: Fix to list probe event with correct line number Date: Sun, 29 Dec 2019 18:24:58 +0100 Message-Id: <20191229172718.158972713@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 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: Masami Hiramatsu [ Upstream commit 3895534dd78f0fd4d3f9e05ee52b9cdd444a743e ] Since debuginfo__find_probe_point() uses dwarf_entrypc() for finding the entry address of the function on which a probe is, it will fail when the function DIE has only ranges attribute. To fix this issue, use die_entrypc() instead of dwarf_entrypc(). Without this fix, perf probe -l shows incorrect offset: # perf probe -l probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask+18446744071579263632@work/linux/linux/kernel/cpu.c) probe:clear_tasks_mm_cpumask_1 (on clear_tasks_mm_cpumask+18446744071579263752@work/linux/linux/kernel/cpu.c) With this: # perf probe -l probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask@work/linux/linux/kernel/cpu.c) probe:clear_tasks_mm_cpumask_1 (on clear_tasks_mm_cpumask:21@work/linux/linux/kernel/cpu.c) Committer testing: Before: [root@quaco ~]# perf probe -l probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask+18446744071579765152@kernel/cpu.c) [root@quaco ~]# After: [root@quaco ~]# perf probe -l probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask@kernel/cpu.c) [root@quaco ~]# Fixes: 1d46ea2a6a40 ("perf probe: Fix listing incorrect line number with inline function") Signed-off-by: Masami Hiramatsu Tested-by: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Namhyung Kim Link: http://lore.kernel.org/lkml/157199321227.8075.14655572419136993015.stgit@devnote2 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/probe-finder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index cd9f95e5044e..7c8d30fb2b99 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1578,7 +1578,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr, /* Get function entry information */ func = basefunc = dwarf_diename(&spdie); if (!func || - dwarf_entrypc(&spdie, &baseaddr) != 0 || + die_entrypc(&spdie, &baseaddr) != 0 || dwarf_decl_line(&spdie, &baseline) != 0) { lineno = 0; goto post; @@ -1595,7 +1595,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr, while (die_find_top_inlinefunc(&spdie, (Dwarf_Addr)addr, &indie)) { /* There is an inline function */ - if (dwarf_entrypc(&indie, &_addr) == 0 && + if (die_entrypc(&indie, &_addr) == 0 && _addr == addr) { /* * addr is at an inline function entry. -- 2.20.1