Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp180798ybg; Sun, 26 Jul 2020 00:53:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSeMDMst+Y7tV8/xbujJVl5Dhea7hVZdz3OIbiTldvqjJFcYeQgcJBTB18FOOfK0QY0aRL X-Received: by 2002:a17:906:94c4:: with SMTP id d4mr7346787ejy.232.1595750010942; Sun, 26 Jul 2020 00:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595750010; cv=none; d=google.com; s=arc-20160816; b=S4SP+QabxlV0LraahnNF7wRr14Xcc5ynqg73MK32koaIrNam4upNjsFIkQFjEwKz4q wOhpE1YFPbq8doznTOzPZD/QSas0YFcPVyiwblxbvrW+JOnC/cN1oqT0sNQNWZQX7fOm q9nC2qSFi2O0iy5dN+cyl6r3W1uuXTcz2XRQqXFR8RYfGhvzWz32YlnvRgpelcN5S6c+ WF+6pF37XFHw72/fxB6IjneUUgHR98JydHgzyXQBrQ6zHdm+z/4mAA3O62jl2OuIymdF FVlJxPESV/my1swL1EDh5eXLHeGzJ8dkCPtFKDXNQRzEKh5rtkVsQAIuCNJfLjAdOqvz 9mAQ== 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=OyDUb6QJfAxBiRNPwMJft+S/TNQ5c4j3+cD1YY/i42s=; b=F0pPgWYj1JD1Ozk7Ozw6uLLdFfLejsePt6di9JbfrVM/apt6kApogFBwA0naUry0KQ CdF0YgVeJHw2mzmBKu2A3pIXwHXC6TDX0A7LAC+/zjWgWo7r+CxR11HVnQnUHl6PLaE5 CbeXgDvYBZLZg4uchIA3VDtfpWsPl4RqoEwkOlJm9dH43o9ul/MLmAjooNjs+vfX3Bf7 epgVV4p+SLGuaRXuQ+5brflak/YkJZ9qCVoZ0etOZ0yeFA9C6ARPM94MYUqMC7/3OXG5 3u/81/iC/ZPwRXzqm3lXIDpLdxCOpllED0M0aN687WLfTZNWbvk+zHyzTWmcTQy87qSy 3Vmw== 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 n7si3587548ejl.448.2020.07.26.00.53.06; Sun, 26 Jul 2020 00:53:30 -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 S1725968AbgGZHw6 convert rfc822-to-8bit (ORCPT + 99 others); Sun, 26 Jul 2020 03:52:58 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:34735 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725810AbgGZHw5 (ORCPT ); Sun, 26 Jul 2020 03:52:57 -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-433-gVKgZ9nPPTypYmXIln7SRA-1; Sun, 26 Jul 2020 03:52:50 -0400 X-MC-Unique: gVKgZ9nPPTypYmXIln7SRA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 819318017FB; Sun, 26 Jul 2020 07:52:48 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.192.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id A04F560BEC; Sun, 26 Jul 2020 07:52:45 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jin Yao , Ian Rogers , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Stephane Eranian , Andi Kleen , Thomas Richter Subject: [PATCHv2 1/2] perf tools: Allow r0x event syntax Date: Sun, 26 Jul 2020 09:52:43 +0200 Message-Id: <20200726075244.1191481-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 Acked-by: Ian Rogers 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