From: sashiko-bot@kernel.org
To: "Anup Patel" <anup.patel@oss.qualcomm.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3] RISC-V: KVM: Zicbo[m|z|p] block sizes should be always present in ONE_REG
Date: Mon, 06 Jul 2026 18:25:13 +0000 [thread overview]
Message-ID: <20260706182514.125F91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260706181522.2003922-1-anup.patel@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The Zicbo block size ONE_REG interface breaks the get/set symmetry contract by silently discarding written values, leading to multi-hop migration failures.
--
commit d84da4691ff077e1c79d8bbd1343deea4485ef7b
Author: Anup Patel <anup.patel@oss.qualcomm.com>
RISC-V: KVM: Zicbo[m|z|p] block sizes should be always present in ONE_REG
This commit modifies the KVM RISC-V one_reg interface to ensure the Zicbo
block size config registers are always available, regardless of whether the
host supports the corresponding ISA extensions. It drops the host ISA
extension checks from the get, set, and index copy functions.
> diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c
> index bb920e8923c93..61988382570fe 100644
> --- a/arch/riscv/kvm/vcpu_onereg.c
> +++ b/arch/riscv/kvm/vcpu_onereg.c
> @@ -50,19 +50,13 @@ static int kvm_riscv_vcpu_get_reg_config(struct kvm_vcpu *vcpu,
> reg_val = vcpu->arch.isa[0] & KVM_RISCV_BASE_ISA_MASK;
> break;
> case KVM_REG_RISCV_CONFIG_REG(zicbom_block_size):
> - if (kvm_riscv_isa_check_host(ZICBOM))
> - return -ENOENT;
> - reg_val = riscv_cbom_block_size;
> + reg_val = (kvm_riscv_isa_check_host(ZICBOM)) ? 0 : riscv_cbom_block_size;
> break;
[ ... ]
> @@ -144,21 +138,15 @@ static int kvm_riscv_vcpu_set_reg_config(struct kvm_vcpu *vcpu,
> }
> break;
> case KVM_REG_RISCV_CONFIG_REG(zicbom_block_size):
> - if (kvm_riscv_isa_check_host(ZICBOM))
> - return -ENOENT;
> - if (reg_val != riscv_cbom_block_size)
> + if (reg_val && reg_val != riscv_cbom_block_size)
> return -EINVAL;
> break;
[Severity: High]
Does this break the kvm_one_reg get/set symmetry contract?
If userspace writes a value of 0 to the zicbom_block_size register, the new
conditional check allows the write to succeed, but KVM discards the value
without saving it to the vCPU state.
If userspace subsequently reads the same register from
kvm_riscv_vcpu_get_reg_config(), KVM unconditionally returns the host's native
block size (when the extension is present) instead of the 0 that was
successfully written.
Could this silent discard of the written value cause migration failures across
heterogeneous hosts, such as migrating from a host without Zicbo to a host
with Zicbo, and then back to one without it?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706181522.2003922-1-anup.patel@oss.qualcomm.com?part=1
prev parent reply other threads:[~2026-07-06 18:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 18:15 [PATCH v3] RISC-V: KVM: Zicbo[m|z|p] block sizes should be always present in ONE_REG Anup Patel
2026-07-06 18:25 ` 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=20260706182514.125F91F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=anup.patel@oss.qualcomm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox