Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2202111iof; Tue, 7 Jun 2022 23:04:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypr7QotoI5mYeULmiX+VyKJL9ANuz5g/6w/Qzl8bqZezUTGoB9lHgMZVhbGGnq06G0d3E3 X-Received: by 2002:a17:902:868a:b0:168:8e93:5f09 with SMTP id g10-20020a170902868a00b001688e935f09mr3835394plo.57.1654668260532; Tue, 07 Jun 2022 23:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668260; cv=none; d=google.com; s=arc-20160816; b=wjctj99WnaPqh7ALG+F49s3CAi7cS8HY+rV+EetYvNi87TUDmrkZJbOSg3zd8tMAYq 2ZjmhyedTbDXnezsJvULYNGBULVCKL5CMLv43C9y6VU6mr9VFT/OKRrLgbjhOuJq7VSH C/igNhkOKVaEjdwS+L+VyZ6i70yvVvzi1ZnLP4NPNRjs/aSwwvTmVxeTtQ6bTr0RGYdd TOINj1g6l2+UWZ4zrdGJK/IciRpDq92KebaOajrUs/4y1oEDIfHVWgN0TMTuKEjkh47C EFBmkCXKltfIDnAgoMYXaf2GAtgF2rlDoCxWyS0fKMlTMDSzOFBATISov4il//G/HTAc Dj1g== 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=l1q2mIg32NqzW0+KKvfrVfBVgmLMdMHsBHhHR2H64hiVIbC2iikGDnd6+J5hDrG6cE CoMXtHOxLi4P6NyxvsBBWSwKP+LcgsuHXHveh3m5s6dVN8cZzEIT+TM1JkGropoXvyNI NfEhaWUSS447SMNdjpwu+mwrHSttM3btBfwIo6P0NsT66VKex8P0WCCZRoUsn1bQwhs0 d7v+NIAEubtnfChZiI6C2Nn61E3fpFhZ1LwRmZWZypgzpUwYy2LtZGipi09e2h+FtZKp Nzbdla78kjsVlF6Tf9trklK1DrcztSo7BPd5vMykCK3KuWa6D5AJVZOuJzNsRNtVWFcO E7Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CC1KVpWS; 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 d127-20020a636885000000b003fd8a0059a5si6512798pgc.316.2022.06.07.23.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:04:20 -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=CC1KVpWS; 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 6999947B494; Tue, 7 Jun 2022 22:28:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387021AbiFHB1H (ORCPT + 99 others); Tue, 7 Jun 2022 21:27:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382473AbiFGVva (ORCPT ); Tue, 7 Jun 2022 17:51:30 -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 3BF9023BC34; Tue, 7 Jun 2022 12:08:53 -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 627C7618C9; Tue, 7 Jun 2022 19:08:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 482F1C385A2; Tue, 7 Jun 2022 19:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628931; bh=L6/7d3an9St0b/NgFIVefwNBWNQVxznP7DEJrhafcWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CC1KVpWSPJlnPLj7zH8ldI8mjQ/Q7XH3NIZlkfQ7h+jjE6iaN/vXlJKC7pJ76g6g+ OCkPbOygxFxzSURfW8J41yrdLNRy4r0TdxKW6DeNujn/n/xZAylqo/nhjwoj4wbDqU 132pAifNo2JM3x1TLihIbI0A29RzpC7uvoB/bMMs= 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.18 509/879] perf parse-events: Support different format of the topdown event name Date: Tue, 7 Jun 2022 19:00:27 +0200 Message-Id: <20220607165017.648968928@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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