Hi Gavin

On Thu, Oct 23, 2025 at 1:58 AM Gavin Shan <[email protected]> wrote:
>
> Hi Salil,
>
> On 10/23/25 10:35 AM, Salil Mehta wrote:
> > On Thu, Oct 23, 2025 at 12:14 AM Gavin Shan <[email protected]> wrote:
> >> On 10/23/25 4:50 AM, Salil Mehta wrote:
> >>> On Wed, Oct 22, 2025 at 6:18 PM Salil Mehta <[email protected]> 
> >>> wrote:
> >>>> On Wed, Oct 22, 2025 at 10:37 AM Gavin Shan <[email protected]> wrote:
> >>>>> On 10/1/25 11:01 AM, [email protected] wrote:
> >>>>>> From: Salil Mehta <[email protected]>

[...]

> >> guest$ cd /sys/devices/system/cpu/
> >> guest$ cat present enabled online
> >> 0-3
> >> 0-1
> >> 0-1
> >> (qemu) device_set 
> >> host-arm-cpu,socket-id=1,cluster-id=0,core-id=0,thread-id=0,admin-state=enable
> >> qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (2): 
> >> Operation not permitted
> >
> >
> > Ah, I see. I think I understand the issue. It's complaining
> > about calling the  finalize twice. Is it possible to check as
> > I do not have a way to test it?
> >
> >
> > int kvm_arm_vcpu_finalize(struct kvm_vcpu *vcpu, int feature)
> > {
> > switch (feature) {
> > case KVM_ARM_VCPU_SVE:
> > [...]
> > if (kvm_arm_vcpu_sve_finalized(vcpu))
> > return -EPERM;-----> this where it must be popping?
> > [...]
> > }
> >
>
> Right, I think that's the case: QEMU tries to finalize SVE capability for 
> twice,
> which is the real problem. I'm explaining what I found as below, which would 
> be
> helpful to the forthcoming revisions.
>
> machvirt_init
>    virt_setup_lazy_vcpu_realization
>      arm_cpu_finalize_features
>      kvm_arm_create_host_vcpu
>        kvm_create_vcpu                       // New fd is created
>        kvm_arch_init_vcpu
>          kvm_arm_vcpu_init
>          kvm_arm_sve_set_vls
>          kvm_arm_vcpu_finalize               // (A) SVE capability is 
> finalized
>
> device_set_admin_power_state
>    device_pre_poweron
>      virt_machine_device_pre_poweron
>        virt_cpu_pre_poweron
>          qdev_realize
>            arm_cpu_realizefn
>              cpu_exec_realizefn
>              arm_cpu_finalize_features       // Called for the second time
>              qemu_init_vcpu
>                kvm_start_vcpu_thread
>                  kvm_vcpu_thread_fn
>                    kvm_init_vcpu
>                      kvm_create_vcpu         // Called for the second time
>                      kvm_arch_init_vcpu      // Called for the second time
>                        kvm_arm_vcpu_init
>                        kvm_arm_sve_set_vls   // (B) Failed here
>                        kvm_arm_vcpu_finalize
>
> (B) where we try to finalize SVE capability again. It has been finalized at 
> (A)
>      Fianlizing SVE capability for twice is disallowed by KVM on the host 
> side.
>
>
> >>
> >> I picked the fix (the last patch in rfc-v6.2 branch) to rfc-v6 branch, 
> >> same crash dump
> >> can be seen.
> >
> > Are you getting previously reported abort or above new problem?
> >
>
> Previously, the VM can't be started. After your fix is applied, the VM is 
> able to start.
> It's a new problem that qemu crash dump is seens on attempt to hot add a vCPU.


Thanks for confirming this as well.

Cheers
Salil.

Reply via email to