Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1700430imm; Thu, 18 Oct 2018 02:43:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV61uYtO+Qw3kTEUXX77cDhNJ/ZrczsbAarSTWrlaHgaKCUU1gkyuC0izB4MA7gC7NfHuSlHH X-Received: by 2002:a65:56cc:: with SMTP id w12-v6mr5045076pgs.224.1539855824652; Thu, 18 Oct 2018 02:43:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539855824; cv=none; d=google.com; s=arc-20160816; b=QwnbMUWl6T6NS7p6sBpemEa/IHLSbKX0wY+lyPJIOI7dShFFIoPnjnTrLE6dyAWK7M lKAmGnv94hfS1qsuEOa2pv1/agQh/iN0LqJlbEsc+NEjDUHcJ1mNLRy5x8TeOH6IPY8P TBT4NOtivn8FWN0LCO9Opd+DFMXkaWLQlHqRzJbCDG/dFKORRuAoqeIy8GahdWDfI2wS 5A3uIWpqjSmeHjAwZ6I0qBXaQn4uAfwtzF088VYCLmk3s2fOcbYQp/S06cOZAuIVWfFR cc8wOyQE+zBDUgbusWNYR8DF2gp4ty49SFsX+dDv3+oW7gZ9WlWIjajrl8a/5mno4TEP XiaQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=B3I1sd5738ECf9OzdmSvuFVBq8ZAXD7PehztaJuEwrw=; b=iXgmhJY1H4zCzsVWRzdocxOni65+V2NSEftXlqwowX8cOZ9+2MfOXmD0MpSr2pBj5q hwbRgMun5R6rmQ+DR/+4CHwww6+3tJ0/RGC9Czsxg2w2zRiQebUaFuneZuKxhOZJxeL6 9ZNhwtQ9QsIhrCwfgOD0HrjVHZJXyP48JGQAThEjxdoePaDrjqZxaYLVRiyTnEVmrS+Q V4ksEV/03jHkzgnN6qiJKzfNXeAwMntSjGmh73kdoXf6NrSIRFUm24icsnxL/Ecyk9N3 EfV8+mmuisaVQ6wG6me2MDHhV17v8tH5+yJY8aajvjbidO/J7FmnkyJCJVIxXozJjgML pQLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wKzmTsDq; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6-v6si19294967pgp.42.2018.10.18.02.43.28; Thu, 18 Oct 2018 02:43:44 -0700 (PDT) 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=wKzmTsDq; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727620AbeJRRnC (ORCPT + 99 others); Thu, 18 Oct 2018 13:43:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:37362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727363AbeJRRnC (ORCPT ); Thu, 18 Oct 2018 13:43:02 -0400 Received: from devbox (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (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 C673C208E4; Thu, 18 Oct 2018 09:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539855771; bh=TjI+igHuP2XLnbYyYLZfiMS+0GTUUaekiLe0jBwnkAk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=wKzmTsDqqQzMnxx8gy+3/+8uAv/qjMeBJ+/r6YlC1MDSL+MpBuHVEN5WsKWSyXuAg LaojaFRfMoU0rW92JhKoVKt0i6hS9mwCT2xjdfXOR1I2I2MuL+uwP//FyNB9iXsGEO DwdDy7hK1Cm8oR0F+R1Am1nPLnD+6tNBEWNQWpVk= Date: Thu, 18 Oct 2018 18:42:48 +0900 From: Masami Hiramatsu To: Arnaldo Carvalho de Melo Cc: Arnaldo Carvalho de Melo , David Miller , linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Jiri Olsa , Namhyung Kim Subject: Re: perf's handling of unfindable user symbols... Message-Id: <20181018184248.81fa704692a65c0fb471641f@kernel.org> In-Reply-To: <20181017122855.GB31465@kernel.org> References: <20181014.004238.292485794143606801.davem@davemloft.net> <20181015222546.GA2159@redhat.com> <20181015.160246.58484704665215987.davem@davemloft.net> <20181016184506.GB3254@redhat.com> <20181017172226.7274498db2bbe3431c3f4057@kernel.org> <20181017122855.GB31465@kernel.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Oct 2018 09:28:55 -0300 Arnaldo Carvalho de Melo wrote: > Em Wed, Oct 17, 2018 at 05:22:26PM +0900, Masami Hiramatsu escreveu: > > On Tue, 16 Oct 2018 15:45:06 -0300 > > Arnaldo Carvalho de Melo wrote: > > > So, I thought something had changed and in the past we would somehow > > > find that address in the kallsyms, but I couldn't find anything to back > > > that up, the patch introducing this is over a decade old, lots of things > > > changed, so I was just thinking I was missing something. > > > > I tried a gtod busy loop to generate vdso activity and added a 'perf > > > probe' at that branch, on x86_64 to see if it ever gets hit: > > > > Made thread__find_map() noinline, as 'perf probe' in lines of inline > > > functions seems to not be working, only at function start. (Masami?) > > > Thank you for reporting it. Hmm, what happened when you did it? > > I checked some points, but seems no problem. > > (Would you see no line number? or defined event didn't work?) > > So, the problem is with a function in the perf tool that ends up inlined > in five places, then when I ask for a line inside of this function to be > probed, it creates 4 probes, one in each of the function it inlines, > see: > > [root@jouet ~]# perf probe -x ~/bin/perf -L thread__find_map:43 > > 43 return NULL; > } > > 46 al->map = map_groups__find(mg, al->addr); > 47 if (al->map != NULL) { > /* > * Kernel maps might be changed when loading symbols so loading > * must be done prior to using kernel maps. > */ > if (load_map) > 53 map__load(al->map); > 54 al->addr = al->map->map_ip(al->map, al->addr); > } > > 57 return al->map; > 58 } > > struct symbol *thread__find_symbol(struct thread *thread, u8 cpumode, > u64 addr, struct addr_location *al) > > [root@jouet ~]# > > So I know that everytime we look for a mmap in a thread and we find that map, > we get to line 54, lets try to add it: > > [root@jouet ~]# perf probe -x ~/bin/perf thread__find_map:54 > Added new events: > probe_perf:thread__find_map (on thread__find_map:54 in /home/acme/bin/perf) > probe_perf:thread__find_map_1 (on thread__find_map:54 in /home/acme/bin/perf) > probe_perf:thread__find_map_2 (on thread__find_map:54 in /home/acme/bin/perf) > probe_perf:thread__find_map_3 (on thread__find_map:54 in /home/acme/bin/perf) > probe_perf:thread__find_map_4 (on thread__find_map:54 in /home/acme/bin/perf) > > You can now use it in all perf tools, such as: > > perf record -e probe_perf:thread__find_map_4 -aR sleep 1 > > [root@jouet ~]# Hmm, it seems that the line is optimized and spread into 5 places (instructions). "perf probe -x ~/bin/perf -D thread__find_map:54" will show you the actual address where the probes are. Or, you can just dump the /sys/kernel/debug/tracing/uprobe_events. > Now I run 'perf top' and then, on another terminal, run this to get system wide > events to get a few of those probes: > > [root@jouet ~]# perf trace -a -e *perf:*/max-stack=7/ sleep 0.02 > 0.000 probe_perf:thread__find_map_3:(4be2e3) > machine__resolve (/home/acme/bin/perf) > perf_top__mmap_read_idx (/home/acme/bin/perf) > perf_top__mmap_read (/home/acme/bin/perf) > cmd_top (/home/acme/bin/perf) > run_builtin (/home/acme/bin/perf) > handle_internal_command (/home/acme/bin/perf) > main (/home/acme/bin/perf) > 0.023 probe_perf:thread__find_map_3:(4be2e3) > machine__resolve (/home/acme/bin/perf) > perf_top__mmap_read_idx (/home/acme/bin/perf) > perf_top__mmap_read (/home/acme/bin/perf) > cmd_top (/home/acme/bin/perf) > run_builtin (/home/acme/bin/perf) > handle_internal_command (/home/acme/bin/perf) > main (/home/acme/bin/perf) > 0.048 probe_perf:thread__find_map_3:(4be2e3) > machine__resolve (/home/acme/bin/perf) > perf_top__mmap_read_idx (/home/acme/bin/perf) > perf_top__mmap_read (/home/acme/bin/perf) > cmd_top (/home/acme/bin/perf) > run_builtin (/home/acme/bin/perf) > handle_internal_command (/home/acme/bin/perf) > main (/home/acme/bin/perf) > > [root@jouet ~]# > > So it now I'm not being able to reproduce... Erm, nevermind then, I'll report > back if I notice this again... :-) OK, I will wait for your report. > > Thanks for checking, sorry for the noise. Issue reports are always welcome :) Thank you, > > - Arnaldo -- Masami Hiramatsu