Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp374893rwr; Wed, 26 Apr 2023 00:05:02 -0700 (PDT) X-Google-Smtp-Source: AKy350ZadKbpOv9w7smy8lAOnVDgFP2ITn1MQeJxAdOsW9Jm2TnkEvIap6Fvjsikqdw5zQL5cuwA X-Received: by 2002:a17:90b:4d8a:b0:246:ac0b:9d45 with SMTP id oj10-20020a17090b4d8a00b00246ac0b9d45mr19054676pjb.18.1682492702528; Wed, 26 Apr 2023 00:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682492702; cv=none; d=google.com; s=arc-20160816; b=ZbVjmekf1sUKlRKyGrL0VCnJbnRVV53G6t1MYrbtAzPlIW+R2iLmcW/EDWmYXxcvvJ p+ZAecwR7Jh1d4oZvMIyF04nB5u1WqCG3A8MGsCSrC3z1c2hdTalfUAG+7+L/TQRbncn nfeV4enHACpTcbtOhHPc7OItfmsZWdXJjyfbLWwPlBzkRNWTMXF9V6NViVfDXTI/Na4h pnyICzDoKgX9RJtSUPprXmG0fNOs9w+VBhZ7n18CZbYr+UyASekU6jKviO0B3ao2ZmKp bOx+2UWeeiengDIFx6RQ6JArKdoOk1shokeQA1s+6zuP4q9R9qeZQClhzJFo6yRbvN8M LedQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=iVN+WtVBinIPas0ggbaTczLlntAFDczu4JgyAZ0ncIE=; b=0AtqQWZxJyTOxnAgsJZanxf89P08+fje8i746giZZPU7aIZMu4VWKbsGUNa7BFIL+F 6IFxh7YeNzmCyER9hKGOLECrLzqlol6Vawxv0xBFHniBz4oh60OsKK9ml7AigOMiOLUi NSe03ssSMle2DMBYTiARqvgYeJ3eajA8kn39SdxyCYccY5jq5AX19QVBNfwpRZgjZ3dQ k+YOdnRw1e62O0Gi7YrMd93Gojhj2uVSroUu/Zi+VUtslSMxXNMLk8HX+JSyA/baQZzJ q470yL8Saitz/P8KGhIWKMejr9CaRuLNoZ4mSBo6t05Y8BxUGXeWKvxZ1koZZQ3U/02K lkug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=VKJsvk7s; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x24-20020a17090abc9800b0024784735e4esi18117119pjr.115.2023.04.26.00.04.48; Wed, 26 Apr 2023 00:05:02 -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=@google.com header.s=20221208 header.b=VKJsvk7s; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239798AbjDZHET (ORCPT + 99 others); Wed, 26 Apr 2023 03:04:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239808AbjDZHDg (ORCPT ); Wed, 26 Apr 2023 03:03:36 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A8D13A82 for ; Wed, 26 Apr 2023 00:02:46 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5529a6f9f28so101472287b3.2 for ; Wed, 26 Apr 2023 00:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682492565; x=1685084565; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=iVN+WtVBinIPas0ggbaTczLlntAFDczu4JgyAZ0ncIE=; b=VKJsvk7sfsTdWRe0vWM/KmnbLXQsbdtRZ1+JEgmzNSG0FDKos+QNepsT1cgFyqWHxs 7C8cnTiz2RnJB+DZ0A9tNM/ufFBzmjZYUXGLPcMZdxg2T+Sv7pP8MDIGGUS4BnYoAL7p GqvJYMvjGJRkBk8AD8UOnD49u6X+irbxyIiH/sDNjmtqYUUcm9UQDJlFphpUNvvuxQWU xwf4LlJqIMG3ZtcMBUccLYO1423riHdGwgvqBrH+6wCxff02KNd/dwWUHZe5ERJioQ5y +KlxnJ5WD3m834lEf4BsMPLJn6a8y5GNd6h/S8H0dal5LiKWc9I62KSyJjVmzEDpdRlC r+Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682492565; x=1685084565; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iVN+WtVBinIPas0ggbaTczLlntAFDczu4JgyAZ0ncIE=; b=D+VB+Zb0wa+1yMhPPIt8p7xE5Tr7wZ3vdrlt3Gd8FkixqiH8CkaMvUas+8Q0P2nufg PxW1VzdJHDurGHELXZ4NpUucD7LJxZdhq8eGClkcjK+b6Ow13GjUFoLk5n/DPg7HaAbF ygmbkVLbIoOTUQxjVsXS0RLGtKTohvdw0r7ZCRAIvIU4uijx5XIsP7UFA8uiXBUx6m3i sMcGNKooKgewKwG2LQ7HI6IfmMKGoA732sysohfpaEhvoRTHzWWB9pZ1Ty85TFZQAx+6 KHyFKIOcOPwlGpn10xTsxv6N4kFzPqRK9gUEN/HhLlJj6IzgLrgDkQDNJmWepw4tN3sX vUrA== X-Gm-Message-State: AAQBX9c7Bs6ejDnVLO/9qq/YWLBufpllfYIqHvb/YL6tETMK4xCJQkrZ uWY83gQxmQMWfBNIqYcy+4VDXertBvdb X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:144f:e890:2b29:48d9]) (user=irogers job=sendgmr) by 2002:a81:a983:0:b0:54f:a35e:e79a with SMTP id g125-20020a81a983000000b0054fa35ee79amr9131447ywh.8.1682492565338; Wed, 26 Apr 2023 00:02:45 -0700 (PDT) Date: Wed, 26 Apr 2023 00:00:23 -0700 In-Reply-To: <20230426070050.1315519-1-irogers@google.com> Message-Id: <20230426070050.1315519-14-irogers@google.com> Mime-Version: 1.0 References: <20230426070050.1315519-1-irogers@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Subject: [PATCH v1 13/40] perf parse-events: Set attr.type to PMU type early From: Ian Rogers To: Arnaldo Carvalho de Melo , Kan Liang , Ahmad Yasin , Peter Zijlstra , Ingo Molnar , Stephane Eranian , Andi Kleen , Perry Taylor , Samantha Alt , Caleb Biggers , Weilin Wang , Edward Baker , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Florian Fischer , Rob Herring , Zhengjun Xing , John Garry , Kajol Jain , Sumanth Korikkar , Thomas Richter , Tiezhu Yang , Ravi Bangoria , Leo Yan , Yang Jihong , James Clark , Suzuki Poulouse , Kang Minchul , Athira Rajeev , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ian Rogers Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 Set attr.type to PMU type early so that later terms can override the value. Setting the value in perf_pmu__config means that earlier steps, like config_term_pmu, can override the value. Signed-off-by: Ian Rogers --- tools/perf/util/parse-events.c | 2 +- tools/perf/util/pmu.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index d71019dcd614..4ba01577618e 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1492,9 +1492,9 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, } else { memset(&attr, 0, sizeof(attr)); } + attr.type = pmu->type; if (!head_config) { - attr.type = pmu->type; evsel = __add_event(list, &parse_state->idx, &attr, /*init_attr=*/true, /*name=*/NULL, /*metric_id=*/NULL, pmu, diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index ad209c88a124..cb33d869f1ed 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1398,7 +1398,6 @@ int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr, { bool zero = !!pmu->default_config; - attr->type = pmu->type; return perf_pmu__config_terms(pmu->name, &pmu->format, attr, head_terms, zero, err); } -- 2.40.1.495.gc816e09b53d-goog