Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp179638ybg; Sun, 26 Jul 2020 00:50:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq3CYaeFp9nDF+RatEwFg/Ry8dsXtM1SR9SJqMX5hihvIr+sM3mSBOCCoRkIeDnUcMKPlm X-Received: by 2002:a17:906:6146:: with SMTP id p6mr9451954ejl.211.1595749825428; Sun, 26 Jul 2020 00:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595749825; cv=none; d=google.com; s=arc-20160816; b=VRQ9VnwDwl33E+BFAg5L8ToJ1olD6bnW3MbOAD8GwGx2FfxDbBqqtFY8bzaybPnsu9 vyHDdxdPzzxRr1Q5bzRFQJjbmcGM5PUT2VItCGIyxiyWCMWOQHDqVW6XkyxJJFKr37Lt 9FUXvTpv1ZJei4kWZk9tIRt4IQF0i3JjuHbNukQh+9M5MAnynfBndSX4s2nDlDVnJZWT cV6BuTbzi23hXHEmos+47wKqs5FbPK3s9rtNom+K4i74A0131+Pvwch1lULAryrUV81Y tbIEIlvw7QvzmVmKGC0DYt65R/+cLmr0mfisH32OHuNrGeX13r6QEiXO9A0TcXM/51WA mEHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Qlfvn5Nkzs/xgydDaV2BwGMzu9w0jWBrrqGBm93HJbs=; b=ARyku8vxU2oloN4GZheHHldTxl9F0tiXeg4nMCvAhcT+V2zuPEzxMqUNCHlSbAfH6B oUhjcsPJm+YYes2wfmPKzexOQUKkrXKOsJ4gRXT2F1u1tmQOs2WK3GGNRcyWE9H+YEXY txG7qpt5koXb1e0nd3sFgH9kMWyvjSR/DiCssr/5WZi2pcCrKzkQC1jDEF95a5HpbKUO zzLA9kDvEU6rzRoRn7B7vEDy81gBegHU6scl/zrjOJEm83EXTgYTKDl7lxgKW5lYlMXh 2TD7k1HekPGyORlXUAj3DKnHKooWea7Rc5n7sqn04y797NxbqLXiqt1bURadukZUBhzU dYug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eCjgtJ8A; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y26si1309722edr.390.2020.07.26.00.50.03; Sun, 26 Jul 2020 00:50:25 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eCjgtJ8A; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726807AbgGZHrv (ORCPT + 99 others); Sun, 26 Jul 2020 03:47:51 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:38615 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725789AbgGZHrv (ORCPT ); Sun, 26 Jul 2020 03:47:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595749670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Qlfvn5Nkzs/xgydDaV2BwGMzu9w0jWBrrqGBm93HJbs=; b=eCjgtJ8AVjBvc2K+ZeFKTjGCKoIcjbMS3Zpx3l9laahpn2gdcDJBs1vCmv6q1ZJVloV004 ygWs11GrYJK0z9LzbMQ6tluRz9TqU1vzQKanHHvwsE5da/UkmzTsYDkiFblxnWCebpxbX0 pZGsuKDYkSHsFm54wVxiARWoe+eE/X4= 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-117-pX0ffD0OP7a3O4HIXceqVg-1; Sun, 26 Jul 2020 03:47:46 -0400 X-MC-Unique: pX0ffD0OP7a3O4HIXceqVg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB09E59; Sun, 26 Jul 2020 07:47:43 +0000 (UTC) Received: from krava (unknown [10.40.192.47]) by smtp.corp.redhat.com (Postfix) with SMTP id 5ABBA89516; Sun, 26 Jul 2020 07:47:39 +0000 (UTC) Date: Sun, 26 Jul 2020 09:47:37 +0200 From: Jiri Olsa To: Ian Rogers Cc: Jiri Olsa , Arnaldo Carvalho de Melo , Jin Yao , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Stephane Eranian , Andi Kleen , Thomas Richter Subject: Re: [PATCH 2/2] perf tools: Fix term parsing for raw syntax Message-ID: <20200726074737.GB1175442@krava> References: <20200725121959.1181869-1-jolsa@kernel.org> <20200725121959.1181869-2-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 25, 2020 at 09:58:13AM -0700, Ian Rogers wrote: SNIP > > ret = parse_events_terms(&terms, t->str); > > if (ret) { > > pr_debug("failed to parse terms '%s', err %d\n", > > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c > > index e88e4c7a2a9a..254f02a7fb0d 100644 > > --- a/tools/perf/util/parse-events.c > > +++ b/tools/perf/util/parse-events.c > > @@ -2019,6 +2019,27 @@ static void perf_pmu__parse_init(void) > > perf_pmu__parse_cleanup(); > > } > > > > +int perf_pmu__test_parse_init(void) > > +{ > > + struct perf_pmu_event_symbol *list; > > + > > + list = malloc(sizeof(*list) * 1); > > + if (!list) > > + return -ENOMEM; > > + > > + list->type = PMU_EVENT_SYMBOL; > > + list->symbol = strdup("read"); > > + > > + if (!list->symbol) { > > + free(list); > > + return -ENOMEM; > > + } > > + > > + perf_pmu_events_list = list; > > + perf_pmu_events_list_num = 1; > > + return 0; > > +} > > nit: It's easy to see in the test code why this is necessary, could > the function be moved there? If not perhaps add a function comment? > The test in the function name is quite load bearing. both perf_pmu_events_list/cnt are static and I'd like to keep it that way, so the function needs to be in here.. I'll add comment explaining this jirka