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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 095BCC433F5 for ; Thu, 14 Apr 2022 22:59:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 200B06B0071; Thu, 14 Apr 2022 18:59:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1892A6B0073; Thu, 14 Apr 2022 18:59:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 001CD6B0074; Thu, 14 Apr 2022 18:59:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id E09286B0071 for ; Thu, 14 Apr 2022 18:59:05 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A4839239B7 for ; Thu, 14 Apr 2022 22:59:05 +0000 (UTC) X-FDA: 79357001850.08.2866B63 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by imf02.hostedemail.com (Postfix) with ESMTP id 3A80280005 for ; Thu, 14 Apr 2022 22:59:05 +0000 (UTC) Received: by mail-lj1-f173.google.com with SMTP id c15so7794026ljr.9 for ; Thu, 14 Apr 2022 15:59:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EzeM7BAsGDvC8RGxh6KP5UkbdJMIo4Bz6Mv+RzgiilI=; b=gIH9+zmjc5WxHSlIZjjRbxIis1EEt1oGPhNvkproHTu8kKixtJHImCd2+Hoj23PcNm h/BnmX9FvPQDIubMDf0f0fcW51o8X4HgXVzd/JFD6UdZoJ9kY7lSkvwdcdi2M0SoN7KX Fw/GuD6d/iB38jUXO7lYVAU538pu9cU8arn37yCbiZ6BlIIFXopAsFZpAJ5FR+zUj1JS oTqCkDZhKm6fSXL6pZNq1U9uFkoqs8iYspW9CLrny1pwHhHr8tPexXf9wp5xPvcXABfN JKVaLnzcX0iOmCfedVPqlA7U9aRvBnTMrzCY+q7peS4DonAKYArhq5+M74D130pX8yvQ QDTg== X-Gm-Message-State: AOAM530yOf5BTTZ+uVhbU31veE99BElEv7whUlBodLQ+OL7Cp+DSjniB XHx/KVjsLgmJ4asbSilRx6MEnfABvRJQtkGdqGw= X-Google-Smtp-Source: ABdhPJx6Xdpu15bviN7b/0aQHWOhzbU4fd0nliCy26M7JFa7gVDlAqvyCI0wM7rsq1uAPvzGXlsBlr9nW6tPmruC2qs= X-Received: by 2002:a05:651c:1544:b0:24c:8644:4046 with SMTP id y4-20020a05651c154400b0024c86444046mr2790615ljp.366.1649977143666; Thu, 14 Apr 2022 15:59:03 -0700 (PDT) MIME-Version: 1.0 References: <20220304083329.GC20556@xsang-OptiPlex-9020> <20220413070529.GA1320@linux.intel.com> <85eed89f-e4a8-2887-a0b3-579704304357@linux.intel.com> <74d36e66-5b16-ee10-bcae-171e2b681845@linux.intel.com> In-Reply-To: From: Namhyung Kim Date: Thu, 14 Apr 2022 15:58:52 -0700 Message-ID: Subject: Re: [LKP] Re: [perf vendor events] 3f5f0df7bf: perf-sanity-tests.perf_all_metrics_test.fail To: "Liang, Kan" Cc: Ian Rogers , Carel Si , Arnaldo Carvalho de Melo , Alexander Shishkin , alexandre.torgue@foss.st.com, Andi Kleen , Ingo Molnar , James Clark , Jiri Olsa , John Garry , Mark Rutland , mcoquelin.stm32@gmail.com, Peter Zijlstra , Stephane Eranian , linux-kernel , linux-mm@kvack.org, lkp@lists.01.org, kbuild test robot Content-Type: text/plain; charset="UTF-8" X-Rspam-User: X-Rspamd-Queue-Id: 3A80280005 X-Stat-Signature: u55f3yjr11bd3aji9urk5n45mnbawxg4 Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of namhyung@gmail.com designates 209.85.208.173 as permitted sender) smtp.mailfrom=namhyung@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) X-Rspamd-Server: rspam01 X-HE-Tag: 1649977145-302252 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Kan, On Thu, Apr 14, 2022 at 12:06 PM Liang, Kan wrote: > > > > On 4/14/2022 12:09 PM, Ian Rogers wrote: > > ``` > > $ perf stat -e '{BR_INST_RETIRED.NEAR_CALL,BR_INST_RETIRED.NEAR_TAKEN,BR_INST_RETIRED.NOT_TAKEN,cycles,cycles}:W' > > -a sleep 1 > > Performance counter stats for 'system wide': > > > > BR_INST_RETIRED.NEAR_CALL > > (0.00%) > > BR_INST_RETIRED.NEAR_TAKEN > > (0.00%) > > BR_INST_RETIRED.NOT_TAKEN > > (0.00%) > > cycles > > (0.00%) > > cycles > > (0.00%) > > > > 1.005599088 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. > > ``` > > > > If we add two extra cycles or the original group is smaller then it is "fixed": > > ``` > > $ perf stat -e '{BR_INST_RETIRED.NEAR_CALL,BR_INST_RETIRED.NEAR_TAKEN,BR_INST_RETIRED.NOT_TAKEN,cycles}:W' > > -a sleep 1 > > > > Performance counter stats for 'system wide': > > > > 20,378,789 BR_INST_RETIRED.NEAR_CALL > > 168,420,963 BR_INST_RETIRED.NEAR_TAKEN > > 96,330,608 BR_INST_RETIRED.NOT_TAKEN > > 1,652,230,042 cycles > > > > 1.008757590 seconds time elapsed > > > > $ perf stat -e '{BR_INST_RETIRED.NEAR_CALL,BR_INST_RETIRED.NEAR_TAKEN,BR_INST_RETIRED.NOT_TAKEN,cycles,cycles,cycles}:W' > > -a sleep 1 > > > > Performance counter stats for 'system wide': > > > > 37,696,638 BR_INST_RETIRED.NEAR_CALL > > (66.62%) > > 298,535,151 BR_INST_RETIRED.NEAR_TAKEN > > (66.63%) > > 297,011,663 BR_INST_RETIRED.NOT_TAKEN > > (66.63%) > > 3,155,711,474 cycles > > (66.65%) > > 3,194,919,959 cycles > > (66.74%) > > 3,126,664,102 cycles > > (66.72%) > > > > 1.006237962 seconds time elapsed > > ``` > > > > So the extra cycles is needed to fix weak groups when the nmi watchdog > > is enabled and the group is an architecture dependent size. > > Yes, the size of the group depends on the architecture, but perf tool > doesn't need to know the HW details. For this case, perf tool just sends > the request with an extra cycles event in the group and lets kernel decide. I prefer doing this in the kernel even if it'd be incomplete. For the NMI watchdog, is it possible to check if it's enabled at the moment, and set the fake_cpuc->idxmsk to prevent scheduling events in validate_group()? Thanks, Namhyung