From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B2C61C52D7B for ; Tue, 13 Aug 2024 15:12:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:References:Cc:To:From:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uNaRquM+gUEb0pKk86KM3Zb+qh4ZVa6K8vPWsqTERgs=; b=na8n8OGw23l6v6X9rPx6XYu9lo QHfphoHHOvLKRzyTpApLWQsZVLsq4KYmGq+MtCmgpzaR/4uFYzjLCb22/NW8YS0oGNRPZWv37r8P0 WiPl5+s+73F7Bss6WekTHzk5Gan8uFOmqabu9+m4NxC3llTXCZmqw37+WytfcSkjw0ebfVOlqVnlQ X78IogeqjyHQOy/Pi4BAYXmULwAn4X0lbcceywULGHumOAM8IwaJRXhQC4MeRdFhDx6RyboWo5mQz Tx6do30vKlVM8ZiF6Se2s7im5w2fVApKu2m28dF5tw1UKkkhHkkIrAZmXknQoCCjMEgZHBFhGqbjr qqD9i9jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdtCQ-00000004AEJ-0ekp; Tue, 13 Aug 2024 15:12:38 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdtAn-000000049uX-3G7Y for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 15:10:59 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-36887ca3da2so2774919f8f.2 for ; Tue, 13 Aug 2024 08:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723561856; x=1724166656; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=uNaRquM+gUEb0pKk86KM3Zb+qh4ZVa6K8vPWsqTERgs=; b=HML2PeqO90pQG7DsgoF7lYQbB1BDtwCeAxt4EieuhbWzUwpljWYLF6Rzeg8sTEyItc pO6WOaYDQFbwXUCt/5ZXkQuzarYc4wdUqM49NF1L3xfo+IkOEm0/0KH2GTAkKwtHZL5u nCqpyx2Pb40nGePy91qyG12Nue0pZO9m+uonhOLzetIyNb9kuoAJzRW8VLO0auZAwTNC OAfX0ZM/83RxQaHttnMdPVIWV2ClVGUkBRX2LewwdBOXz8bwFBWFrGqkpQ2Xwtt4tne5 5hpHBcwWsQ/9pjPBZ0AilWe1g58Jq8ihi3WGFqMJwq4bAR9sDF4tNGX5J5GOuvpKzbG9 xuQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723561856; x=1724166656; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uNaRquM+gUEb0pKk86KM3Zb+qh4ZVa6K8vPWsqTERgs=; b=MVs0s46+LOrqbM83VWfQsc3BTN1SSqnN3lfgew4WWyy3nJxr8tjVhQNuL50XQm/Bb4 zqUOnDCFXlfZxLITlRBPPIJijlxnpc/9jqw8399uVpv7C5wkqgl5C5cNqZXwX1rZBHMv a9ndGlVRXvRYVqCjfoBf4O+QslcjS9e5XdeFIKT5muPtpl2lfWpeDtcLuWmr+41n2+hS SPyN8bUIL/UKcK5x4EgfvpXd2TmTZlHzDmxEs8sqW8nJKqV3HIsfHJM70T8h7r46CM5d d2X7xB+DUhsm0+ZHxrF93tLmtPewgSABh4njNX8cBcMn/3Y2f0x1bcaJsIU+ZRFwMmo4 VC6w== X-Forwarded-Encrypted: i=1; AJvYcCUrTEsVp9rgHNVwOFmBiZKQ1fYm4UNHAFFfDcfz5XfQevip91QT/MruVJpNxIkG9JxvPilpt8OWScd3rt5zKMRRF0ECFHgvm/aAylUPE3QJvdH5AcY= X-Gm-Message-State: AOJu0Yw8giE6ux9h3YNbcuuUgmrjwiMSh7PZIVQ6OEo/CUZLd9VKXR9Z 1wxxxsTkZf8fCjlqSAiMM1bLpG0L130p0vHWie4+njbwAi1io+LYkbnCOcb0ufc= X-Google-Smtp-Source: AGHT+IFanGBAh+3UifeFJiJZmUQP8fwxUmBb7RFyv+AjfsrU47xau9UjVEIrnOY5ZlY3yXWI/pOLGQ== X-Received: by 2002:a05:6000:118e:b0:368:4c54:ae27 with SMTP id ffacd0b85a97d-3716cd07857mr2680656f8f.36.1723561856037; Tue, 13 Aug 2024 08:10:56 -0700 (PDT) Received: from [192.168.1.3] ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4cfeefedsm10639103f8f.58.2024.08.13.08.10.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Aug 2024 08:10:55 -0700 (PDT) Message-ID: Date: Tue, 13 Aug 2024 16:10:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/7] perf stat: Make default perf stat command work on Arm big.LITTLE From: James Clark To: Ian Rogers Cc: linux-perf-users@vger.kernel.org, John Garry , Will Deacon , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , Dominique Martinet , Ze Gao , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20240813132323.98728-1-james.clark@linaro.org> <5ac3fc9d-4ed6-46ed-b537-13d27ba46e3b@linaro.org> Content-Language: en-US In-Reply-To: <5ac3fc9d-4ed6-46ed-b537-13d27ba46e3b@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240813_081058_006047_5F6C9F93 X-CRM114-Status: GOOD ( 36.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 13/08/2024 3:45 pm, James Clark wrote: > > > On 13/08/2024 3:35 pm, Ian Rogers wrote: >> On Tue, Aug 13, 2024 at 6:24 AM James Clark >> wrote: >>> >>> The important patches are 3 and 5, the rest are tidyups and tests. >>> >>> I don't think there is any interaction with the other open issues >>> about the uncore DSU cycles event or JSON/legacy hw event priorities >>> because only hw events on core PMUs are used for the default >>> stat command. And also just sharing the existing x86 code works so >>> no big changes are required. >>> >>> For patch 3 the weak arch specific symbol has to continue to be used >>> rather than picking the implementation based on >>> perf_pmus__supports_extended_type() like in patch 5. This is because >>> that function ends up calling evsel__hw_name() itself which results >>> in recursion. But at least one weak arch_* construct has been removed, >>> so it's better than nothing. >> >> Let's not do things this way. The use of strings is architecture >> neutral, means we don't need to create new arch functions on things >> like RISC-V, it encapsulates the complexity of things like topdown > > If the new arch function is an issue that could be worked around by > calling perf_pmus__supports_extended_type() on patch 3 as well? It just > needs a small change to not recurse. > >> events, Apple ARM M CPUs not supporting legacy events, etc. > > If Apple M doesn't support the HW events does _any_ default Perf stat > command (hybrid or not) work? I'm not really trying to fix that here, > just make whatever already works work on big.LITTLE. > >> Duplicating the existing x86 logic, when that was something trying to >> be removed, is not the way to go. That logic was a holdover from the >> hybrid tech debt we've been working to remove with a generic approach. >> >> Thanks, >> Ian >> > > I think all of that may make sense, but in this case I haven't actually > duplicated anything, rather shared the existing code to also be used on > Arm. > > This means we can have the default perf stat working on Arm from today, > and if any other changes get made it will continue to work as I've also > added a test for it. > I would also like to note that (not including the new test) this patchset _removes_ more code than it adds, so to say it duplicates code is a bit unfair. Of course this touches some similar areas to your other change, but that doesn't mean I think we shouldn't continue with that one. I'm still happy to review and test or contribute to that one if you like. I think it just helped me to do it in this order and get this thing in a working state first before the next bigger step. >>> James Clark (7): >>>    perf stat: Initialize instead of overwriting clock event >>>    perf stat: Remove unused default_null_attrs >>>    perf evsel: Use the same arch_evsel__hw_name() on arm64 as x86 >>>    perf evsel: Remove duplicated __evsel__hw_name() code >>>    perf evlist: Use hybrid default attrs whenever extended type is >>>      supported >>>    perf test: Make stat test work on DT devices >>>    perf test: Add a test for default perf stat command >>> >>>   tools/perf/arch/arm64/util/Build   |  1 + >>>   tools/perf/arch/arm64/util/evsel.c |  7 ++++ >>>   tools/perf/arch/x86/util/evlist.c  | 65 ------------------------------ >>>   tools/perf/arch/x86/util/evsel.c   | 17 +------- >>>   tools/perf/builtin-stat.c          | 12 ++---- >>>   tools/perf/tests/shell/stat.sh     | 33 ++++++++++++--- >>>   tools/perf/util/evlist.c           | 65 ++++++++++++++++++++++++++---- >>>   tools/perf/util/evlist.h           |  6 +-- >>>   tools/perf/util/evsel.c            | 19 +++++++++ >>>   tools/perf/util/evsel.h            |  2 +- >>>   10 files changed, 119 insertions(+), 108 deletions(-) >>>   create mode 100644 tools/perf/arch/arm64/util/evsel.c >>> >>> -- >>> 2.34.1 >>>