Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2494707rwb; Mon, 3 Oct 2022 01:17:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7q0OaRbM6nj+eTKRyvYHoOFNbhOZJ/SLUHMk42atItKxWVF8HnBnNkNPDvfPRobNl7VmZj X-Received: by 2002:a17:902:e807:b0:179:fc64:7288 with SMTP id u7-20020a170902e80700b00179fc647288mr20752304plg.137.1664785037296; Mon, 03 Oct 2022 01:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664785037; cv=none; d=google.com; s=arc-20160816; b=nH3Iv+vnHehlxtYv38N79aBJOzWapHfvV0Fv1b/2Cc+s8O9Np1ZzqRliCNyxpt/P9f 0eTALalZkDUs1r6hPz8+tKdeQvWSL1OXhLTYZEcUErmE7dFtMz84ChzqF8/ehGvW1o+K 6DmfyJ9bAEHFwOOXLhDMt18hP8PNPSaTQq/DHPoB2aZGL08+FAqrvlQEx3trpTBOyKcp xsHDWc6beD8DLiqZCyHwDLtzSHlaQXt3sQfBHjz8dnrTjw8jnrQVt3cxh2iQfm6wxDe9 SshL3vEig2yEB78Q0jqCbHQ8005zw31Mv02MExXNcwpL8dujv+2UZ5jE+FG2vTqBszq/ VIMw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5t0GEWtw6uLyYGpEdS3ccS+dXw0vAqJE5HYA/B2/8Vg=; b=iwVrKMV9Sgwk1Oe9ijuColtrj7VwLyyZIswyqXwUckJBDV/kf7ZPuwQwHg1zceoamz 6UCgVaY3MUUzZOVN508ChORQvjfluXq2eOYy88AAWUdaWuGpahpCBIFfpj7tQMg3fTK2 EXDH+dQlZwiwyTodPtyKIYxpriR0FQBzx2BQSlyPf0XBDIUC+KR2eTNnbWAPE6XQxoD1 Om8PS4XBroLWwoUAhetfXUm6CFBi4qO089IDOdNjkMjdnhd97+cv4BkYqYP3TcI+669D CKNuiLI04I95uzdRW+HZsx+rTDxiB9zW/xArgkQZ9bBRyHLK1yvvukj1j2vxpAVvjAGi qT/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eLbi+8Cf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a631d09000000b00434d869e339si9586536pgd.512.2022.10.03.01.17.05; Mon, 03 Oct 2022 01:17:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eLbi+8Cf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231376AbiJCHaS (ORCPT + 99 others); Mon, 3 Oct 2022 03:30:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231396AbiJCH3C (ORCPT ); Mon, 3 Oct 2022 03:29:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5543140CC; Mon, 3 Oct 2022 00:19:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E343AB8058E; Mon, 3 Oct 2022 07:19:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F5F8C433D6; Mon, 3 Oct 2022 07:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781588; bh=Ziz5AkeJLzdodRtgDtJK0okB+h7CejTTfQ1EpE9S5sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eLbi+8CfNX3hB4cUoXNu+vEv5VYfIyGdF5s89dr7kYjGaTW7MVQHgO67q5E86635u 6+6N6rX91hW9ngWwzD4DduD6aKEgRVhPkurgKpbyYDOGrFqobVmQc0y3MpXAs6HKsE KiN2uLqXyKoEoIV0XH1TRXlH7wD1asYecS22pfd0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexander Shishkin , Andrew Kilroy , Andrew Morton , Changbin Du , Denys Zagorui , Fabian Hemmer , Felix Fietkau , Heiko Carstens , Ingo Molnar , Jacob Keller , Jiapeng Chong , Jin Yao , Jiri Olsa , Joakim Zhang , John Garry , Kajol Jain , Kan Liang , Kees Kook , Mark Rutland , Namhyung Kim , Nicholas Fraser , Nick Desaulniers , Paul Clarke , Peter Zijlstra , Riccardo Mancini , Sami Tolvanen , ShihCheng Tu , Song Liu , Stephane Eranian , Sumanth Korikkar , Thomas Richter , Wan Jiabing , Zhen Lei , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 75/83] perf parse-events: Identify broken modifiers Date: Mon, 3 Oct 2022 09:11:40 +0200 Message-Id: <20221003070723.875461580@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ian Rogers [ Upstream commit eabd4523395e4a8f2b049165642801f2ab8ff893 ] Previously the broken modifier causes a usage message to printed but nothing else. After: $ perf stat -e 'cycles:kk' -a sleep 2 event syntax error: 'cycles:kk' \___ Bad modifier Run 'perf list' for a list of valid events Usage: perf stat [] [] -e, --event event selector. use 'perf list' to list available events $ perf stat -e '{instructions,cycles}:kk' -a sleep 2 event syntax error: '..ns,cycles}:kk' \___ Bad modifier Run 'perf list' for a list of valid events Usage: perf stat [] [] -e, --event event selector. use 'perf list' to list available events Signed-off-by: Ian Rogers Acked-by: Andi Kleen Cc: Adrian Hunter Cc: Alexander Antonov Cc: Alexander Shishkin Cc: Andrew Kilroy Cc: Andrew Morton Cc: Changbin Du Cc: Denys Zagorui Cc: Fabian Hemmer Cc: Felix Fietkau Cc: Heiko Carstens Cc: Ingo Molnar Cc: Jacob Keller Cc: Jiapeng Chong Cc: Jin Yao Cc: Jiri Olsa Cc: Joakim Zhang Cc: John Garry Cc: Kajol Jain Cc: Kan Liang Cc: Kees Kook Cc: Mark Rutland Cc: Namhyung Kim Cc: Nicholas Fraser Cc: Nick Desaulniers Cc: Paul Clarke Cc: Peter Zijlstra Cc: Riccardo Mancini Cc: Sami Tolvanen Cc: ShihCheng Tu Cc: Song Liu Cc: Stephane Eranian Cc: Sumanth Korikkar Cc: Thomas Richter Cc: Wan Jiabing Cc: Zhen Lei Link: https://lore.kernel.org/r/20211015172132.1162559-21-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events") Signed-off-by: Sasha Levin --- tools/perf/util/parse-events.y | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index d94e48e1ff9b..467a426205a0 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -183,6 +183,11 @@ group_def ':' PE_MODIFIER_EVENT err = parse_events__modifier_group(list, $3); free($3); if (err) { + struct parse_events_state *parse_state = _parse_state; + struct parse_events_error *error = parse_state->error; + + parse_events__handle_error(error, @3.first_column, + strdup("Bad modifier"), NULL); free_list_evsel(list); YYABORT; } @@ -240,6 +245,11 @@ event_name PE_MODIFIER_EVENT err = parse_events__modifier_event(list, $2, false); free($2); if (err) { + struct parse_events_state *parse_state = _parse_state; + struct parse_events_error *error = parse_state->error; + + parse_events__handle_error(error, @2.first_column, + strdup("Bad modifier"), NULL); free_list_evsel(list); YYABORT; } -- 2.35.1