Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp55684pxb; Tue, 2 Mar 2021 18:59:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxs9k9L/7Sf/J0A0pPWqQCPTyemIqa0C20qOfciPN8scIbnq/x6ok+odPxcHLzgYrq2vYw/ X-Received: by 2002:a05:6402:3049:: with SMTP id bu9mr17137941edb.104.1614740384569; Tue, 02 Mar 2021 18:59:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614740384; cv=none; d=google.com; s=arc-20160816; b=GqTBTCd3Hq0jx+a1xQsxqf8e0b+27/2x0jGyYtO9DO8R8AHaoSR2bKLWeWcOTXSRqS 45avsVzO5hpDNwERefJbj+f8vjjRWuSDJrfbCRSuU/8HifM4zrm563x8nJNqB0nlwBu0 +h7eezZVS9dP+8Sd4EuSzxiKwVJgkID2uMCIIkVytBnjb9L+5H47q7oJMPkRidNwxnB3 uzbyVqaQ8i4zT/8Oo2jYb4n15tR9++LaQzMgNC0voR0L8fTerZrIi6nYlbL3Q8WLpFOl kvDlvSLXTPKShnt3r+EFhRJlW+21hXr+HE61NjySyu1qKWU3bh8Nl//tyKY2f3aEZtvN uhBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=RV9ZjGem5Cj1rL9QMZE9OWoR37y1yO0KkWELsAPGeNY=; b=U9U+1F8xMEimJFyxu8FZwqYPwE+Gk6NakFGwOutY25FLIyuStYqk6f61B1UqDslc95 wV48+L7ml1yks88/JzGrqfSrF7gwdMMXdf0Je+uG6HYCqvguN5DiWc15nmRfgrU0ZuLd av1QK7lMB6x/3hl/nCF9LUw7SenWNdH2CSEwHW18txRlpYnQI1vy0omMd5E7daf44Bln N/dwbMf44Q50ZU6lAFK7nHqZrpNit78elFdG9FhtW3sbmuR/rFuhlJ97mBEtMWuHiMNg EtC08rUrhXAvF2SMB7ya6cJ0pJhAkCZw9aCvqSYF02GVQW3V6ix1HNTae5YMckA54yfw pZMg== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b12si11854261edn.71.2021.03.02.18.59.15; Tue, 02 Mar 2021 18:59:44 -0800 (PST) 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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232871AbhCAMYV convert rfc822-to-8bit (ORCPT + 99 others); Mon, 1 Mar 2021 07:24:21 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:26053 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232363AbhCAMYR (ORCPT ); Mon, 1 Mar 2021 07:24:17 -0500 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-452-WOGKyZHtPzWtnZOLOtgx3A-1; Mon, 01 Mar 2021 07:23:22 -0500 X-MC-Unique: WOGKyZHtPzWtnZOLOtgx3A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2D1EC801965; Mon, 1 Mar 2021 12:23:20 +0000 (UTC) Received: from krava.cust.in.nbox.cz (unknown [10.40.192.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDEB05C1C4; Mon, 1 Mar 2021 12:23:16 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Chris Wilson , Jin Yao , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Ian Rogers Subject: [PATCH] perf tools: Fix event's pmu name parsing Date: Mon, 1 Mar 2021 13:23:15 +0100 Message-Id: <20210301122315.63471-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset=WINDOWS-1252 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jin Yao reported parser error for software event: # perf stat -e software/r1a/ -a -- sleep 1 event syntax error: 'software/r1a/' \___ parser error This happens after commit 8c3b1ba0e7ea, where new software-gt-awake-time event's non-pmu-event-style makes event parser conflict with software pmu. If we allow PE_PMU_EVENT_PRE to be parsed as pmu name, we fix the conflict and the following character '/' for pmu or '-' for non-pmu-event-style event allows parser to decide what even is specified. Cc: Chris Wilson Fixes: 8c3b1ba0e7ea ("drm/i915/gt: Track the overall awake/busy time") # 1 Reported-by: Jin Yao Signed-off-by: Jiri Olsa --- tools/perf/util/parse-events.y | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index d5b6aff82f21..d57ac86ce7ca 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -89,6 +89,7 @@ static void inc_group_count(struct list_head *list, %type PE_EVENT_NAME %type PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE %type PE_DRV_CFG_TERM +%type event_pmu_name %destructor { free ($$); } %type event_term %destructor { parse_events_term__delete ($$); } @@ -272,8 +273,11 @@ event_def: event_pmu | event_legacy_raw sep_dc | event_bpf_file +event_pmu_name: +PE_NAME | PE_PMU_EVENT_PRE + event_pmu: -PE_NAME opt_pmu_config +event_pmu_name opt_pmu_config { struct parse_events_state *parse_state = _parse_state; struct parse_events_error *error = parse_state->error; -- 2.29.2