Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp799743rdb; Thu, 18 Jan 2024 21:57:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKch54W5vEgYdsosuoBY4WaePLsBoEocFq5FBD24S3A1OKdJK+5+i8w8f02trTVdbhc+OV X-Received: by 2002:a2e:a583:0:b0:2cc:e766:eeec with SMTP id m3-20020a2ea583000000b002cce766eeecmr1364821ljp.45.1705643877480; Thu, 18 Jan 2024 21:57:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705643877; cv=pass; d=google.com; s=arc-20160816; b=j5rhOOuQMB3z0htc7wT9H44ogjTHZ1M6cKO6HfuUGymC3vPres6JUdbphMR/fLQ1KF ISsSHmo+YFIwhPxLRheIb4USTT2RmkC7iQ7ybXBQW0Z8yAUTXrtxSf+XMKTCnXTBYWMi B1dwE7MwT96m1vslDAj0JNtHYncjCbGqV42U0o4A+Oi1Jc41OnJxDOYxb9J5a946831M ez4Cr5OEoVfLjLEDkV575YNDt6HMeSsfaZvrcKOw6WTebKr4EqL3p88goUf7BMZHj4CK jT76jU9O4/dYLCS1VdEgLn+4S09q/UJsCvmj0DPqyYIEggmUpUAl8rhdxifpaZJ1Rzuo GFvw== 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; bh=pTo9VBdYCTdMSnliyvMcXcpJ1UufCYRIjm4qXNyfvm4=; fh=sEXSHIthxddUnOXT96gIr+W+R5seyOBykfbdKP96IF0=; b=RUa5zGRiUqmQbOFSKeaFVUKzgEM46K36Ag/T9Zajg+7X/RO6hg9vpdURItEyINe8JI MAsa2h/yy7lbNaVYgXiqI2kMEeA9js5mL1JC7AEqmjRbRJvbDCOtELll4LN1zBmna1wj Rnr/7Hp7JIxh/V4rp/XMKbug4K0W3ySrhpUulSaWtmyKswicgbDA+hfQGZeLW0zA8sV8 0z82hEOkx3VcwPsMuw18Cm/4HRJDfiZXeSDXHn6N+Ni5bsKo5mOZwYf/C2+95hMQQ8rS MedYCCAHOxt+XMLQcQ0UhpNR6j4Jj5fFv7sF4xQEcVQmsqgvnp7LGyaB3jH6HZZ+9imk atLw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-30802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w3-20020a05640234c300b005549114a1ebsi7854942edc.287.2024.01.18.21.57.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 21:57:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-30802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 289AE1F21530 for ; Fri, 19 Jan 2024 05:57:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E42815256; Fri, 19 Jan 2024 05:57:45 +0000 (UTC) Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (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 0DFCF4A0C; Fri, 19 Jan 2024 05:57:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705643865; cv=none; b=UAoiKxvUrOLLJg7yoDXCH9cUh4vRkWqSyJGz+BtLBhAiRABG9tkYa/8QKJcS0pgEt5w4+Y9l3eshbE5E+YAbOrBS93gY4sV+wYIylFzU5c4PxzPMxdU28s9YfODcQCQ2DAuOL7znPfW7V7txsxjVegIHYo4enEFYdy0YbzmoFtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705643865; c=relaxed/simple; bh=YpuHcp6+Ti3Nxz4REWJ5idtkTVRA5Y18LT0RNIdJkOw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=WB/on9237RPDbkUm43TnGqueooGSlk433AHJ8IXaMrCaE0rORRX8hj+w5RkAF2Hvl5JobzynGCiQWJ107xQKRDTMTNLl3L7kG0M1ZIv2zCLNipMSoVT2/QAaTz5Efk8n4LlN3tcDIl/i3mVKEXwZ33Cq6QUASgvz2BaWhRqmkjA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-5cdbc4334edso222753a12.3; Thu, 18 Jan 2024 21:57:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705643863; x=1706248663; 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=pTo9VBdYCTdMSnliyvMcXcpJ1UufCYRIjm4qXNyfvm4=; b=EFqSgkaDqqpjj5Su84qwxpSqftBrbcJEhF4niPnUvkeEPGxMCh9a29ONpTBUBxGw4S h0DRiAGqVYpxGjD1C/qYiIEpzSEXyYgokyF/QAf4SgNaxcU5g/eVm5b9kddMVSnAtAfa KQkrAUSWUg0kOcPv7Opm+hkyuG0aVZYDlKb75Rzy7cQYxIx3D9jx6By8I1dNwt92JVgN OTJIirTMLACDcUiKR0fv6CQV+AhC2g5qNG2/OfK253woTujCDdeAyGroot+3TosSV/t9 GdyJswK+QI55SlHUuPid8xIui7jCjE9fvnv9BZFxd8Hx22yKQ+Lum0cTZBemk3rXbTC4 rY+g== X-Gm-Message-State: AOJu0YypNGx1x/JEbpLm4/SVZMCpbFRbeLgid7Ti05LEazxXkjhekQBK Qp9YwG7/gIRleVVSlrZtTt0bvrFpkGv8W2lfN4388BxRft80yiXNOgXitkdwdi0Xk/Fm0Fk2AD9 8f/MmsNjU5KsuI8+MnrdYiBiidUU= X-Received: by 2002:a05:6a21:3183:b0:199:6bcb:573 with SMTP id za3-20020a056a21318300b001996bcb0573mr2087238pzb.50.1705643863243; Thu, 18 Jan 2024 21:57:43 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240116170348.463479-1-mark.rutland@arm.com> <8734uwxrca.wl-maz@kernel.org> In-Reply-To: From: Namhyung Kim Date: Thu, 18 Jan 2024 21:57:32 -0800 Message-ID: Subject: Re: [PATCH] perf print-events: make is_event_supported() more robust To: Mark Rutland Cc: Marc Zyngier , linux-kernel@vger.kernel.org, Hector Martin , Ian Rogers , acme@redhat.com, james.clark@arm.com, john.g.garry@oracle.com, leo.yan@linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, mike.leach@linaro.org, suzuki.poulose@arm.com, tmricht@linux.ibm.com, will@kernel.org, Ravi Bangoria Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, Adding Ravi to CC. On Wed, Jan 17, 2024 at 4:12=E2=80=AFAM Mark Rutland = wrote: > > On Wed, Jan 17, 2024 at 09:05:25AM +0000, Marc Zyngier wrote: > > Hi Mark, > > > > On Tue, 16 Jan 2024 17:03:48 +0000, > > Mark Rutland wrote: > > > > > > Currently the perf tool doesn't deteect support for extneded event ty= pes > > > on Apple M1/M2 systems, and will not auto-expand plain PERF_EVENT_TYP= E > > > hardware events into per-PMU events. This is due to the detection of > > > extended event types not handling mandatory filters required by the > > > M1/M2 PMU driver. > > > > Thanks for looking into this. > > > > I've given your patch a go on my M1 box, and it indeed makes things > > substantially better: > > > > $ sudo ./perf stat -e cycles ~/hackbench 100 process 1000 > > Running with 100*40 (=3D=3D 4000) tasks. > > Time: 3.419 > > > > Performance counter stats for '/home/maz/hackbench 100 process 1000': > > > > 174,783,472,090 apple_firestorm_pmu/cycles/ = (93.10%) > > 39,134,744,813 apple_icestorm_pmu/cycles/ = (71.86%) > > > > 3.568145595 seconds time elapsed > > > > 12.203084000 seconds user > > 55.135271000 seconds sys > > Thanks for giving that a spin! > > > However, I'm seeing some slightly odd behaviours: > > > > $ sudo ./perf stat -e cycles:k ~/hackbench 100 process 1000 > > Running with 100*40 (=3D=3D 4000) tasks. > > Time: 3.313 > > > > Performance counter stats for '/home/maz/hackbench 100 process 1000': > > > > apple_firestorm_pmu/cycles:k/ > > apple_icestorm_pmu/cycles:k/ Hmm.. I guess this should look like apple_firestorm_pmu/cycles/k. IIRC there was a thread for this, right? > > > > 3.467568841 seconds time elapsed > > > > 13.080111000 seconds user > > 53.162099000 seconds sys > > > > I would have expected it to count, but it didn't. For that to work, I > > have to add the 'H' modifier: > > Ok, so that'll have something to do with the way the tool chooses which > perf_evant_attr::exclude_* bits to set. I thought that was the same for p= lain > events and pmu_name/event/ events, but I could be mistaken. I think it sets the attr.exclude_guest by event_attr_init(). Maybe it's deleted during the missing feature detection logic. But IIUC it should work on each PMU separately. By the way, I really hope the kernel exports caps/exclude_bits for PMUs so that tools can see which bits are supported. For example AMD IBS has CAP_NO_EXCLUDE so setting exclude_guest will fail to open. Then it disables the new features added after that in the missing feature detection logic. If we know if it doesn't support any exclude bits, then tools can try other features after removing the bit first. Thanks, Namhyung > > Is that something you had tried prior to this patch, and did that "just w= ork" > with the explicit pmu_name/event/ syntax prior to this patch? > > e.g. did something like: > > perf stat -e apple_firestorm_pmu/cycles/k -e apple_icestorm_pmu/c= ycles/k ./workload > > ... happen to work withiout requiring the addition of 'H'? > > If so, does that behave the same before/after this patch? > > ... and could you run that with '-vvv' and dump the output for comparison= ? > > Thanks, > Mark.