Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp21841rdb; Thu, 5 Oct 2023 15:14:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQAI4ZGwdj9tPkDGXEkXZH502CTxr2x6x0bNDlwLV2CU8LW6PNABJKdKLayOGYG0sZciCo X-Received: by 2002:a05:6830:102:b0:6bd:c865:a618 with SMTP id i2-20020a056830010200b006bdc865a618mr6959929otp.13.1696544044382; Thu, 05 Oct 2023 15:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696544044; cv=none; d=google.com; s=arc-20160816; b=le4Ahuz6KNpOX2c1Pt97LHx26RFNGJwh/dL5BW5kE54yhpq00xJky13I0PeENvnkw4 X3B/9U80NZ34Fh2LQgISTyv+iRCP6k4b22pje4MwpB6c51B/BM0wvVnZavwCy5X8YF37 K2gZ5vae68zfvamc/Hu/GcQ5+E/8I0P+HKtgc7dzk7E/0FYVaHLfJOVvasL82bJzKuQe 4iVrcHEbEO+1yV+y5mR1XFCpigIddWELazc2k99ugjZOdEvp44Ci8NIutI0E4I6s2BiC VUoL63VJbQMFU+z7ubdVRTf5Fw80Tf5lOqmDcsxdAHlt63PWaXVjQPD/zhYZTNgGWy0U 7BZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+b693Y1Dasdqb+Bvft8PNzQSfqB0Z0L3RovrSOC+5XI=; fh=ammZ2PpVw6E4QaQQnYsXql69KPEaC1zsHmotVTNth30=; b=nfnA463aPMJBvFzbnb59RqrSbmeH4TVVQGJ4pU5OlRy2TsbP34C39mQ/fXOpaYs6GA HbJnNCyNcGOh82v1AQq1pTTfERqzbPypND6FZ1QjJYBbVrqCjKYLTr6Dc6YfX2Icb8j8 F+qHH8sr2Y8OekhCEOyEzf7AmW+UwUfCzdpEtFL/xr5aPPuG+EgvT7RiuTQw0OnwjAQZ XCzvcI6AH0OIrtVTLtdfrL7muPNU9pFZoDcWH++GtG6kGhbhyI2LG2ktpcIMP63c/+Vz iea85+GobtRbqDFrpa109ig9HD5rhk7K1iNFNUGpFQwv2uNVnsNR5ZEpAGlVuV970ggO zq+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=sCLwAeaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id o2-20020a634102000000b00573ed0023e1si2320971pga.333.2023.10.05.15.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 15:14:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=sCLwAeaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 8D1918082CF0; Thu, 5 Oct 2023 15:14:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229799AbjJEWNx (ORCPT + 99 others); Thu, 5 Oct 2023 18:13:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbjJEWNw (ORCPT ); Thu, 5 Oct 2023 18:13:52 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 103389E for ; Thu, 5 Oct 2023 15:13:51 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-502f29ed596so2288e87.0 for ; Thu, 05 Oct 2023 15:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696544029; x=1697148829; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+b693Y1Dasdqb+Bvft8PNzQSfqB0Z0L3RovrSOC+5XI=; b=sCLwAeaz0t9ZjGeS6R9zkR2xjglgBaa07fBOA3jdnfyFwNwfMs9N3rp8DTF0+3ITwe tP8W3cwBEW2vY95SCt6k5nkC+5mEkN+yGLuokbLLNbqxvyk+fTo81/bCePqTZ1Dgvof0 AbJm7Lc98b7upM8f7FCp4SXHlGEk00bHJe5lUcpMUtw7jEZ1doUgWKz9u/6RHnIJrFze b5ApZ1zBWVD3OHw8J2x/WB2LiUm2bPCa4wpvlAa/WZsBxWvRkrBAyLNmcBao6w5eNmo0 pNhFvLehK9Qfqsid+9ApsLKr89jASI4BBI781BqZzLfzoEACtdMQq4G0/bFPo3Z+xRVT bBcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696544029; x=1697148829; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+b693Y1Dasdqb+Bvft8PNzQSfqB0Z0L3RovrSOC+5XI=; b=dfbcbla83Nz56NZMzoY9QZPlz9fxpQEqcg8aKpeMlo3x2XA5nBfWxGPGPKQ5eYXsGG JfqQvCqmlZs/2O58cxIelmpboidn5B6hqxmFImpsPq0tDNI+Pj/+ByCxSoxtnFnvSsoK Yelp0k49OPnVV5rWSs4GVYNn/YEEMQ4Xh3/bQgSTqJlL15rGleuWMepFXqYEYb0PpsTg my5aHtlj89ojaqbJJhvkw6KKHF/knffrSW6CYdkmvsq+CJWJ4Lygn03gCTIBuOOpufPA YAuTTPLILDQhVsIzOINBgZSFXt/jb0QYNuSWLiPEpL2bUbSZ7r9xIWKncrRaCzPz79y8 zqeA== X-Gm-Message-State: AOJu0YxR1RbMjwtW0iaybrc8lCi2CbRS5uBpCYlEugE66o7YFY0TUjBA sdZcN9NBuJIiGZA0CG5iBNJPnqN7k+O77syqOyNQSQ== X-Received: by 2002:ac2:59c2:0:b0:501:b029:1a47 with SMTP id x2-20020ac259c2000000b00501b0291a47mr84104lfn.1.1696544029164; Thu, 05 Oct 2023 15:13:49 -0700 (PDT) MIME-Version: 1.0 References: <20230928004431.1926969-1-irogers@google.com> In-Reply-To: <20230928004431.1926969-1-irogers@google.com> From: Ian Rogers Date: Thu, 5 Oct 2023 15:13:37 -0700 Message-ID: Subject: Re: [PATCH v1] perf parse-events: Fix for term values that are raw events To: Arnaldo Carvalho de Melo , Kan Liang , Namhyung Kim Cc: James Clark , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Adrian Hunter , Alexander Shishkin , Jiri Olsa , Ingo Molnar , Mark Rutland , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 05 Oct 2023 15:14:01 -0700 (PDT) On Wed, Sep 27, 2023 at 5:44=E2=80=AFPM Ian Rogers wro= te: > > Raw events can be strings like 'r0xead' but the 0x is optional so they > can also be 'read'. On IcelakeX uncore_imc_free_running has an event > called 'read' which may be programmed as: > ``` > $ perf stat -e 'uncore_imc_free_running/event=3Dread/' -a sleep 1 > ``` > However, the PE_RAW type isn't allowed on the right of a term, even > though in this case we just want to interpret it as a string. This > leads to the following error on IcelakeX: > ``` > $ perf stat -e 'uncore_imc_free_running/event=3Dread/' -a sleep 1 > event syntax error: '..nning/event=3Dread/' > \___ parser error > Run 'perf list' for a list of valid events > > Usage: perf stat [] [] > > -e, --event event selector. use 'perf list' to list available= events > ``` > Fix this by allowing raw types on the right of terms and treat them as > strings, just as is already done for PE_LEGACY_CACHE. Make this > consistent by just entirely removing name_or_legacy and always using > name_or_raw that covers all three cases. > > Fixes: 6fd1e5191591 ("perf parse-events: Support PMUs for legacy cache ev= ents") > Signed-off-by: Ian Rogers Ping. As this is affecting IcelakeX, Kan? Thanks, Ian > --- > tools/perf/util/parse-events.y | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-event= s.y > index 4d9f3922a33d..de098caf0c1c 100644 > --- a/tools/perf/util/parse-events.y > +++ b/tools/perf/util/parse-events.y > @@ -78,7 +78,7 @@ static void free_list_evsel(struct list_head* list_evse= l) > %type PE_MODIFIER_BP > %type PE_EVENT_NAME > %type PE_DRV_CFG_TERM > -%type name_or_raw name_or_legacy > +%type name_or_raw > %destructor { free ($$); } > %type event_term > %destructor { parse_events_term__delete ($$); } > @@ -669,8 +669,6 @@ event_term > > name_or_raw: PE_RAW | PE_NAME | PE_LEGACY_CACHE > > -name_or_legacy: PE_NAME | PE_LEGACY_CACHE > - > event_term: > PE_RAW > { > @@ -685,7 +683,7 @@ PE_RAW > $$ =3D term; > } > | > -name_or_raw '=3D' name_or_legacy > +name_or_raw '=3D' name_or_raw > { > struct parse_events_term *term; > int err =3D parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE= _USER, $1, $3, &@1, &@3); > @@ -765,7 +763,7 @@ PE_TERM_HW > $$ =3D term; > } > | > -PE_TERM '=3D' name_or_legacy > +PE_TERM '=3D' name_or_raw > { > struct parse_events_term *term; > int err =3D parse_events_term__str(&term, $1, /*config=3D*/NULL, = $3, &@1, &@3); > -- > 2.42.0.515.g380fc7ccd1-goog >