Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1225526imm; Tue, 5 Jun 2018 10:59:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLKDAXlpQDlNc692BJrh38e8l/zn3kj+Hz18MjJ7eo/Mq/p0e9hkwMb58mLYDDZt6jTYfjX X-Received: by 2002:a62:2044:: with SMTP id g65-v6mr9742000pfg.40.1528221567297; Tue, 05 Jun 2018 10:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528221567; cv=none; d=google.com; s=arc-20160816; b=Nx0B0FlMmHtSqHwf06xxowbFpgQpuijqbzv++RWWP8p8TeFz46Nwny0V+TLBHWZPet eQbstdQinqVMfKYrhCauGIWaYW+vZjvZMzFrpkL3O+TdEx0tdgp2/mVlgMP7KdckYgHp e4/RRDQdH9SY/vMjwf0+dPbR8CQMSX62Ku3xJQEUBXLDmNDslUkjyPWxrpFeboxxSKW4 dMxP6n2AZdG2XP8Cd9tEH8HjBsPowS1mlzGQCLO06L8lokj9A2pizMp8JYWQaqC9saKY XBJBil2qrwohtCiZdtj9eMjOxtrd3bLFAXq79LNZ4Bfxg9bi1JFmLEGoaQVKXsnbXsg8 Y6Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=D8du726ysUkSHwPRajy15ZbdASTZdCi89QHMYRlGedE=; b=vAEqfotI1VvJxMyMIZzQT208UU55htGnSGHB+tUtnZcQZtey9VWodsWbFKy0Z74UuA 2jwzaE+eLkQPNJicp0N4u3tN0T7xZ1AKavzOiZnlrBP15YuIDjrrtxvzQ0aYqhLCX70N iFawyEPZGwbW7HePKFInWqPzCKJOdlPLr3m/ryGOJ06GoyDm/+Re9mS36JWnGsEN0Eit e+TCv+ciJaK5K9XJmNtAdeg0vb98VnwqiCobuz96sLlbK3UnGtU5ssoZY4JjFcAfKWXd 9qu0d/d2I4gCj/Bm+QcCAoysQCME8zRrmAX9mxAK51yrq+ck+49a2glPKLIDdAPi1yYr kMIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YQgf8hP1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 92-v6si48648139pli.280.2018.06.05.10.59.13; Tue, 05 Jun 2018 10:59:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YQgf8hP1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1753261AbeFER52 (ORCPT + 99 others); Tue, 5 Jun 2018 13:57:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:46600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752976AbeFERwd (ORCPT ); Tue, 5 Jun 2018 13:52:33 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C55C42083B; Tue, 5 Jun 2018 17:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528221153; bh=JBBkLqdn9ZSCFvNlC//YXi6kseNtU82Q7uKuyIEUytU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YQgf8hP1yRXGcdEEqFvZufYtHXylmnMxZObzV+4UqgioI9u9elA0xeH+w3pV6ZNnq k+5b3RaftDswtXKTgN9cNePBQHrOgeU2oy8JuKPybOmnpqlr4wmXkadI0sN9q0IOGW 13koGIGnwXjDIB9TbkZ57lycrcbLNdNO4duzUJc8= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Jiri Olsa , Adrian Hunter , Alexander Shishkin , David Ahern , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 38/46] perf tools: Fix pmu events parsing rule Date: Tue, 5 Jun 2018 14:50:22 -0300 Message-Id: <20180605175030.32549-39-acme@kernel.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180605175030.32549-1-acme@kernel.org> References: <20180605175030.32549-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Olsa Currently all the event parsing fails end up in the event_pmu rule, and display misleading help like: $ perf stat -e inst kill event syntax error: 'inst' \___ Cannot find PMU `inst'. Missing kernel support? ... The reason is that the event_pmu is too strong and match also single string. Changing it to force the '/' separators to be part of the rule, and getting the proper error now: $ perf stat -e inst kill event syntax error: 'inst' \___ parser error Run 'perf list' for a list of valid events ... Suggested-by: Adrian Hunter Signed-off-by: Jiri Olsa Tested-by: Arnaldo Carvalho de Melo Cc: Adrian Hunter Cc: Alexander Shishkin Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20180605121416.31645-1-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-events.y | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index e37608a87dba..155d2570274f 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -73,6 +73,7 @@ static void inc_group_count(struct list_head *list, %type value_sym %type event_config %type opt_event_config +%type opt_pmu_config %type event_term %type event_pmu %type event_legacy_symbol @@ -224,7 +225,7 @@ event_def: event_pmu | event_bpf_file event_pmu: -PE_NAME opt_event_config +PE_NAME opt_pmu_config { struct list_head *list, *orig_terms, *terms; @@ -496,6 +497,17 @@ opt_event_config: $$ = NULL; } +opt_pmu_config: +'/' event_config '/' +{ + $$ = $2; +} +| +'/' '/' +{ + $$ = NULL; +} + start_terms: event_config { struct parse_events_state *parse_state = _parse_state; -- 2.14.3