Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2191322lqe; Tue, 9 Apr 2024 12:05:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxwJ+/i6vXFY4nzlf216ADDVYHakLvjpoVgabqxj0gNWTZGeA3SP/wmATK/rkeA3xjWlYPfjaXxn5BI21zsYjdU7Hj6BQCkQMgrdCKkQ== X-Google-Smtp-Source: AGHT+IEaYUYvE617kUfNck9XBUpVcmkER0zmel85WvGLFw0FaZASbOUSVFkl7UQfamkZUmzxMVPW X-Received: by 2002:a17:902:f68f:b0:1e3:c9f6:c4b with SMTP id l15-20020a170902f68f00b001e3c9f60c4bmr843779plg.10.1712689558007; Tue, 09 Apr 2024 12:05:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712689557; cv=pass; d=google.com; s=arc-20160816; b=wwWysWFWuAvKfeDE2a7P8Wbg429qYLM4f2qbf4LHz/U1X4fi3DIovLSwTleAeRPyJ5 /N7b3QylCy2q4GjMPFyA0HoAEPt9JQsRIet9Z5OjXn9THAholq7x4tMdWBknP8I9PFjD kH/vRLk+ZwXzi/NlnGb8unGfYTPPbgwIJU2w9VLbarCdvsNSVdfjnpjTCAmECIMuw8AU VoM2zktD8+rLquaVka+DO+SVCFGc+6YJGBmGoABnManV/3E1qIeoFhst6hKo67oY741z RRfEePdW55bbm1rdxAs/4UzMa2B0nOgxj60sklzY7aU5EqTv+829xmaI/F8tupT2US1I vV4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=Lqa4WwrtmzrNS3FsnW9l41xK75vG6XKZkadMNACqaOY=; fh=nb/HeCGzK27gwZgVsvKQvVNhY+GlaaEYZBuFZUdcUi4=; b=rnhw559WAWV8cU+fOVpFAL3RSnscSrdusRIVnqSVTo3/Irc7ii2p+QP29M5jpfqwtP YcP5oLutBPlfYcQ/9gmF270jQPfs1RoGUsbHkyI9zqTHJzUVYcJ6MiAlNcEzKc1eGlBl 3rpHlrW/K0VV0cRQtYzRqMxRom+W8L/YtyjIs/+TLjtIaiS8NcyT4aOGyjVrc77VIBxn LwyIIe0RHPixdeVc7xaLShl9sPNZzfB8XfwfRuAQhpd3/AUMke16pzxbBCPl7ieJVNVl t0bSronXesWmsL4XANgEcLrelm0FD9BLlswJQ6OS0HikbjDR0V4FfDMomR4O4qiurd7N o19g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cgzzHIhX; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-137497-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137497-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ju14-20020a170903428e00b001e2a41d265esi8669310plb.324.2024.04.09.12.05.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 12:05:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137497-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cgzzHIhX; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-137497-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137497-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C33BFB22A09 for ; Tue, 9 Apr 2024 19:05:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0792156F5D; Tue, 9 Apr 2024 19:05:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cgzzHIhX" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (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 0804E130A72; Tue, 9 Apr 2024 19:05:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712689543; cv=none; b=t5F1Tl/Tvc8C14G+tLDhz7woZiqSqwNxml1x/9PMH6QbXN73DoO9hoPaS9GW7PeYsOLGYbAge+6TIZ2f1k8EL0N05qBgXwk+QxJZp4i8pMSc7T0AQrCI+cdzmXb3O9bmsTUbJNuMcfdiHPjDdFGpdiK5hNksQ4lc4D6/EiSUfX8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712689543; c=relaxed/simple; bh=WyswoSsvIFf1la8mXA7G3ZXsWxfOhh+9HBZ5KAn38/E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=bDlqnU05NIBDCExhHqj4jR8Kf4hW8reV7ydxQyWnTxtOVPl9kBJx3L2LWP7YMNDOMlTdx6StXXvJslcxSKqZmYHer3I+luImk6Luc3vcG12ZallkN8Ijv9tlcSVMSaCgDlu3b4dR7TQGDS2pmYySQ/iXd/2vrM+tYCvSoMBvIUo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=cgzzHIhX; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712689542; x=1744225542; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=WyswoSsvIFf1la8mXA7G3ZXsWxfOhh+9HBZ5KAn38/E=; b=cgzzHIhXUi/1xr575ddRt8Fu2Xf95zbWJM4yBZhNilgSfre/lkbAn8+r Nrnsp7AFLvgGQkCcMvZ7xBQLYBhBNj/JNCsMThuXMTixxbKgfjeE3/qLx odHFvZzFlZyJAkYMugKg8+xIInnt5Rm3LKwL77+C4uC1pD+4nwBrPYSl0 qYs5G0j6WgmoFlC6Ce+tn+xe4rfJtRTg0MV+IwkVlTxi9UfGxFiR3JiAE qD0z3bWitEWycv98KAFR0Hq10LRBiuQkHXSGLkIBhsQnH3rDNE7IUfQUE agbeRfVZ6sZhXLO7tfunqnJpR0wJsnyL2Qc/c6QCJzqqhFySWtac8Q4n4 A==; X-CSE-ConnectionGUID: YasGmnlFT5CvXiIXhTfGrw== X-CSE-MsgGUID: ZfDnH9ypTcKJKwpbpOamHg== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="7873369" X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="7873369" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 12:05:41 -0700 X-CSE-ConnectionGUID: xjZ6p92kTHu5/R1Jm6DVRg== X-CSE-MsgGUID: 3VaAkvRGR+6lSw83hNOQFQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="24797805" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.249.37.26]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 12:05:39 -0700 Message-ID: <3a816064-ed40-496c-95ab-79753c64b5b6@intel.com> Date: Tue, 9 Apr 2024 22:05:32 +0300 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: BISECTED: perf test 'Miscellaneous Intel PT' failing on Intel hybrid machines To: Ian Rogers , Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, Linux Kernel Mailing List References: Content-Language: en-US From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 9/04/24 18:46, Ian Rogers wrote: > On Tue, Apr 9, 2024 at 8:34 AM Arnaldo Carvalho de Melo wrote: >> >> On Tue, Apr 09, 2024 at 12:32:06PM -0300, Arnaldo Carvalho de Melo wrote: >>> root@x1:~# perf test "Miscellaneous Intel PT testing" >>> 112: Miscellaneous Intel PT testing : FAILED! >>> root@x1:~# >>> >>> then I revert: >>> >>> commit 642e1ac96aaa12aeb41402e68eac7faf5917a67a (HEAD -> perf-tools-next) >>> Author: Arnaldo Carvalho de Melo >>> Date: Tue Apr 9 12:28:49 2024 -0300 >>> >>> Revert "perf pmus: Check if we can encode the PMU number in perf_event_attr.type" >>> >>> This reverts commit 82fe2e45cdb00de4fa648050ae33bdadf9b3294a. >>> ⬢[acme@toolbox perf-tools-next]$ >>> >>> It works now: >>> >>> root@x1:~# perf -v >>> perf version 6.8.g642e1ac96aaa >>> root@x1:~# perf test "Miscellaneous Intel PT testing" >>> 117: Miscellaneous Intel PT testing : Ok >>> root@x1:~# >>> >>> Investigating, if you come up with ideas, lemme know. >> >> Some more context: >> >> When this patch was implemented/tested I had access only to an ARM64 >> hybrid machine, now my notebook is a Rocket Lake lenovo (13th gen), that >> is hybrid and the test is failing with: >> >> root@x1:~# perf test -v "Miscellaneous Intel PT testing" >> 112: Miscellaneous Intel PT testing : >> --- start --- >> test child forked, pid 304355 >> --- Test system-wide sideband --- >> Checking for CPU-wide recording on CPU 0 >> OK >> Checking for CPU-wide recording on CPU 1 >> OK >> Linux >> [ perf record: Woken up 1 times to write data ] >> [ perf record: Captured and wrote 1.934 MB /tmp/perf-test-intel-pt-sh.xACV6V7Hn4/test-perf.data ] >> OK >> --- Test per-thread recording --- >> Workload PIDs are 304377 and 304378 >> perf PID is 304389 >> Waiting for "perf record has started" message >> OK >> pid 0 cpu -1 fd 5 : sys_perf_event_open: pid 0 cpu -1 group_fd -1 flags 0x8 = 5 >> pid 0 cpu -1 fd 6 : sys_perf_event_open: pid 0 cpu -1 group_fd -1 flags 0x8 = 6 >> pid 304377 cpu -1 fd 7 : sys_perf_event_open: pid 304377 cpu -1 group_fd -1 flags 0x8 = 7 >> pid 304380 cpu -1 fd 8 : sys_perf_event_open: pid 304380 cpu -1 group_fd -1 flags 0x8 = 8 >> pid 304378 cpu -1 fd 9 : sys_perf_event_open: pid 304378 cpu -1 group_fd -1 flags 0x8 = 9 >> pid 304381 cpu -1 fd 10 : sys_perf_event_open: pid 304381 cpu -1 group_fd -1 flags 0x8 = 10 >> pid 304377 cpu -1 fd 11 : sys_perf_event_open: pid 304377 cpu -1 group_fd -1 flags 0x8 = 11 >> pid 304380 cpu -1 fd 12 : sys_perf_event_open: pid 304380 cpu -1 group_fd -1 flags 0x8 = 12 >> pid 304378 cpu -1 fd 13 : sys_perf_event_open: pid 304378 cpu -1 group_fd -1 flags 0x8 = 13 >> pid 304381 cpu -1 fd 14 : sys_perf_event_open: pid 304381 cpu -1 group_fd -1 flags 0x8 = 14 >> fd 7 : idx 0: mmapping fd 7 >> fd 11 fd_to 7 : idx 0: set output fd 11 -> 7 >> fd 8 : idx 1: mmapping fd 8 >> fd 12 fd_to 8 : idx 1: set output fd 12 -> 8 >> fd 9 : idx 2: mmapping fd 9 >> fd 13 fd_to 9 : idx 2: set output fd 13 -> 9 >> fd 10 : idx 3: mmapping fd 10 >> fd 14 fd_to 10 : idx 3: set output fd 14 -> 10 >> Checking 10 fds >> No mmap for fd 5 > > Thanks Arnaldo, so the reverted change is: > ``` > --- a/tools/perf/util/pmus.c > +++ b/tools/perf/util/pmus.c > @@ -4,6 +4,7 @@ > #include > #include > #include > +#include > #include > #include > #include "debug.h" > @@ -492,9 +493,35 @@ int perf_pmus__num_core_pmus(void) > return count; > } > > +static bool __perf_pmus__supports_extended_type(void) > +{ > + struct perf_pmu *pmu = NULL; > + > + if (perf_pmus__num_core_pmus() <= 1) > + return false; > + > + while ((pmu = perf_pmus__scan_core(pmu)) != NULL) { > + if (!is_event_supported(PERF_TYPE_HARDWARE, > PERF_COUNT_HW_CPU_CYCLES | ((__u64)pmu-> > type << PERF_PMU_TYPE_SHIFT))) > + return false; > + } > + > + return true; > +} > + > +static bool perf_pmus__do_support_extended_type; > + > +static void perf_pmus__init_supports_extended_type(void) > +{ > + perf_pmus__do_support_extended_type = > __perf_pmus__supports_extended_type(); > +} > + > bool perf_pmus__supports_extended_type(void) > { > - return perf_pmus__num_core_pmus() > 1; > + static pthread_once_t extended_type_once = PTHREAD_ONCE_INIT; > + > + pthread_once(&extended_type_once, > perf_pmus__init_supports_extended_type); > + > + return perf_pmus__do_support_extended_type; > } > > struct perf_pmu *evsel__find_pmu(const struct evsel *evsel) > ``` > On your Intel this should have previously returned true as > "perf_pmus__num_core_pmus() > 1", and with the new code presumably > is_event_supported is returning false. Could you dump the PMU's name > at that point? Is cpu_core or cpu_atom looking like it doesn't support > the event? Is the test failing when run as root (ie is > is_event_supported failing to have expected fallback paths)? Problem is the test scrapes debug output and is_event_supported() prints out debug that confuses the test. Other probe functions like in perf_api_probe.c use sys_perf_event_open() so the issue has not arisen before.