Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13478285ybl; Sun, 29 Dec 2019 12:52:44 -0800 (PST) X-Google-Smtp-Source: APXvYqxom/0RUkVo+2gPtXj5OjG+wTtHDR6ZxZev6wQnT4BFt97hiI5WfXmkdbFkslPEaqQbTC5A X-Received: by 2002:a9d:5885:: with SMTP id x5mr68728388otg.132.1577652764213; Sun, 29 Dec 2019 12:52:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652764; cv=none; d=google.com; s=arc-20160816; b=HtJo2cEWc/Bc+xhfghMZgmh793Y25IxrE6bmO14iFKYodyv9WnNKqtq/AwtNKsV3d9 nDqVWBGMRQZzGEQJ47u6r1wPGJ2J0GjAxGC5D63ITlZ8MhjlXqHZIOjhNGR7Vlk1p9N6 2s1CPwbVfnVoLxTvy1yMAhQ24AICdkOObWOhEYMc75PMdmqeuYkLaKqIkIsMstwiQzij vAA+EICdHtm5Q2ucaJBHeyduyWI1k+alpOu3twbsYrZ1JbP0hTsRVSOChpJretVsq0Zp AoDnvi7ry5vUlitJUcYHYsT2gO0hT88QuGA9wiV4NPasB4ahZlqUD6hR8JpjNdIO0Epb vc7Q== 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 :content-language:in-reply-to:mime-version:date:message-id:from :references:cc:to:subject; bh=ok97JQXjiEiZ4tWIkH+zSLb5S6muiR0JMv+V8f3m3sg=; b=wwlGFL9XNI5y4Kr7bevDizQGBvM89mVNmYVna11v34XN1H+PXrcS6zsyt0pqfkqNxl vlTjQn4pR8H8W6DO2epzsQRslswdkzdWwXUat1oS8saDtvgOrlezDG2P8eXXhfYTJ819 F2J+RXlY3C3luv/I2VfSxXLCpjWl72/a4bDiixRyTMlq67JO3OoMn0U/yPhAbeL+ccZZ SD80WufvDG2uTlFp6mQkvmMplrn+2wKgeKq4HZN7+XX9SI/PzIm25lQfBwe6W1Ne87rD R7X9+NgJEXmWkm3+wKUd9hZOb+mq2vuPRx0FAKbQuXlhuj1vD4uswk4dbag7lKqhxA5Z rpRA== ARC-Authentication-Results: i=1; mx.google.com; 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 10si19560391ois.76.2019.12.29.12.52.32; Sun, 29 Dec 2019 12:52: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; 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 S1727120AbfL2SkM (ORCPT + 99 others); Sun, 29 Dec 2019 13:40:12 -0500 Received: from mx1.yrkesakademin.fi ([85.134.45.194]:16164 "EHLO mx1.yrkesakademin.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726455AbfL2SkL (ORCPT ); Sun, 29 Dec 2019 13:40:11 -0500 Subject: Re: [PATCH 5.4 252/434] perf probe: Fix to probe a function which has no entry pc To: Greg Kroah-Hartman , CC: , Arnaldo Carvalho de Melo , Arnaldo Carvalho de Melo , Masami Hiramatsu , Jiri Olsa , Namhyung Kim , Sasha Levin References: <20191229172702.393141737@linuxfoundation.org> <20191229172718.657510315@linuxfoundation.org> From: Thomas Backlund Message-ID: Date: Sun, 29 Dec 2019 20:40:09 +0200 MIME-Version: 1.0 In-Reply-To: <20191229172718.657510315@linuxfoundation.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-WatchGuard-Spam-ID: str=0001.0A0C0201.5E08F30B.0009,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-WatchGuard-Spam-Score: 0, clean; 0, virus threat unknown X-WatchGuard-Mail-Client-IP: 85.134.45.194 X-WatchGuard-Mail-From: tmb@mageia.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Den 29-12-2019 kl. 19:25, skrev Greg Kroah-Hartman: > From: Masami Hiramatsu > > [ Upstream commit 5d16dbcc311d91267ddb45c6da4f187be320ecee ] > > Fix 'perf probe' to probe a function which has no entry pc or low pc but > only has ranges attribute. > > probe_point_search_cb() uses dwarf_entrypc() to get the probe address, > but that doesn't work for the function DIE which has only ranges > attribute. Use die_entrypc() instead. > > Without this fix: > > # perf probe -k ../build-x86_64/vmlinux -D clear_tasks_mm_cpumask:0 > Probe point 'clear_tasks_mm_cpumask' not found. > Error: Failed to add events. > > With this: > > # perf probe -k ../build-x86_64/vmlinux -D clear_tasks_mm_cpumask:0 > p:probe/clear_tasks_mm_cpumask clear_tasks_mm_cpumask+0 > > Committer testing: > > Before: > > [root@quaco ~]# perf probe clear_tasks_mm_cpumask:0 > Probe point 'clear_tasks_mm_cpumask' not found. > Error: Failed to add events. > [root@quaco ~]# > > After: > > [root@quaco ~]# perf probe clear_tasks_mm_cpumask:0 > Added new event: > probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask) > > You can now use it in all perf tools, such as: > > perf record -e probe:clear_tasks_mm_cpumask -aR sleep 1 > > [root@quaco ~]# > > Using it with 'perf trace': > > [root@quaco ~]# perf trace -e probe:clear_tasks_mm_cpumask > > Doesn't seem to be used in x86_64: > > $ find . -name "*.c" | xargs grep clear_tasks_mm_cpumask > ./kernel/cpu.c: * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU > ./kernel/cpu.c:void clear_tasks_mm_cpumask(int cpu) > ./arch/xtensa/kernel/smp.c: clear_tasks_mm_cpumask(cpu); > ./arch/csky/kernel/smp.c: clear_tasks_mm_cpumask(cpu); > ./arch/sh/kernel/smp.c: clear_tasks_mm_cpumask(cpu); > ./arch/arm/kernel/smp.c: clear_tasks_mm_cpumask(cpu); > ./arch/powerpc/mm/nohash/mmu_context.c: clear_tasks_mm_cpumask(cpu); > $ find . -name "*.h" | xargs grep clear_tasks_mm_cpumask > ./include/linux/cpu.h:void clear_tasks_mm_cpumask(int cpu); > $ find . -name "*.S" | xargs grep clear_tasks_mm_cpumask > $ > > Fixes: e1ecbbc3fa83 ("perf probe: Fix to handle optimized not-inlined functions") > Reported-by: Arnaldo Carvalho de Melo > Tested-by: Arnaldo Carvalho de Melo > Signed-off-by: Masami Hiramatsu > Cc: Jiri Olsa > Cc: Namhyung Kim > Link: http://lore.kernel.org/lkml/157199319438.8075.4695576954550638618.stgit@devnote2 > Signed-off-by: Arnaldo Carvalho de Melo > Signed-off-by: Sasha Levin > --- > tools/perf/util/probe-finder.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c > index 7857ae7a10b7..4079ed617f53 100644 > --- a/tools/perf/util/probe-finder.c > +++ b/tools/perf/util/probe-finder.c > @@ -994,7 +994,7 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data) > param->retval = find_probe_point_by_line(pf); > } else if (die_is_func_instance(sp_die)) { > /* Instances always have the entry address */ > - dwarf_entrypc(sp_die, &pf->addr); > + die_entrypc(sp_die, &pf->addr); > /* But in some case the entry address is 0 */ > if (pf->addr == 0) { > pr_debug("%s has no entry PC. Skipped\n", > Still broken... /usr/bin/ld: perf-in.o: in function `probe_point_search_cb': /work/rpmbuild/BUILD/kernel-x86_64/linux-5.4/tools/perf/util/probe-finder.c:1012: undefined reference to `die_entrypc' -- Thomas