Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752678AbcD0Svg (ORCPT ); Wed, 27 Apr 2016 14:51:36 -0400 Received: from mail.kernel.org ([198.145.29.136]:43412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751866AbcD0Svf (ORCPT ); Wed, 27 Apr 2016 14:51:35 -0400 Date: Thu, 28 Apr 2016 03:51:30 +0900 From: Masami Hiramatsu To: Hemant Kumar Cc: Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, Namhyung Kim , Peter Zijlstra , Ingo Molnar , Ananth N Mavinakayanahalli Subject: Re: [PATCH perf/core v4 18/19] perf probe: Allow wildcard for cached events Message-Id: <20160428035130.cbbd7e28701c401057963d5b@kernel.org> In-Reply-To: <5720DC1D.5000800@linux.vnet.ibm.com> References: <20160426090200.11891.43944.stgit@devbox> <20160426090459.11891.41553.stgit@devbox> <5720DC1D.5000800@linux.vnet.ibm.com> X-Mailer: Sylpheed 3.4.3 (GTK+ 2.24.28; 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1795 Lines: 61 On Wed, 27 Apr 2016 21:04:53 +0530 Hemant Kumar wrote: > > > On 04/26/2016 02:34 PM, Masami Hiramatsu wrote: > > Allo glob wildcard for reusing cached/SDT events. This also > > automatically find the target binaries, e.g. > > > > # perf probe -a %sdt_libc:\* > > > > This example adds probes for all SDT in libc. > > Note that the SDTs must have been scanned by perf buildid-cache. > > There is a segfault after applying this patch : > > # perf probe -x /home/hemant/test %marker1 > Segmentation fault (core dumped) > > The problem is there is no group name with this marker and > strglobmatch tries to match entry->pev.group with pev->group (which is > NULL). Thank you for testing! [...] > > +/* Try to find probe_trace_event from given probe caches */ > > +static int find_cached_events(struct perf_probe_event *pev, > > + struct probe_trace_event **tevs, > > + const char *target) > > +{ > > + struct probe_cache *cache; > > + struct probe_cache_entry *entry; > > + struct probe_trace_event *tmp_tevs = NULL; > > + int ntevs = 0; > > + int ret = 0; > > + > > + cache = probe_cache__new(target); > > + if (!cache) > > + return -ENOENT; > > + > > + for_each_probe_cache_entry(entry, cache) { > > + /* Skip the cache entry which has no name */ > > + if (!entry->pev.event || !entry->pev.group) > > + continue; > > + if (strglobmatch(entry->pev.group, pev->group) && > > + strglobmatch(entry->pev.event, pev->event)) { > > Due to the above issue, we can change the above condition to : > if (strglobmatch(entry->pev.event, pev->event) { > if (!pev->group || (pev->group && strglobmatch(entry->pev.group, > pev->group))) > // Do stuff > } OK, I'll fix that. thanks!! -- Masami Hiramatsu