[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAhSdy0M8ozHyR1mfW1u4-w=4xZm404jR4iqLRL0FtDh7RRvAg@mail.gmail.com>
Date: Sat, 24 May 2025 21:28:51 +0530
From: Anup Patel <anup@...infault.org>
To: Radim Krčmář <rkrcmar@...tanamicro.com>
Cc: kvm-riscv@...ts.infradead.org, kvm@...r.kernel.org,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
Atish Patra <atishp@...shpatra.org>, Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Alexandre Ghiti <alex@...ti.fr>, Yong-Xuan Wang <yongxuan.wang@...ive.com>
Subject: Re: [PATCH] RISC-V: KVM: lock the correct mp_state during reset
On Fri, May 23, 2025 at 4:22 PM Radim Krčmář <rkrcmar@...tanamicro.com> wrote:
>
> We're writing to *tmp, but locking *vcpu.
>
> Fixes: 2121cadec45a ("RISCV: KVM: Introduce mp_state_lock to avoid lock inversion")
> Signed-off-by: Radim Krčmář <rkrcmar@...tanamicro.com>
LGTM.
Reviewed-by: Anup Patel <anup@...infault.org>
Improved commit description at the time of queuing.
Queued this patch for Linux-6.16
Thanks,
Anup
> ---
> arch/riscv/kvm/vcpu_sbi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kvm/vcpu_sbi.c b/arch/riscv/kvm/vcpu_sbi.c
> index 31fd3cc98d66..6e09b518a5d1 100644
> --- a/arch/riscv/kvm/vcpu_sbi.c
> +++ b/arch/riscv/kvm/vcpu_sbi.c
> @@ -143,9 +143,9 @@ void kvm_riscv_vcpu_sbi_system_reset(struct kvm_vcpu *vcpu,
> struct kvm_vcpu *tmp;
>
> kvm_for_each_vcpu(i, tmp, vcpu->kvm) {
> - spin_lock(&vcpu->arch.mp_state_lock);
> + spin_lock(&tmp->arch.mp_state_lock);
> WRITE_ONCE(tmp->arch.mp_state.mp_state, KVM_MP_STATE_STOPPED);
> - spin_unlock(&vcpu->arch.mp_state_lock);
> + spin_unlock(&tmp->arch.mp_state_lock);
> }
> kvm_make_all_cpus_request(vcpu->kvm, KVM_REQ_SLEEP);
>
> --
> 2.49.0
>
Powered by blists - more mailing lists