Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wang Yechao" <wang.yechao255@zte.com.cn>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v4 1/2] RISC-V: KVM: add tracepoint for guest page faults
Date: Sun, 13 Sep 2026 07:20:57 +0000	[thread overview]
Message-ID: <20260913072057.C3C0B1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260913070352.3626956-2-wang.yechao255@zte.com.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The newly added `kvm_page_fault` tracepoint misses MMIO accesses and instruction access faults because it is placed after the early-return paths in `gstage_page_fault()`.
--

commit 9a1dfc5717473462915b50774722a5444137d7bd
Author: Wang Yechao <wang.yechao255@zte.com.cn>

RISC-V: KVM: add tracepoint for guest page faults

This commit adds the kvm_page_fault event tracepoint to count the number
of KVM guest page faults on RISC-V.

> diff --git a/arch/riscv/kvm/vcpu_exit.c b/arch/riscv/kvm/vcpu_exit.c
> index 88e0c369b3544..8f44e27563f85 100644
> --- a/arch/riscv/kvm/vcpu_exit.c
> +++ b/arch/riscv/kvm/vcpu_exit.c
> @@ -64,6 +64,8 @@ static int gstage_page_fault(struct kvm_vcpu *vcpu, struct kvm_run *run,
>  		};
>  	}
>  
> +	trace_kvm_page_fault(vcpu, fault_addr, trap->scause);

[Severity: Medium]
Does this placement miss MMIO accesses and instruction access faults?

If a guest page fault resolves to an MMIO region or an unmapped instruction
fetch, the early return paths in gstage_page_fault() will handle the fault
and return before reaching this tracepoint.

For example, when an error HVA is encountered:

	if (kvm_is_error_hva(hva) || ...) {
		switch (trap->scause) {
		case EXC_LOAD_GUEST_PAGE_FAULT:
			return kvm_riscv_vcpu_mmio_load(...);
		...
		};
	}

	trace_kvm_page_fault(vcpu, fault_addr, trap->scause);

Could this cause incorrect statistics for users monitoring KVM guest page
faults, since it skips all page faults that fall into those early returns?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260913070352.3626956-1-wang.yechao255@zte.com.cn?part=1

  reply	other threads:[~2026-09-13  7:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-13  7:03 [PATCH v4 0/2] RISC-V: KVM: Huge page recovery during disable-dirty-log Wang Yechao
2026-09-13  7:03 ` [PATCH v4 1/2] RISC-V: KVM: add tracepoint for guest page faults Wang Yechao
2026-09-13  7:20   ` sashiko-bot [this message]
2026-09-13  7:03 ` [PATCH v4 2/2] RISC-V: KVM: Recover gstage huge page mappings during disable-dirty-log Wang Yechao
2026-09-13  7:25   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260913072057.C3C0B1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wang.yechao255@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox