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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E84FC67861 for ; Sun, 7 Apr 2024 02:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Message-ID:MIME-Version:References: In-Reply-To:Subject:To:From:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WOvulDklYJA9DZ9oprOYTh/an/y2QJp24PWD+tZ0yJM=; b=z96omzlDwU4jwG eZfojcE8YiTxSsmOerXUkH3iF4WvtKEvgSXi/nCE0mr38bAGZPWoQJGKugQX2hCIZ8Xw6niWln8tM Qcg8b9VU69/8gLW9EDe0z+Jc2ZIJhgYBPZXk/+6DALlce3vG66gdES5a5nShBf51cYCooGTfPYpZC 6yt6e8SOzihigGS7BBCzQ5SuS6XUlizY6HltrcnGEGBeeFrVhNakAMzfFy8JVCyVXp1KlIL5Rzd4t ASAeq9iCs5eu1Kjdy1zrTPFXxYSfMN2w7wjZgZwwVfr7a7ur59YvrDqFjRC6AKw1sbjcehDdtvqTX cFqV/mubF0VRTeV22sSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtILa-0000000BV0a-1624; Sun, 07 Apr 2024 02:33:30 +0000 Received: from zg8tmja2lje4os43os4xodqa.icoremail.net ([206.189.79.184]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtILW-0000000BUzw-2k8n; Sun, 07 Apr 2024 02:33:28 +0000 Received: from liangshenlin$eswincomputing.com ( [10.12.96.90] ) by ajax-webmail-app2 (Coremail) ; Sun, 7 Apr 2024 10:31:34 +0800 (GMT+08:00) X-Originating-IP: [10.12.96.90] Date: Sun, 7 Apr 2024 10:31:34 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: "Shenlin Liang" To: anup@brainfault.org, atishp@atishpatra.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, linux-perf-users@vger.kernel.org, "Shenlin Liang" Subject: Re: [PATCH 0/2] perf kvm: Add kvm stat support on riscv X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT6.0.3 build 20220420(169d3f8c) Copyright (c) 2002-2024 www.mailtech.cn mispb-72143050-eaf5-4703-89e0-86624513b4ce-eswincomputing.com In-Reply-To: <20240328031220.1287-1-liangshenlin@eswincomputing.com> References: <20240328031220.1287-1-liangshenlin@eswincomputing.com> MIME-Version: 1.0 Message-ID: <71d045ed.2258.18eb6659685.Coremail.liangshenlin@eswincomputing.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: TQJkCgBHWbuGBRJmHT0FAA--.2754W X-CM-SenderInfo: xold0whvkh0z1lq6v25zlqu0xpsx3x1qjou0bp/1tbiAgEADGYRGI 0ZWwAAsv X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240406_193326_703738_F356A687 X-CRM114-Status: UNSURE ( 8.85 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Gentle ping... > > 'perf kvm stat report/record' generates a statistical analysis of KVM > events and can be used to analyze guest exit reasons. This patch tries > to add stat support on riscv. > > Map the return value of trace_kvm_exit() to the specific cause of the > exception, and export it to userspace. > > It records on two available KVM tracepoints for riscv: "kvm:kvm_entry" > and "kvm:kvm_exit", and reports statistical data which includes events > handles time, samples, and so on. > > Simple tests go below: > > # ./perf kvm record -e "kvm:kvm_entry" -e "kvm:kvm_exit" > Lowering default frequency rate from 4000 to 2500. > Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate. > [ perf record: Woken up 18 times to write data ] > [ perf record: Captured and wrote 5.433 MB perf.data.guest (62519 samples) > > # ./perf kvm report > 31K kvm:kvm_entry > 31K kvm:kvm_exit > > # ./perf kvm stat record -a > [ perf record: Woken up 3 times to write data ] > [ perf record: Captured and wrote 8.502 MB perf.data.guest (99338 samples) ] > > # ./perf kvm stat report --event=vmexit > Event name Samples Sample% Time (ns) Time% Max Time (ns) Min Time (ns) Mean Time (ns) > STORE_GUEST_PAGE_FAULT 26968 54.00% 2003031800 40.00% 3361400 27600 74274 > LOAD_GUEST_PAGE_FAULT 17645 35.00% 1153338100 23.00% 2513400 30800 65363 > VIRTUAL_INST_FAULT 1247 2.00% 340820800 6.00% 1190800 43300 273312 > INST_GUEST_PAGE_FAULT 1128 2.00% 340645800 6.00% 2123200 30200 301990 > SUPERVISOR_SYSCALL 1019 2.00% 245989900 4.00% 1851500 29300 241403 > LOAD_ACCESS 986 1.00% 671556200 13.00% 4180200 100700 681091 > INST_ACCESS 655 1.00% 170054800 3.00% 1808300 54600 259625 > HYPERVISOR_SYSCALL 21 0.00% 4276400 0.00% 716500 116000 203638 > > Shenlin Liang (2): > RISCV: KVM: add tracepoints for entry and exit events > perf kvm/riscv: Port perf kvm stat to RISC-V > > arch/riscv/kvm/trace_riscv.h | 60 ++++++++++++++ > arch/riscv/kvm/vcpu.c | 7 ++ > tools/perf/arch/riscv/Makefile | 1 + > tools/perf/arch/riscv/util/Build | 1 + > tools/perf/arch/riscv/util/kvm-stat.c | 78 +++++++++++++++++++ > .../arch/riscv/util/riscv_exception_types.h | 41 ++++++++++ > 6 files changed, 188 insertions(+) > create mode 100644 arch/riscv/kvm/trace_riscv.h > create mode 100644 tools/perf/arch/riscv/util/kvm-stat.c > create mode 100644 tools/perf/arch/riscv/util/riscv_exception_types.h > > -- > 2.37.2 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv