Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp708122lqt; Fri, 19 Apr 2024 08:10:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXEpUZZiqutHy+/MfWM+Ugmvt0j4+21ENTAAcfJlSJxNVXNxGLqktFW+U/XzmysUU/CKovT1NpUYPbQ9s1Z6bKI6CbMdfJ2dENQlhe23A== X-Google-Smtp-Source: AGHT+IFzX3vZyFqSvphb6vfBTbUQQt/WeOnd1rQED98Fl7+hnS5h6zV8DdwW4xdkraeAdWD1M6q3 X-Received: by 2002:a05:620a:2456:b0:78f:a07:a with SMTP id h22-20020a05620a245600b0078f0a07000amr3129114qkn.77.1713539401446; Fri, 19 Apr 2024 08:10:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713539401; cv=pass; d=google.com; s=arc-20160816; b=iHD22gAzAJXapYHMVEAEIWrGLTGRPYb/j6AJ3T8H2bESVS9w1sG+4mMtpIGzx3qbmS RCztad+k7JxowoHmJmbV0k54rSX6nVdZdswnhAQlEKE1wWwid/EVIGJD58TET3bGNOSL Y4bRngvmNWnu06yUrK8A8OjOxeNPXe2C6pkhNt0iKxl41grQgf/kpNcHr0beaSkK9n0v ovlRDTWih0oQNP6/BFHebyz+AkPbB9wX0DMncub34Rdmk4lq5bqGMY47sUk6OE0QW5Wl 3xdKTmK1RXuU9Cl3oHgO9VSjeQtZDsfW2elPb34pvuQip5tGs9+iieEZmLZRIXy0mqBq 3rGA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=M1R59Hufn6h68GvgfRjwULBVNHSNd0ditDBfqU6UMWI=; fh=O0KJc9eaYyDqZQHJD4x8l5H0lozDCatpmWA/4JcEbVg=; b=LYfTv0ugh9GKXRSsvw7tU+4CtxVFCXKjwGNXItAHXx2/LmjeaIHkDe5GhZACiahRFc RU5PGeivlEgUfog1HxwRvk+R8b0Ezm7wMZULf8BmqlXTi98bS9/w3Blfxon3cTshsDmy ss+w/U0Pzf2M9rH32FyMuMk4d58cJADPTqEafUOwogqFlSaDR0J+ywweAP7In6gVdFzt ECMDnB70fBhGWyFBro8MmHcFQqYyvURdfErAdfmMwZlQSqhvmsLF1JyUmx3mCajx8khA 7XcAcWYzJwT52NwojzJPO5dg4LM8jAh4WaqhdxEcsoZAvVhu94edcXEj12lT5X1EV6+G JgXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RToVLT56; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-151632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151632-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a30-20020a05620a439e00b0078f28c558c8si1303817qkp.140.2024.04.19.08.10.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 08:10:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RToVLT56; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-151632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151632-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 10B801C2184A for ; Fri, 19 Apr 2024 15:10:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1997012FB3B; Fri, 19 Apr 2024 15:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="RToVLT56" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65FD712F581; Fri, 19 Apr 2024 15:09:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713539381; cv=none; b=nZKsCV1j/y2zupJLOgbgGq4MEGua2SUm7jihvPnuux8bnZctIs+cQpc6meLcY1IgwSx2x5LKR4RZHYxDO6MeoA0hfc9TsN0kOh4qkwgNDPJ6C9lzqahmYGAacNqQpIIbZ7R+l7c5V2EU1qaIC8JP/xJppI4w9YCDjXd16sZxZn4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713539381; c=relaxed/simple; bh=6XJk3rY1qJPoYVECXyqmHyYKd9afGqEIIO3a1qlmLb0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=VEpJ8HjbUNu9LMuPL8pVoHeCR/996R90Ml09SFb+F9w5f1dm5v+90rS4dYjfs2/H2OUKABPeweYF5/OSs6+SACnGCQFfO9V4tSdgwYAXpTsprJGRq2pISZYiaCXaJYK0JiMxlb6NTneLYMH2r7imsMHFfQnWD1kezhBjDS+/pKY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=RToVLT56; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713539379; x=1745075379; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=6XJk3rY1qJPoYVECXyqmHyYKd9afGqEIIO3a1qlmLb0=; b=RToVLT56jA7pGBEf/PXAN+EZn1oviNJUVFTraSDCz8DaoZ0LAtkDkMwD FyunP+am+TsxzYGmx0QI4GHhP9F9dHQ8NsMdkNvcG1jN0Xwp7L1iEKTey cpIK8csYdw+LJ6tYOZu4qtbJiA3z9om9QnxGPVNBFl56Eqedoj0IBmA6p M7X3C2jw8v5Ij7esgah7o/WSWhvNo++0S16QQf2bwrnxMmtGGNnLRRbSX PEgJRRBH38twwxFPXmP3Ne5tjbofXZXtqoSUpt/iF3QoqAJuIKAl5vNjE eOAKOLFwbt0fs+K2QxinRLLnEU2fnhOCkZ1MdZG5eIoh2OnBOr9uAXHUk g==; X-CSE-ConnectionGUID: 5augMNOoS76gvXVFywGmyA== X-CSE-MsgGUID: ptomYrMDR4WUs3Snpk486A== X-IronPort-AV: E=McAfee;i="6600,9927,11049"; a="20535966" X-IronPort-AV: E=Sophos;i="6.07,214,1708416000"; d="scan'208";a="20535966" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2024 08:09:38 -0700 X-CSE-ConnectionGUID: sbqfLeqBQ4yTveVA/vBecw== X-CSE-MsgGUID: E2HlNsXSQJKu6lxl3xCjhg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,214,1708416000"; d="scan'208";a="46639192" Received: from linux.intel.com ([10.54.29.200]) by fmviesa002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2024 08:09:38 -0700 Received: from [10.212.13.6] (kliang2-mobl1.ccr.corp.intel.com [10.212.13.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id C3D10206DFDC; Fri, 19 Apr 2024 08:09:35 -0700 (PDT) Message-ID: Date: Fri, 19 Apr 2024 11:09:34 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] perf test: Avoid hard coded metrics in stat std output test To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Yicong Yang , Athira Rajeev , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240417183219.1208493-1-irogers@google.com> Content-Language: en-US From: "Liang, Kan" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 2024-04-19 10:40 a.m., Ian Rogers wrote: > On Fri, Apr 19, 2024 at 6:54 AM Liang, Kan wrote: >> >> >> >> On 2024-04-17 2:32 p.m., Ian Rogers wrote: >>> Hard coded metric names fail on ARM testing. >>> >>> Signed-off-by: Ian Rogers >>> --- >>> tools/perf/tests/shell/stat+std_output.sh | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/tools/perf/tests/shell/stat+std_output.sh b/tools/perf/tests/shell/stat+std_output.sh >>> index cbf2894b2c84..845f83213855 100755 >>> --- a/tools/perf/tests/shell/stat+std_output.sh >>> +++ b/tools/perf/tests/shell/stat+std_output.sh >>> @@ -13,7 +13,7 @@ stat_output=$(mktemp /tmp/__perf_test.stat_output.std.XXXXX) >>> >>> event_name=(cpu-clock task-clock context-switches cpu-migrations page-faults stalled-cycles-frontend stalled-cycles-backend cycles instructions branches branch-misses) >>> event_metric=("CPUs utilized" "CPUs utilized" "/sec" "/sec" "/sec" "frontend cycles idle" "backend cycles idle" "GHz" "insn per cycle" "/sec" "of all branches") >>> -skip_metric=("stalled cycles per insn" "tma_" "retiring" "frontend_bound" "bad_speculation" "backend_bound") >>> +skip_metric=($(perf list --raw Default 2> /dev/null)) >> >> >> The "perf list --raw Default" only gives the topdown metrics. >> The "stalled cycles per insn" is not covered. >> The check should skip the line of "stalled cycles per insn" as well. >> >> 3,856,436,920 stalled-cycles-frontend # 74.09% frontend cycles idle >> 1,600,790,871 stalled-cycles-backend # 30.75% backend cycles idle >> 2,603,501,247 instructions # 0.50 insns per cycle >> # 1.48 stalled cycles >> per insn >> 484,357,498 branches # 283.455 M/sec >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/builtin-stat.c#n24 >> >> The newer Intel CPU doesn't have the stalled-cycles-* events. But it >> seems power and older x86 CPU have the events. > > Oh, sigh. This test should really ignore lines like that. How much do > we care about these metrics? The RISC-V event parsing change: > https://lore.kernel.org/lkml/20240416061533.921723-1-irogers@google.com/ > means that legacy hardware events will be uncommon and we need to > adapt the hard coded metrics in stat-shadow.c to json ones. Once they > are json metrics they will be in Default. It seems except the newer Intel CPU, all the other ARCHs support the two stalled-cycles-* events and the metric. For Intel, there are Topdown metrics. But it seems an important metrics for the other ARCHs. RISC-V https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/perf/riscv_pmu_sbi.c#n134 Power https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/perf/power9-pmu.c#n279 Arm https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/perf/arm_pmuv3.c#n53 So almost all json files have to be updated. I'm not sure if it's a practical way to fix the issue. Thanks, Kan > > Thanks, > Ian > >> Thanks, >> Kan >> >>> >>> cleanup() { >>> rm -f "${stat_output}" >