Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2072502lqe; Tue, 9 Apr 2024 08:48:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUt7Gmlykby9v8bO6jGYk22tNI80dEE53coztU3Iol/fceWMzSaBZuOljXm3BUpuU3bnLVVvY5Vm/jgO6hfp7hWv1Qk+fL7eHiTu9cfNQ== X-Google-Smtp-Source: AGHT+IFghBd0DTprHi+XR9V8invVuJnDOu9tPEjAdUVoCr+6/P91Apo9QA66jLUSCI3BXnFZH0HC X-Received: by 2002:a05:6a20:3214:b0:1a7:55f2:c92c with SMTP id hl20-20020a056a20321400b001a755f2c92cmr189252pzc.45.1712677706119; Tue, 09 Apr 2024 08:48:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712677706; cv=pass; d=google.com; s=arc-20160816; b=cfgHT58C+hr5c9KpYcmyUrGiC38bAr4L3BeEv+YUvxQtKusZspiA5BSK5LD4vf0Qiv zZ3G/VFSZZEgJPQ3l+v+kH8ekAxOzTR7uYZ7xGABasW884I5tSJz2pDUuEYY0dh5wd+9 DOMKH4yiIfxLUvqKkt+vNbgo7cXy2VU4K8jnKmf7/WctvtFLnfjqPWxEZdAqZzDenJ5Q y54I/ySAQZOBfUffj5O4Axzf8EIH+vp4f/G0Y8DD6Iier79Kc9eZwCAaWPk6CwQ9PPhX 6Q0Yszmba0GSbC8d1/3ZI7kIMOv5Euqx+oKVQ1nbGEZnOC93ApDDPwY7RpVxOAGDgsMk FMBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=E0puCatRq0DqyA1/imYz3YosP+4LfQJpZakwVvO0S4E=; fh=GybvI0tAfWbsGt8Uy0dx5GjhU0j/bksz7wnG/jjuqGw=; b=vBuqWTPDvmuGXuhEpyEHNIxuYMw+OtZGEwn5f+aYX1kwvMYQhazIBqM5saa4sapaOB moePVh2+R4K52h96xA53JEAXzSJekYpTw0UdaKJRR+WBMG2Qu1lmcW0XoIS+gWvCU2N/ hqRTNWQI0S8U+iEQze68Tt7vd+F0nqki8m6dEXSm68UVeO4Zth3n8GELvgFPk7y63Mkd E3CJNzRwmoAWCXlV9rp9kqz1KXeeEpLe/Io3BcEieFqgkZBaLJCYvZDg9rfxgHwVRoUz XDBFwi/5GOOy/BUVj4Q4kGA93TUuUtJSfzjHKTdPKnZxzfsRx9JRb15CGYiV2ILjTocX Hkqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=knhlVV0a; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-137260-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id r7-20020a62e407000000b006ecfa1f4c39si8491715pfh.169.2024.04.09.08.48.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 08:48:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137260-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=knhlVV0a; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-137260-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AAC5E29504C for ; Tue, 9 Apr 2024 15:48:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71FF313B2A9; Tue, 9 Apr 2024 15:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="knhlVV0a" Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1B84136E1F for ; Tue, 9 Apr 2024 15:46:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712677605; cv=none; b=U6b3jvwbdKRgC1mk23dr2WNb1PvysZSfO5G3Ay7STsialfqmAK5bP/a3zcWj6N7WCLT2QyNp081IIIono0ZdaoaKomhE3GAsKw3Qw15o+gcRfuBctIDNotRxUwPzWX80bex+iVACyq7PvZdwhMoLOeCEjDBt0yIOkpzsb1Xnfoc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712677605; c=relaxed/simple; bh=ImqAvE5DqPsCmdddnql+7QuydKOmyUgd30+SWAWpb6Y=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=KfUltLRSfnPf97CzroaQRTdwLSDQ8J37GfWOAqdgLnBgzlqv/BghEFzb4ogPAG6dFYgrqWolCdd1smPdF3zodvj57J286I8OHHt4QuR11qHaEvGvjaets7nNVUFSQjd2kzgWqaivh6ixKxnp7MDkF7/qaoU0FkzOaoR0r8dndrU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=knhlVV0a; arc=none smtp.client-ip=209.85.166.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-il1-f179.google.com with SMTP id e9e14a558f8ab-36a0c8c5f18so194885ab.0 for ; Tue, 09 Apr 2024 08:46:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712677603; x=1713282403; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=E0puCatRq0DqyA1/imYz3YosP+4LfQJpZakwVvO0S4E=; b=knhlVV0ato9jox8yYj+LB9o1aM3GDjt+Hune3nawzFPLts2+747Ut/nIsL/6RfLrNn RLkU1mAZ5AbLg2H8/8T4W5hjAM7PWz3Yq4ARmtZ0ykaB+M6nCAhkMsNcmspKJ8p+FNaW PhstDOHW30yF+nM/uyZ8j4K1hH0JKYqH9uVvEnmRhY9AB2Jexj/FYYvPBx852pB8xmJQ 4wYyTnNNcmm9fl/LaUQejmcPUnWtmZzK1T3ASowxk8gyio9Kh5LOgwAD8w1yY9UoCp8u 36mpyu95CrCqzuEWMctdWhFXldsiruRQPlXKLqahKOKWG/eB25InyIx1AGyP56QuRpyt EkNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712677603; x=1713282403; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E0puCatRq0DqyA1/imYz3YosP+4LfQJpZakwVvO0S4E=; b=EvEAdSifQyJE8/VHcintTAf2B6KmPQli/bA9oxp6tLutheFPZrF0EeA0/eBrd39pgA Vd2q6OTOLT/9LrHl7w+tEG1Mm4PGiHm5PPbJA1UFn+kYAvQLEM2FfEgp2nsjyRM/Lefs XpAMbcMpVmzV1+yjDRnZrV22w+fyA8kKepdcPfks3gu4gfDlSIW/aojxFJQyH/t+IxMK 1smPEj1YkZp7B7f9nzS0Mof78W/T+SZuF/01BwlUphmu9ZOG4GaDQzvyi6+CgHZt7vrK 5dJslVYJau7MIQ5YYoODhhh+PnO5oYjEvsWpZ01bnGs43asY/Va82h+BIl+8ONO3/juH w0Pg== X-Forwarded-Encrypted: i=1; AJvYcCU76NjBmnyUctHCDLElk+Y8781/LIU4pctwrO8ySM78SPTVsWxre/coQLDJaF3QZz/86JB9joQThWN9JzVDoCFknVp8PVZowRlmKqLj X-Gm-Message-State: AOJu0YxBktlIKQk7d78ww7IxO5Re36xgcLIiO5BTvgsbYA8/6Ai9hXSP vH6cDYn2qsSAKCdBXGhhjqAYoSJSZOZRFu0IwWoRRdvkQXCCi+50cDmgEl3Ye3hkC7FsINRhoGc m8Ub8jORdLvMQwSKRkbZX5DMHyZssJ/yW6HAN X-Received: by 2002:a05:6e02:1d02:b0:369:eca2:1a43 with SMTP id i2-20020a056e021d0200b00369eca21a43mr307178ila.8.1712677602814; Tue, 09 Apr 2024 08:46:42 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Ian Rogers Date: Tue, 9 Apr 2024 08:46:31 -0700 Message-ID: Subject: Re: BISECTED: perf test 'Miscellaneous Intel PT' failing on Intel hybrid machines To: Arnaldo Carvalho de Melo Cc: Adrian Hunter , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 9, 2024 at 8:34=E2=80=AFAM 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-nex= t) > > 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_ev= ent_attr.type" > > > > This reverts commit 82fe2e45cdb00de4fa648050ae33bdadf9b3294a. > > =E2=AC=A2[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.xAC= V6V7Hn4/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 flag= s 0x8 =3D 5 > pid 0 cpu -1 fd 6 : sys_perf_event_open: pid 0 cpu -1 group_fd -1 flag= s 0x8 =3D 6 > pid 304377 cpu -1 fd 7 : sys_perf_event_open: pid 304377 cpu -1 group_f= d -1 flags 0x8 =3D 7 > pid 304380 cpu -1 fd 8 : sys_perf_event_open: pid 304380 cpu -1 group_f= d -1 flags 0x8 =3D 8 > pid 304378 cpu -1 fd 9 : sys_perf_event_open: pid 304378 cpu -1 group_f= d -1 flags 0x8 =3D 9 > pid 304381 cpu -1 fd 10 : sys_perf_event_open: pid 304381 cpu -1 group_= fd -1 flags 0x8 =3D 10 > pid 304377 cpu -1 fd 11 : sys_perf_event_open: pid 304377 cpu -1 group_= fd -1 flags 0x8 =3D 11 > pid 304380 cpu -1 fd 12 : sys_perf_event_open: pid 304380 cpu -1 group_= fd -1 flags 0x8 =3D 12 > pid 304378 cpu -1 fd 13 : sys_perf_event_open: pid 304378 cpu -1 group_= fd -1 flags 0x8 =3D 13 > pid 304381 cpu -1 fd 14 : sys_perf_event_open: pid 304381 cpu -1 group_= fd -1 flags 0x8 =3D 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 =3D NULL; + + if (perf_pmus__num_core_pmus() <=3D 1) + return false; + + while ((pmu =3D perf_pmus__scan_core(pmu)) !=3D 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 =3D __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 =3D 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)? Thanks, Ian