Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp2410450rwl; Sat, 5 Nov 2022 06:30:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SkQ79H5xWP/l72alZ+EWsQFiYYVIE+lcd4OmHJG8iSWWkj8KtazXYGBPayyMgUHE2JWdC X-Received: by 2002:a05:6402:22c7:b0:463:cc1:42a2 with SMTP id dm7-20020a05640222c700b004630cc142a2mr36990100edb.217.1667655042422; Sat, 05 Nov 2022 06:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667655042; cv=none; d=google.com; s=arc-20160816; b=D95+XHOImjmu4wcbd/VeoWfz9up5uomVCCnbr9q1nfGh0gOHmDGJt5/KA4nCSZ7U3y oQKTEu5lG5aqCUxhQRjo8lgChUFwKdkBuu0mpQNg0gAykTKM+EUbRSFaMLn2TDgHHcOT d9+yp+8SoLc7zJm+1h3gIUCM7tpC/tFSK6x5D8vwWUWjcrvArzw36gmmE5GBoIhVBSth pZz8HwghvkHBG4QAd16HNf2nqBNeyQp/gwBkYt65u+lNIXMgrOZirVcxRj242mLX/fA/ xL0ElrJRPriy6WvCtH8sgTlLq0lwy2Im+Q+Gz/FrzALYUcyw3t/RCLZB0NfyAn/fZ+Oq Prcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=VeY726MdpVVlnoyWwV4wTJeCKRM69nK2dMaUD8xVLq4=; b=RmmwznvWFtKIkvVEbRaNOvqFPij/9O9wJ/RpoJAdoVBXUi30IvSDgQxYRaQOtez8oP xUqR/O5NrtNPtQNeEveDhYjeSxN4ecWlaPWh4OfEDpUhFpFj9pZqbo5i0swlcBWN3hXI 517Xs3avXvejR4nI0aKEisn0zuqlAW6eOingTw+8RVrIl83cO2bPZLJGmGAiKrbLSIQk aQ9hlJpvCqUrUYThjxjwz4+cWPUxoMWg9p76tQ3DrQLSz5j8x6TjkdFNxpSqaP3jyknn StAztYWN6wfBNGhe3ZwVzADk0kGjTDkIkx148yPJrY1szKiRP8+rcddNCm0d2RYaeDZM i3wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LbwYLN5S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v17-20020aa7d811000000b00461e122a4e4si2254970edq.314.2022.11.05.06.30.18; Sat, 05 Nov 2022 06:30:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LbwYLN5S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229517AbiKEN2r (ORCPT + 97 others); Sat, 5 Nov 2022 09:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbiKEN2q (ORCPT ); Sat, 5 Nov 2022 09:28:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCE72DEA0; Sat, 5 Nov 2022 06:28:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 870C9B80025; Sat, 5 Nov 2022 13:28:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A5AAC433D6; Sat, 5 Nov 2022 13:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667654923; bh=LHNxWfv4lFpGRWDjFEVWeEhY+NjqCvnXHLnf01bxTdY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LbwYLN5SeGDotOAWDCaYThJR9r5jNTQbm8tt06i9Y3Qvrj76515aGET7+Or4bmHe/ h+6mK7YUmxJxBdlnRHV8THYyvUg3n8hpmZnkFaAxjxwptoa3yM5uwmxc7Xz7kh1Snu d2veqeJqK6WbelqUT8FM5DjjsGQKzQEOLOEQDpQvrY00VksUjfH2K99AV0p0R7GAVa GDBSBgGA+8gFNaFdbVanPmv0YOiYSLaC4KL3JmpbPR2xFu+J/crsASLM+UsMN8Kb1k 2WEqypGh9UCPfYpxb9Ff4I8WrCxX9PB76At0fb+5Fx9EfkVE8gPHKw0dAsEP+OQSkf s/1UFPuaJbIBw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1orJE0-0043rY-Rv; Sat, 05 Nov 2022 13:28:40 +0000 Date: Sat, 05 Nov 2022 13:28:40 +0000 Message-ID: <868rkpr0mv.wl-maz@kernel.org> From: Marc Zyngier To: Leo Yan Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Catalin Marinas , Will Deacon , Arnaldo Carvalho de Melo , John Garry , James Clark , Mike Leach , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH v1 3/3] perf arm64: Support virtual CPU ID for kvm-stat In-Reply-To: <20221105072311.8214-4-leo.yan@linaro.org> References: <20221105072311.8214-1-leo.yan@linaro.org> <20221105072311.8214-4-leo.yan@linaro.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: leo.yan@linaro.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, catalin.marinas@arm.com, will@kernel.org, acme@kernel.org, john.garry@huawei.com, james.clark@arm.com, mike.leach@linaro.org, peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 05 Nov 2022 07:23:11 +0000, Leo Yan wrote: > > Since the two trace events kvm_entry_v2/kvm_exit_v2 are added, we can > use the field "vcpu_id" in the events to get to know the virtual CPU ID. > To keep backward compatibility, we still need to rely on the trace > events kvm_entry/kvm_exit for old kernels. > > This patch adds Arm64's functions setup_kvm_events_tp() and > arm64__setup_kvm_tp(), by detecting the nodes under sysfs folder, it can > dynamically register trace events kvm_entry_v2/kvm_exit_v2 when the > kernel has provided them, otherwise, it rolls back to use events > kvm_entry/kvm_exit for backward compatibility. > > Let cpu_isa_init() to invoke arm64__setup_kvm_tp(), this can allow the > command "perf kvm stat report" also to dynamically setup trace events. > > Before: > > # perf kvm stat report --vcpu 27 > > Analyze events for all VMs, VCPU 27: > > VM-EXIT Samples Samples% Time% Min Time Max Time Avg time > > Total Samples:0, Total events handled time:0.00us. > > After: > > # perf kvm stat report --vcpu 27 > > Analyze events for all VMs, VCPU 27: > > VM-EXIT Samples Samples% Time% Min Time Max Time Avg time > > SYS64 808 98.54% 91.24% 0.00us 303.76us 3.46us ( +- 13.54% ) > WFx 10 1.22% 7.79% 0.00us 69.48us 23.91us ( +- 25.91% ) > IRQ 2 0.24% 0.97% 0.00us 22.64us 14.82us ( +- 52.77% ) > > Total Samples:820, Total events handled time:3068.28us. Please educate me: how useful is it to filter on a vcpu number across all VMs? What sense does it even make? Conversely, what would be the purpose of filtering on a 5th thread of any process irrespective of what the process does? To me, this is the same level of non-sense. AFAICT, this is just piling more arbitrary data extraction for no particular reason other than "just because we can", and there is absolutely no guarantee that this is fit for anyone else's purpose. I'd rather you have a generic tracepoint taking the vcpu as a context and a BPF program that spits out the information people actually need, keeping things out of the kernel. Or even a tracehook (like the scheduler does), and let people load a module to dump whatever information they please. But randomly adding new tracepoints to output a semi-useless field without any consideration for future-proofing? No, thank you. Thanks, M. -- Without deviation from the norm, progress is not possible.