{"id":2220435,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2220435/?format=json","web_url":"http://patchwork.ozlabs.org/project/kvm-riscv/patch/20260407171455735miXfwO3C51btdouaaGUEc@zte.com.cn/","project":{"id":70,"url":"http://patchwork.ozlabs.org/api/1.1/projects/70/?format=json","name":"Linux KVM RISC-V","link_name":"kvm-riscv","list_id":"kvm-riscv.lists.infradead.org","list_email":"kvm-riscv@lists.infradead.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260407171455735miXfwO3C51btdouaaGUEc@zte.com.cn>","date":"2026-04-07T09:14:55","name":"[2/3] RISC-V: KVM: add tracepoints for guest page faults","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d7a72c7b7281029d18bc534c9fb65a229e3e870c","submitter":{"id":91800,"url":"http://patchwork.ozlabs.org/api/1.1/people/91800/?format=json","name":"","email":"wang.yechao255@zte.com.cn"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/kvm-riscv/patch/20260407171455735miXfwO3C51btdouaaGUEc@zte.com.cn/mbox/","series":[{"id":498947,"url":"http://patchwork.ozlabs.org/api/1.1/series/498947/?format=json","web_url":"http://patchwork.ozlabs.org/project/kvm-riscv/list/?series=498947","date":"2026-04-07T09:10:52","name":"RISC-V: KVM: Huge page recovery during disable-dirty-log","version":1,"mbox":"http://patchwork.ozlabs.org/series/498947/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2220435/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2220435/checks/","tags":{},"headers":{"Return-Path":"\n <kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=eHy/Oa7b;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fqgXW1NXvz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 07 Apr 2026 19:15:39 +1000 (AEST)","from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wA2X3-00000006Cxc-2jry;\n\tTue, 07 Apr 2026 09:15:37 +0000","from mxhk.zte.com.cn ([160.30.148.35])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wA2X1-00000006Cx1-3HPD;\n\tTue, 07 Apr 2026 09:15:37 +0000","from mse-fl1.zte.com.cn (unknown [10.5.228.132])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby mxhk.zte.com.cn (FangMail) with ESMTPS id 4fqgWz00Dnz7QYRQ;\n\tTue, 07 Apr 2026 17:15:10 +0800 (CST)","from szxlzmapp02.zte.com.cn ([10.5.231.79])\n\tby mse-fl1.zte.com.cn with SMTP id 6379Ere8070472;\n\tTue, 7 Apr 2026 17:14:53 +0800 (+08)\n\t(envelope-from wang.yechao255@zte.com.cn)","from mapi (szxlzmapp01[null])\n\tby mapi (Zmail) with MAPI id mid12;\n\tTue, 7 Apr 2026 17:14:55 +0800 (CST)"],"DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:Subject:Cc:To:From:Mime-Version:Date:\n\tReferences:In-Reply-To:Message-ID:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=Ti5FbXzzwfInAZGV+xdxnSdq7Qsw5aVGpY9KLcl0jPw=; b=eHy/Oa7bSt/Kk8\n\tgHgSRA85BERcotZ+y4HUBtn5uY80IU5EmwbR4zSgtjTLTm2AGJ7Cwat3W+C7qZw+UQzNsEt1vWoOZ\n\t6rx7b+StNC9fsMOq29Wa6bHrDg7OyZ2//fh6jQ+RkWWTebm303RjJ4qja/y2dXTHrwTEErs3K35tA\n\txe/lVZDNXvhgFADQ7RgNky5HYzWsEgSl3Bc+Te1Jf58r3B3dybz8mOb6WAk4U4ly0nEOAhBODzEHk\n\t11U7KC/UHS80aOzp8ydf6kepSIBF11hd1chGydYxSzf2UJvbWG4tBQBQdkEsqSQRpKNS12tfI7Xgn\n\tKZBPhX8NxS0FZN89tdSw==;","X-Zmail-TransId":"2b0369d4cb0fb57-00521","X-Mailer":"Zmail v1.0","Message-ID":"<20260407171455735miXfwO3C51btdouaaGUEc@zte.com.cn>","In-Reply-To":"<20260407171052241tmZDFGusMP_wlEsBVVtJo@zte.com.cn>","References":"20260407171052241tmZDFGusMP_wlEsBVVtJo@zte.com.cn","Date":"Tue, 7 Apr 2026 17:14:55 +0800 (CST)","Mime-Version":"1.0","From":"<wang.yechao255@zte.com.cn>","To":"<anup@brainfault.org>, <atish.patra@linux.dev>, <pjw@kernel.org>,\n        <palmer@dabbelt.com>, <aou@eecs.berkeley.edu>, <alex@ghiti.fr>","Cc":"<kvm@vger.kernel.org>, <kvm-riscv@lists.infradead.org>,\n        <linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>","Subject":"=?utf-8?q?=5BPATCH_2/3=5D_RISC-V=3A_KVM=3A_add_tracepoints_for_gues?=\n\t=?utf-8?q?t_page_faults?=","X-MAIL":"mse-fl1.zte.com.cn 6379Ere8070472","X-TLS":"YES","X-SPF-DOMAIN":"zte.com.cn","X-ENVELOPE-SENDER":"wang.yechao255@zte.com.cn","X-SPF":"None","X-SOURCE-IP":"10.5.228.132 unknown Tue, 07 Apr 2026 17:15:11 +0800","X-Fangmail-Anti-Spam-Filtered":"true","X-Fangmail-MID-QID":"69D4CB1E.001/4fqgWz00Dnz7QYRQ","X-Bad-Reply":"References and In-Reply-To but no 'Re:' in Subject.","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20260407_021536_133988_6282ABFB ","X-CRM114-Status":"UNSURE (   7.34  )","X-CRM114-Notice":"Please train this message.","X-Spam-Score":"-1.9 (-)","X-Spam-Report":"Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam.  The original\n message has been attached to this so you can view it or label\n similar future email.  If you have any questions, see\n the administrator of that system for details.\n Content preview:  From: Wang Yechao <wang.yechao255@zte.com.cn> Add the\n kvm_page_fault\n    event tracepoints to count the number of KVM guest page faults.\n Signed-off-by:\n    Wang Yechao <wang.yechao255@zte.com.cn> --- arch/riscv/kvm/trace.h | 25\n +++++++++++++++++++++++++\n    arch/riscv/kvm/vcpu_exit.c | 3 +++ 2 files changed, 28 insertions(+)\n Content analysis details:   (-1.9 points, 5.0 required)\n  pts rule name              description\n ---- ----------------------\n --------------------------------------------------\n -0.0 SPF_PASS               SPF: sender matches SPF record\n  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record\n -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n                             [score: 0.0000]\n  0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The\n                             query to Validity was blocked.  See\n                             https://knowledge.validity.com/hc/en-us/articles/20961730681243\n                              for more information.\n                          [160.30.148.35 listed in\n sa-trusted.bondedsender.org]\n  0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to\n                              Validity was blocked.  See\n                             https://knowledge.validity.com/hc/en-us/articles/20961730681243\n                              for more information.\n                             [160.30.148.35 listed in sa-accredit.habeas.com]\n  0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay\n lines\n  0.0 RCVD_IN_MSPIKE_H5      RBL: Excellent reputation (+5)\n                             [160.30.148.35 listed in wl.mailspike.net]\n  0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to\n                              Validity was blocked.  See\n                             https://knowledge.validity.com/hc/en-us/articles/20961730681243\n                              for more information.\n                             [160.30.148.35 listed in\n bl.score.senderscore.com]\n  0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders","X-BeenThere":"kvm-riscv@lists.infradead.org","X-Mailman-Version":"2.1.34","Precedence":"list","List-Id":"<kvm-riscv.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/kvm-riscv>,\n <mailto:kvm-riscv-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/kvm-riscv/>","List-Post":"<mailto:kvm-riscv@lists.infradead.org>","List-Help":"<mailto:kvm-riscv-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/kvm-riscv>,\n <mailto:kvm-riscv-request@lists.infradead.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"kvm-riscv\" <kvm-riscv-bounces@lists.infradead.org>","Errors-To":"kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"},"content":"From: Wang Yechao <wang.yechao255@zte.com.cn>\n\nAdd the kvm_page_fault event tracepoints to count the number of KVM\nguest page faults.\n\nSigned-off-by: Wang Yechao <wang.yechao255@zte.com.cn>\n---\n arch/riscv/kvm/trace.h     | 25 +++++++++++++++++++++++++\n arch/riscv/kvm/vcpu_exit.c |  3 +++\n 2 files changed, 28 insertions(+)","diff":"diff --git a/arch/riscv/kvm/trace.h b/arch/riscv/kvm/trace.h\nindex 3d54175d805c..9056cc9883cf 100644\n--- a/arch/riscv/kvm/trace.h\n+++ b/arch/riscv/kvm/trace.h\n@@ -56,6 +56,31 @@ TRACE_EVENT(kvm_exit,\n \t\t__entry->htinst)\n );\n\n+/*\n+ * Tracepoint for page fault.\n+ */\n+TRACE_EVENT(kvm_page_fault,\n+\tTP_PROTO(struct kvm_vcpu *vcpu, u64 fault_address, u64 error_code),\n+\tTP_ARGS(vcpu, fault_address, error_code),\n+\n+\tTP_STRUCT__entry(\n+\t\t__field(unsigned int,   vcpu_id)\n+\t\t__field(u64,            fault_address)\n+\t\t__field(u64,            error_code)\n+\t),\n+\n+\tTP_fast_assign(\n+\t\t__entry->vcpu_id        = vcpu->vcpu_id;\n+\t\t__entry->fault_address  = fault_address;\n+\t\t__entry->error_code     = error_code;\n+\t),\n+\n+\tTP_printk(\"vcpu %u address 0x%016llx error_code 0x%llx\",\n+\t\t__entry->vcpu_id,\n+\t\t__entry->fault_address,\n+\t\t__entry->error_code)\n+);\n+\n #endif /* _TRACE_RSICV_KVM_H */\n\n #undef TRACE_INCLUDE_PATH\ndiff --git a/arch/riscv/kvm/vcpu_exit.c b/arch/riscv/kvm/vcpu_exit.c\nindex 0bb0c51e3c89..0cfb0149da9f 100644\n--- a/arch/riscv/kvm/vcpu_exit.c\n+++ b/arch/riscv/kvm/vcpu_exit.c\n@@ -11,6 +11,7 @@\n #include <asm/insn-def.h>\n #include <asm/kvm_mmu.h>\n #include <asm/kvm_nacl.h>\n+#include \"trace.h\"\n\n static int gstage_page_fault(struct kvm_vcpu *vcpu, struct kvm_run *run,\n \t\t\t     struct kvm_cpu_trap *trap)\n@@ -43,6 +44,8 @@ static int gstage_page_fault(struct kvm_vcpu *vcpu, struct kvm_run *run,\n \t\t};\n \t}\n\n+\ttrace_kvm_page_fault(vcpu, fault_addr, trap->scause);\n+\n \tret = kvm_riscv_mmu_map(vcpu, memslot, fault_addr, hva,\n \t\t\t\t(trap->scause == EXC_STORE_GUEST_PAGE_FAULT) ? true : false,\n \t\t\t\t&host_map);\n","prefixes":["2/3"]}