Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2907318ybh; Sat, 25 Jul 2020 05:20:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvxrXnCmC3qNbVJNeIPdEOcF3pZopFzBI2YU8lxx4+QcV5yb76rl1cPcgVxB+FCw8yauUL X-Received: by 2002:a05:6402:1841:: with SMTP id v1mr13241858edy.198.1595679648454; Sat, 25 Jul 2020 05:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595679648; cv=none; d=google.com; s=arc-20160816; b=hk4RcclEHu56kWgQaWTKRBY0yupZN+z6K3ZgFWVeSbZEk1AUONyoTdeGldYPKLX6OH GrTE2gWJb32n7sPjdFo/yjYqOOMbJyxqD0qiLUxnYM+JF6CoMcnXCWgCE8Uh9ez+9Zrq 5V9WoYQHTEldJKfSj3MnDZuaBgMBqSfWrXvPP1nk6fqiRuz+TQsEkk+l8A/h43vEB4w+ eETWQY+R5X7n87B1VQbh50lxhZkQ76FPCS1dee/Ip1KV+uRj/MnbvoFbNnpCPbB1GPwn bTD2Stb0ck3pfqkHwaZnUXI3UoHiTFKQbeZWnz5bPCsKMkVALfQww1ntokWXPkZ3+vaw w0tA== 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 :message-id:date:subject:cc:to:from; bh=0g5zMwotiMjQ637zxmNRfD5hvSv4P7tYu5a0phrusmI=; b=BJEfwyCed3PhpGaJDxr/EHzl/hG/SmLjW0aWwbprOmojV46BBivbZ4HNnhRPPSl4qA X9w9cIW7UPU7XRhgRmasVlPw8SOyv43SqxD9SGwHXqYNtWJLaOlIf+Iz6PROQ9THfgEy KiF/Ktjyv5he18vVXO48HLbSz/fVs3+/ql17XMZbVrPQxXF3LTOzCWepJqvcwJL5xbbR cxEX2ODPRBSom/bTE6zdyBvJJK9zuSyoEXEH8xdoTxoxSznSlK9fEo15yW8gk16ZcwAe myFA074hOvE1SoyyeB0ZwSOyZmQR2v6495hXF4oeo06aAaspII5jKrjKoP8/uN6ARaJO NyqA== 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 x11si2278390edq.363.2020.07.25.05.20.24; Sat, 25 Jul 2020 05:20:48 -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; 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 S1726994AbgGYMUN convert rfc822-to-8bit (ORCPT + 99 others); Sat, 25 Jul 2020 08:20:13 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49518 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726613AbgGYMUN (ORCPT ); Sat, 25 Jul 2020 08:20:13 -0400 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-403-OmdSWnoBOd-4mKuThhLMSQ-1; Sat, 25 Jul 2020 08:20:09 -0400 X-MC-Unique: OmdSWnoBOd-4mKuThhLMSQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64777106B243; Sat, 25 Jul 2020 12:20:07 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.192.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id E38E05D9DC; Sat, 25 Jul 2020 12:20:00 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jin Yao , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Ian Rogers , Stephane Eranian , Andi Kleen , Thomas Richter Subject: [PATCH 1/2] perf tools: Allow r0x event syntax Date: Sat, 25 Jul 2020 14:19:58 +0200 Message-Id: <20200725121959.1181869-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding support to specify raw event with 'r0' syntax within pmu term syntax like: -e cpu/r0xdead/ It will be used to specify raw events in cases where they conflict with real pmu terms, like 'read', which is valid raw event syntax, but also a possible pmu term name as reported by Jin Yao. Reported-by: Jin Yao Signed-off-by: Jiri Olsa --- tools/perf/Documentation/perf-list.txt | 1 + tools/perf/tests/parse-events.c | 5 +++++ tools/perf/util/parse-events.l | 1 + 3 files changed, 7 insertions(+) diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt index 376a50b3452d..10ed539a8859 100644 --- a/tools/perf/Documentation/perf-list.txt +++ b/tools/perf/Documentation/perf-list.txt @@ -119,6 +119,7 @@ It's also possible to use pmu syntax: perf record -e r1a8 -a sleep 1 perf record -e cpu/r1a8/ ... + perf record -e cpu/r0x1a8/ ... You should refer to the processor specific documentation for getting these details. Some of them are referenced in the SEE ALSO section below. diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 895188b63f96..5aaddcb0058a 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -1766,6 +1766,11 @@ static struct evlist_test test__events_pmu[] = { .check = test__checkevent_raw_pmu, .id = 4, }, + { + .name = "software/r0x1a/", + .check = test__checkevent_raw_pmu, + .id = 4, + }, }; struct terms_test { diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 56912c9641f5..44c85fea5d00 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -293,6 +293,7 @@ percore { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PERCORE); } aux-output { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT); } aux-sample-size { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE); } r{num_raw_hex} { return raw(yyscanner); } +r0x{num_raw_hex} { return raw(yyscanner); } , { return ','; } "/" { BEGIN(INITIAL); return '/'; } {name_minus} { return str(yyscanner, PE_NAME); } -- 2.25.4