Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2181527iof; Tue, 7 Jun 2022 22:24:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLHar7GPQEayolvOBpUpRtVpV89v3s/422j6C3D0l0NEsUm0KiaJBYaYpq5yHct7CbAYYz X-Received: by 2002:a17:90b:4d0e:b0:1e2:bcd7:c68c with SMTP id mw14-20020a17090b4d0e00b001e2bcd7c68cmr35998643pjb.74.1654665870126; Tue, 07 Jun 2022 22:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665870; cv=none; d=google.com; s=arc-20160816; b=vInPhSedpOmbOpgJlkycGJcKolabIXrQ19GZW1Ka+1aV0JXb1z+VTeCecJ/zm9Wrfw vDzon4ypLaRnGw4+Prvp/Kj3MAQWpbgtS8hoQt1utqnb351Evs+gErHhqNbRmcqFGu/U cg3cASLNv7mv3vJr1QwGq75s8TL6VwXZ4A62nrwfHwUm/zaC/58hQaL8NpItawWwBKB8 WZmdIi0++cmhgU7Kn8Cfh3bqB2vJ4+MTiogn+/qqlOLQAz/DFFEutSH+vBKRBi/cQWB0 nM7VOEFXQ2YIkQJO1uGetP/tRwsSQyVszCJ6t1J8okZfyxUlKsiORTGwobJRamwta9sL aqBg== 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=M9vtQdl9RifXhRmXZoNs7HOfrvsyTiIAtYFV9zM7S9Y=; b=dEwk3N82+8sWYEsHzfWpiAhL0doHbcfIXS9GleBab9lzwACv0md+9VmjSH8qydnCuS 2R9gUDRzXes/qD1gyZpZ8SDXcWMEVWWVfgNPGmt6ft5T/mOM9k7mCqG+Vy/u65GDqsj6 L22Ho/idP4amBprXTQBf1WLItwsKGD6MccWjLaAcB7maUKO6VXcokdFw+Xg0FUcsJo0T uZxUcDuPHCDKZ6Xp/MhjoW4DxGCeRe4pIYNclnDfQuiaLAlpSNECzSqqO+RElTRVc9h8 qdS3msbXL2/80G6njDszXPtYDxcyGLEgnfv7aa+/fQsFAJ9dSkc+xxS3vMbjZvJQhIIe R5dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DaInAJeW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g4-20020a655944000000b003fdc5b67013si10592321pgu.735.2022.06.07.22.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:24:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DaInAJeW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D0D1826B947; Tue, 7 Jun 2022 21:51:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378053AbiFGVSt (ORCPT + 99 others); Tue, 7 Jun 2022 17:18:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359256AbiFGUWO (ORCPT ); Tue, 7 Jun 2022 16:22:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08CE31451CA; Tue, 7 Jun 2022 11:31:37 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 80A05612EC; Tue, 7 Jun 2022 18:31:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5934FC385A2; Tue, 7 Jun 2022 18:31:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654626695; bh=L6/7d3an9St0b/NgFIVefwNBWNQVxznP7DEJrhafcWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DaInAJeWGIdCYXzvl6ZUNwCjU0nFtxXgWSsnbnIHc1t7ak0CL2YvH6TkA61qMee5c r9AZTl7w6efsf3epISH6qfQR0aw5NZ8c/bICzkaqaIT6ocT35FykVl9v8A5nKPKqwm kmbZdtA4gbKK+s2EsikVF3CyI7+lOHQ7Us3NmNCM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Kan Liang , Adrian Hunter , Andi Kleen , Ingo Molnar , Jiri Olsa , Namhyung Kim , Peter Zijlstra , Stephane Eranian , Xing Zhengjun , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.17 431/772] perf parse-events: Support different format of the topdown event name Date: Tue, 7 Jun 2022 19:00:23 +0200 Message-Id: <20220607165001.702676452@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Kan Liang [ Upstream commit e7d1374ed5cb346efd9b3df03814dbc0767adb4e ] The evsel->name may have a different format for a topdown event, a pure topdown name (e.g., topdown-fe-bound), or a PMU name + a topdown name (e.g., cpu/topdown-fe-bound/). The cpu/topdown-fe-bound/ kind format isn't supported by the arch_evlist__leader(). This format is a very common format for a hybrid platform, which requires specifying the PMU name for each event. Without the patch, $ perf stat -e '{instructions,slots,cpu/topdown-fe-bound/}' -a sleep 1 Performance counter stats for 'system wide': instructions slots cpu/topdown-fe-bound/ 1.003482041 seconds time elapsed Some events weren't counted. Try disabling the NMI watchdog: echo 0 > /proc/sys/kernel/nmi_watchdog perf stat ... echo 1 > /proc/sys/kernel/nmi_watchdog The events in group usually have to be from the same PMU. Try reorganizing the group. With the patch, $ perf stat -e '{instructions,slots,cpu/topdown-fe-bound/}' -a sleep 1 Performance counter stats for 'system wide': 157,383,996 slots 25,011,711 instructions 27,441,686 cpu/topdown-fe-bound/ 1.003530890 seconds time elapsed Fixes: bc355822f0d9623b ("perf parse-events: Move slots only with topdown") Reviewed-by: Ian Rogers Signed-off-by: Kan Liang Cc: Adrian Hunter Cc: Andi Kleen Cc: Ian Rogers Cc: Ingo Molnar Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Xing Zhengjun Link: https://lore.kernel.org/r/20220518143900.1493980-4-kan.liang@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/arch/x86/util/evlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/arch/x86/util/evlist.c b/tools/perf/arch/x86/util/evlist.c index cfc208d71f00..75564a7df15b 100644 --- a/tools/perf/arch/x86/util/evlist.c +++ b/tools/perf/arch/x86/util/evlist.c @@ -36,7 +36,7 @@ struct evsel *arch_evlist__leader(struct list_head *list) if (slots == first) return first; } - if (!strncasecmp(evsel->name, "topdown", 7)) + if (strcasestr(evsel->name, "topdown")) has_topdown = true; if (slots && has_topdown) return slots; -- 2.35.1