From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC27FC433E2 for ; Thu, 17 Sep 2020 10:14:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B4332083B for ; Thu, 17 Sep 2020 10:14:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GyF7NVrN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DXqhBNLv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B4332083B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YyYrzBiZz4oGmO7EVDggGKRehSlrF7jBskiota4EDgE=; b=GyF7NVrNgZ3A7powPSNQgOiNA Y1EZo+DUsE47kZDiJ/7ZfrPZNbcV/ghy4G8XRC5HNQAdxWKdneb/BFc9Z6hOjeFAMS5TELgB1ljN6 d0V3RqVT9TCnhGjYmao1aNTjFP6RbARI3efBrlZBcgVuJwEEY0pRMgZZrCFu/A+T2YHzKToQIAiI+ 5pC07lNQpODCqJiHIQC7FzTusxnNAUF6H4qOPK44Wghd3vhEETHJiLsrp+wP9BFRkrCU1YdREscdJ 5xQHb5qzi6qwEQwU6n5k4MESOkjoVCoYeSbLnqhAfF3vS4wB6X47OehjdOoHsbKG8HeV9gBQie78x 6AF5xwlSQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIqu9-0002FE-2x; Thu, 17 Sep 2020 10:12:41 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIqtw-0002AR-9q for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2020 10:12:30 +0000 Received: by mail-pg1-x541.google.com with SMTP id 67so1071976pgd.12 for ; Thu, 17 Sep 2020 03:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8I5syEFzYXSRk+uSOFJ1LBkGshbWMD1FtRIoI4eUqrM=; b=DXqhBNLvrOpzm/WiMVfuqadagjwe5PQxj3q+Pc1uBJ7yTs5Nxvlrdquq9Rrb8qx0Ls HJNVzPxgDFVtgC+bKF0qxLf/XY7ZpskadXW5ZwwzREuu7jCRyLWuHmDMkkr8WsvLBgE8 /09FRxVMfdEDkhO4Kq0qh0Q3tt9YH1bNupkzw5qg9f+ZTIFrwE0Xq6MeCPgYAluh8Jo4 lCrLLvu4IG4DoLxdrYRF+0STMGkujXZ8eclSSWWceNsoAl/bclMQ2DkhUesE2wd8lS8H el//wi1IO7DnDSrRAe3W0AB1Rq3mbljFQy9icPK+/wydY/WM3ZUfNjJqCIIHqM4ccnFv JLUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8I5syEFzYXSRk+uSOFJ1LBkGshbWMD1FtRIoI4eUqrM=; b=ID+8D2rYWV1ptiKGJ76wOD4aGsXcdEoE/+ZaT4ssxG4ipc3+ReIRGyu65uqnnugXmk l2zCZtpKT8vatJQxsEean/buVHYN1n9X5IjrKKdr7VHY9iJ+r7oD6WL2cmJUMlEzCFAJ hMZuT1DxBz9j/OTnfvDWuksYm6FNFyaUIO4nnwKAW1GRsiefC9FOAje4GEqlXHx1q/YI pnroG1aRASV/h/9dbkJFzi3Qbe4a0sEbsq+X16W5S9cmFCHlIvaOMrxfx6v96NcQrIjC xNf1zPrxDAB3vNPrGICu9OKFUPNrArZSX0G/tWxN9oxy9NSPivD05GupW1APLpILu3K0 v66w== X-Gm-Message-State: AOAM531EpD10UYAAzDDnqKC0aarq9vsXhJyNBfpRh9sOO39eypzj8bBe 3UYshWVzqOFJQs5rRzdlVxkPuA== X-Google-Smtp-Source: ABdhPJwVNfyNv6ekHlyUhzXzygE1It0dJ8XU3+DqczN/LPOjJ1tC5bAo3VVMJnlmrNkjmGjU4+4mNQ== X-Received: by 2002:a63:8ac8:: with SMTP id y191mr21800032pgd.159.1600337545751; Thu, 17 Sep 2020 03:12:25 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([2600:3c01::f03c:91ff:fe8a:bb03]) by smtp.gmail.com with ESMTPSA id d5sm22100002pfq.72.2020.09.17.03.12.22 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Sep 2020 03:12:25 -0700 (PDT) Date: Thu, 17 Sep 2020 18:12:19 +0800 From: Leo Yan To: Sergey Senozhatsky , Marc Zyngier Subject: Re: [PATCHv3] perf kvm: add kvm-stat for arm64 Message-ID: <20200917101219.GD12548@leoy-ThinkPad-X240s> References: <20200917003645.689665-1-sergey.senozhatsky@gmail.com> <20200917100950.GC12548@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200917100950.GC12548@leoy-ThinkPad-X240s> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200917_061228_439509_5E15A6D6 X-CRM114-Status: GOOD ( 23.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Mathieu Poirier , Peter Zijlstra , John Garry , linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Suleiman Souhlal , Namhyung Kim , Will Deacon , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add Marc at this time, sorry for spamming. On Thu, Sep 17, 2020 at 06:09:50PM +0800, Leo Yan wrote: > [ + Marc ] > > On Thu, Sep 17, 2020 at 09:36:45AM +0900, Sergey Senozhatsky wrote: > > [...] > > > diff --git a/tools/perf/arch/arm64/util/kvm-stat.c b/tools/perf/arch/arm64/util/kvm-stat.c > > new file mode 100644 > > index 000000000000..32e58576f186 > > --- /dev/null > > +++ b/tools/perf/arch/arm64/util/kvm-stat.c > > @@ -0,0 +1,86 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +#include > > +#include > > +#include "../../util/evsel.h" > > +#include "../../util/kvm-stat.h" > > +#include "arm64_exception_types.h" > > +#include "debug.h" > > + > > +define_exit_reasons_table(arm64_exit_reasons, kvm_arm_exception_type); > > +define_exit_reasons_table(arm64_trap_exit_reasons, kvm_arm_exception_class); > > + > > +const char *kvm_trap_exit_reason = "esr_ec"; > > +const char *vcpu_id_str = "id"; > > On Arm64, ftrace tracepoint "kvm_entry" doesn't contain the field "id" > or field "vcpu_id", thus it always reads out the "id" is 0 and it is > recorded into Perf's structure vcpu_event_record::vcpu_id and assigned > to perf thread's private data "thread::private". > > With current code, it will not mess up different vcpus' samples because > now the samples are analyzed based on thread context, but since all > threads' "vcpu_id" is zero, thus all samples are accounted for > "vcpu_id=0" and cannot print out correct result with option "--vcpu": > > > $ perf kvm stat report --vcpu 4 > > Analyze events for all VMs, VCPU 4: > > VM-EXIT Samples Samples% Time% Min Time Max Time Avg time > > Total Samples:0, Total events handled time:0.00us. > > > This is an issue I observed, if we want to support option "--vcpu", > seems we need to change ftrace event for "kvm_entry", but this will > break ABI. > > Essentially, this issue is caused by different archs using different > format for ftrace event "kvm_entry", on x86 it contains feild > "vcpu_id" but arm64 only just records "vcpu_pc". > > @Marc, @Will, do you have any suggestion for this? Do you think it's > feasible to add a new field "vcpu_id" into the tracepoint "kvm_entry" > for Arm64's version? > > Thanks, > Leo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel