All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: JinRui <jinrui@haiwei.tech>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3] KVM: selftests: riscv: Add lazy V extension enablement for guests
Date: Tue, 21 Jul 2026 11:41:10 +0000	[thread overview]
Message-ID: <20260721114111.35F851F000E9@smtp.kernel.org> (raw)
In-Reply-To: <574AACF6F4298057+20260721112454.330498-1-jinrui@haiwei.tech>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The replacement of `guest_unexp_trap` with the full exception vector table silently removes guest register dumps (`vcpu_dump()`) on unexpected exceptions, significantly degrading debuggability.
--

--- Patch [1]: [PATCH v3] KVM: selftests: riscv: Add lazy V extension enablement for guests ---
commit f9473f3696d28b72282cabd505ada7d8de6f8b19
Author: jinrui <jinrui@haiwei.tech>

KVM: selftests: riscv: Add lazy V extension enablement for guests

This commit adds lazy V extension enablement for guests to handle compiler
auto-vectorization on hosts with V extension. It replaces the unused
guest_unexp_trap() handler with the full exception vector table, allowing
safe lazy enablement in route_exception().

> diff --git a/tools/testing/selftests/kvm/lib/riscv/processor.c b/tools/testing/selftests/kvm/lib/riscv/processor.c
> index ded5429f34483..841474acfabd1 100644
> --- a/tools/testing/selftests/kvm/lib/riscv/processor.c
> +++ b/tools/testing/selftests/kvm/lib/riscv/processor.c
> @@ -297,14 +297,6 @@ void vcpu_arch_dump(FILE *stream, struct kvm_vcpu *vcpu, u8 indent)
>  		" T3: 0x%016lx   T4: 0x%016lx T5: 0x%016lx T6: 0x%016lx\n",
>  		core.regs.t3, core.regs.t4, core.regs.t5, core.regs.t6);
>  }
> -
> -static void __aligned(16) guest_unexp_trap(void)
> -{
> -	sbi_ecall(KVM_RISCV_SELFTESTS_SBI_EXT,
> -		  KVM_RISCV_SELFTESTS_SBI_UNEXP,
> -		  0, 0, 0, 0, 0, 0);
> -}
> -

[Severity: Medium]
Does removing guest_unexp_trap() result in the loss of guest register dumps
on unexpected exceptions?

This deleted function triggered KVM_RISCV_SELFTESTS_SBI_UNEXP, which
explicitly yielded a vcpu_dump() on the host side. With the new default
exception handler calling kvm_exit_unexpected_exception() instead, it maps
to UCALL_UNHANDLED.

On the host side, assert_on_unhandled_exception() catches this but lacks
the vcpu_dump() call:

tools/testing/selftests/kvm/lib/riscv/processor.c:assert_on_unhandled_exception() {
	struct ucall uc;

	if (get_ucall(vcpu, &uc) == UCALL_UNHANDLED) {
		TEST_FAIL("Unexpected exception (vector:0x%lx, ec:0x%lx)",
			uc.args[0], uc.args[1]);
	}
}

Will this make it harder to debug guest test failures due to missing PC and
register states?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/574AACF6F4298057+20260721112454.330498-1-jinrui@haiwei.tech?part=1

      reply	other threads:[~2026-07-21 11:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 10:14 [PATCH] KVM: selftests: riscv: Add lazy V extension enablement for guests JinRui
2026-07-21 10:14 ` JinRui
2026-07-21 10:14 ` JinRui
2026-07-21 10:25 ` sashiko-bot
2026-07-21 10:57 ` [PATCH v2] " JinRui
2026-07-21 10:57   ` JinRui
2026-07-21 10:57   ` JinRui
2026-07-21 11:06   ` sashiko-bot
2026-07-21 11:24   ` [PATCH v3] " JinRui
2026-07-21 11:24     ` JinRui
2026-07-21 11:24     ` JinRui
2026-07-21 11:41     ` sashiko-bot [this message]

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=20260721114111.35F851F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jinrui@haiwei.tech \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.