Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2460792lqo; Mon, 13 May 2024 21:49:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUllgxFWvxXwlD1KTCoKQNzdVHpknN4KPQeUM0FVAZt2GF8x5MQPwdG8QxywYyZ30aS2Mw5WkBC1YFuwL2onzIXPWmb3IhcI349XcD/Tw== X-Google-Smtp-Source: AGHT+IFcOAJsjuHDDlgFqySTx3IKaycfwvCefwiMYgBbTmxnzExVhtgAijOweDAPTOoZK7GnfETH X-Received: by 2002:a17:906:1c10:b0:a59:9c2f:c7d4 with SMTP id a640c23a62f3a-a5a1167be68mr1237193966b.19.1715662142257; Mon, 13 May 2024 21:49:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715662142; cv=pass; d=google.com; s=arc-20160816; b=QeFeiYqx5fVebH6KTSWjv6Js8fKIGaKoWh9aDHsDiHx7t2+U3wImwHypWWIVZPuWKj tDxmAbnI/q6nnzqeGs+5X6kF95wnZd3wIyvpfXBytS+j5ZTq89rEs8nwKbKKx2bo1Pth FlHLgDtOjMB7dEtB9tlreBq+kxoSj4Punr2XCrQDb5sltVJf0+cuDGUny3m7KT5Xbsx7 z18ODip1gmnECYuUQNeOBxwzZ+jYfPiswzaQN8igYFDlD+yGsZy6OZRWOxu5z8JoLpPH FBBGxRsIA1/iVbIkh5Ff16O/dMUXkLe8CoSjv024TxEbPklPLe9Krp4FE1QSINNdpkSS GZwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=RXFf6Eq00urqf0wFdNRBo6rl3kq0as0cRcr6U5+BnfU=; fh=HkzdwycAzyheof4VVJWQg7+x6ql6TAni/am4v7NQD5c=; b=ZAj8DpuluLoAJsXmU/uzvawoDeHEfk59S+tN9Qo9XlCVJdrl8Dw2P0jJcpkREtwg9B WSxtO1ZbDuUdifCSDUNjKwIwb3R4XZwUkM5hvuJvgKSvr+wxagkPY4TclpEBs1xwjbsP 3of2pwZ2yVcD80KWnxGmIiUBmfoeqZ6DC/O4c/0NoCizXo4tI6j0DpKG0u1rV9Yww6sL D4XS2W/Us3UGPdWwrnfpYorLAs7j398MlJUpNlRk9PmABqwGk2+a97cBwm7RDQYj9nHZ dbXxvRGXRGCFAActDOano6Bcpa+UwJtwGIWzlVXps/8tkfkdhXizbcULmkyf8mVORUBf ZWvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=zu+u4Faw; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-178311-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178311-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17b21d40si578393166b.462.2024.05.13.21.49.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 21:49:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178311-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=zu+u4Faw; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-178311-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178311-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 00B601F23774 for ; Tue, 14 May 2024 04:49:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88F2614287; Tue, 14 May 2024 04:48:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="zu+u4Faw" Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2C74125AC for ; Tue, 14 May 2024 04:48:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715662135; cv=none; b=rCCevfH8Lx6+gXBvtvyhEvUJDpecShVue70MlhFQj5+CGcmsxuWbGQ4PWffULTfZqtlnvYDaZOosce9MX2RQ63k/fQ5WmPQHfTPHpFQzenJIUs3UOL9lGqTnwSafYuXpMSYY0zfoikgXHiM79LdFlyLno8gwU8xGcF5FiIw+fCM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715662135; c=relaxed/simple; bh=xA6emBQVwVuglSd8BdKXUOzTu+AXBbD0wHHpuBd1VRE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Content-Type; b=ZU7RZ1pLpb5lh5QG31EMqyw/2zB3+pP/jgaxl472EQB5V1lkECz07OfFP7u1mVPqr3Hr4h/iy/5xiS5vnkvM4/XEQ7yGTHZqkuU9HaXXeDovmkdLfrWClqiOSguHJYlQBhkUvRLqPbDGneb0aFvCT+jIdXSyGopIDk9n8DGIXz0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=zu+u4Faw; arc=none smtp.client-ip=209.85.160.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-43df9ac3ebcso1074521cf.0 for ; Mon, 13 May 2024 21:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715662132; x=1716266932; darn=vger.kernel.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RXFf6Eq00urqf0wFdNRBo6rl3kq0as0cRcr6U5+BnfU=; b=zu+u4FawyAFkqJeP3EkVra4NL2EvwFt4KNbJ/e2BsDn6fJvgqv6dKcDdeVyYsdV+We 3+Ndr83vGyHJiBx/ttxIVa+cpOuLtN5L/rBKL3yyjraYMbLja0xNLtf0VTeXyUaoOA7C UjxzyvND6AhUfWQyRZlMAutwupsqZ4xo1FBzS7CMSYk5PrH5YWdKVHwcVpX685jdY6O8 4nVzsr1+09DrHr8jOqbX8HtZJbFIIbFK21JouWopQyuAy8nDzhVBjML1c+jvi4d1by0K 9Q+5S9F41xeaDvOxljocqCek3vB3xKrPcaYgz7UoggBRBH9GOjyTemMqK2bYHjV6S25j MiFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715662132; x=1716266932; h=content-transfer-encoding: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=RXFf6Eq00urqf0wFdNRBo6rl3kq0as0cRcr6U5+BnfU=; b=Zy2ueJT1FYkmhC1BQI9hZNOJbg4F3RZXLw+aEwSQdaMTgIr9JoPm6XReWCx36YU/Wn EayVgm0XUBisAfGRxUESni2dzFhlpQhV1nD/HR6dCj88Y1FZ84KPrftzWm34NK2Y9KYC Abp38Ln3tjWs9Ur6vFj0w4Uvz/TF3yNeDxSqR7ud6MdI5F90tKttiwhj5UEl7bAEnYDe 2U/8LwCVkPvpjXKUo19PFIwm+fO48oFV1im6x77KatiK/iot3qS9fdmBT06qjx7cLhJq bLxkNIMweBVvglyfjpgqiuSWn5hlvtCEnEm1AbILRIKT3EyqGY4wfvlU8L0jBeXNFNy0 1jnw== X-Forwarded-Encrypted: i=1; AJvYcCV7A1wK0sn3SjZLReTgNrL6VrCBemyDV/BlQpEfrBpRU6IZgMLl8uliMH5xI3FNDTB8BBWcTw0Eq4pJnoVzkZX9r1HCPkgiDXT7idl3 X-Gm-Message-State: AOJu0YxpQ1nqZAHt8hafuPJXo6a70Te4Gp/TwYC3Aa7sZgmSN+jSVwN2 SlJp/baW8aREqAFoQYbDgVZUJ64w0Gq3v3hOsCi9rh81tOo7W+uRu+wfPuCtQR4DNNOcDqH28lH ylgqlpzs/7BcFciYB/Xwni4RcKMHiAN3qlKXL X-Received: by 2002:a05:622a:4886:b0:43d:a002:b with SMTP id d75a77b69052e-43e0a1c2014mr6775881cf.9.1715662131679; Mon, 13 May 2024 21:48:51 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240510053705.2462258-1-irogers@google.com> In-Reply-To: <20240510053705.2462258-1-irogers@google.com> From: Ian Rogers Date: Mon, 13 May 2024 21:48:40 -0700 Message-ID: Subject: Re: [PATCH v3 0/5] Event parsing fixes To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , Ravi Bangoria , James Clark , Yang Jihong , Ze Gao , Leo Yan , Song Liu , K Prateek Nayak , Kaige Ye , Yicong Yang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 9, 2024 at 10:38=E2=80=AFPM Ian Rogers wro= te: > > For the default events, parse from strings rather than use pre-cooked > perf_event_attr. This fixes non-x86 heterogeneous CPUs where legacy > hardware events wouldn't be opened for all PMUs. v2 was previously > just patch 3 but it is extended in v3 to incorporate related fixes. > > When a sysfs/json event is used in preference to a legacy event, allow > evsel__match to still function using a saved hardware config > number. This fixes hard coded metrics in stat-shadow for events like > "instructions" on Intel that have a sysfs file. > > Fix/improve uniquifying event names fixing the test "102: perf stat > metrics (shadow stat) test:" that was broken by a formatting issue > when the sysfs instructions event was used. > > Having evsel->pmu_name and evsel->pmu->name is confusing, get rid of > the former. Fix/improve evsel__sys_has_perf_metrics in the process. > > Ian Rogers (5): > perf evsel: Add alternate_hw_config and use in evsel__match > perf stat: Uniquify event name improvements > perf stat: Remove evlist__add_default_attrs use strings > perf evsel x86: Make evsel__has_perf_metrics work for legacy events > perf evsel: Remove pmu_name Hopefully the first 3 patches here can be a priority given the fixes. Thanks, Ian > tools/perf/arch/x86/util/evlist.c | 74 +------- > tools/perf/arch/x86/util/evsel.c | 35 +++- > tools/perf/builtin-diff.c | 6 +- > tools/perf/builtin-stat.c | 291 ++++++++++++------------------ > tools/perf/tests/parse-events.c | 2 +- > tools/perf/util/evlist.c | 46 +---- > tools/perf/util/evlist.h | 12 -- > tools/perf/util/evsel.c | 28 ++- > tools/perf/util/evsel.h | 22 +-- > tools/perf/util/metricgroup.c | 4 +- > tools/perf/util/parse-events.c | 52 ++++-- > tools/perf/util/parse-events.h | 6 + > tools/perf/util/pmu.c | 6 +- > tools/perf/util/pmu.h | 2 +- > tools/perf/util/stat-display.c | 101 ++++++++--- > tools/perf/util/stat-shadow.c | 14 +- > tools/perf/util/stat.c | 2 +- > 17 files changed, 305 insertions(+), 398 deletions(-) > > -- > 2.45.0.118.g7fe29c98d7-goog >