Skip to contentSkip to conversation

qemu 2.4 machine + kernel 4.2 + kvm : freeze & cpu 100% at start on some hardware (maybe KVM_CAP_X86_SMM related)

DISCUSSION Alexandre DERUMIER 1 participant 1 message Sep 29, 2015 KVM

lore
Share & tools
lore
#0 lore raw

Hi,

I'm currently implementing qemu 2.4 for proxmox hypervisors,
and a lot of users have reported qemu freeze with cpu at 100% when starting. Connecting with vnc display : "qemu guest has not initialized the display yet"

Similar bug report here : https://lacyc3.eu/qemu-guest-has-not-initialized-the-display

This does not occur on all hardware,
for example it freeze on dell powerege r710 (xeon E5540), but not on dell r630 (CPU E5-2687W v3 @ 3.10GHz) or very old dell poweredge 2950 (xeon 5110 @ 1.60GHz).

This is only with qemu 2.4 + kernel 4.2 (kernel 4.1 works fine) + kvm

not working command line
-------------------------
/usr/bin/kvm chardev socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait -mon chardev=qmp,mode=control -vnc unix:/var/run/qemu-server/100.vnc,x509,password -pidfile /var/run/qemu-server/100.pid -name test -cpu kvm64 -m 4096 -machine pc-i440fx-2.4

working command line
---------------------
qemu 2.4 + kvm + compat 2.3 profil:

/usr/bin/kvm chardev socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait -mon chardev=qmp,mode=control -vnc unix:/var/run/qemu-server/100.vnc,x509,password -pidfile /var/run/qemu-server/100.pid -name test -cpu kvm64 -m 4096 -machine pc-i440fx-2.3

qemu 2.4 without kvm:

/usr/bin/kvm chardev socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait -mon chardev=qmp,mode=control -vnc unix:/var/run/qemu-server/100.vnc,x509,password -pidfile /var/run/qemu-server/100.pid -name test -cpu kvm64 -m 4096 -machine accel=tcg,type=pc-i440fx-2.4

So it's working with qemu 2.4 + machine 2.3 compat profil.

Looking at the code:

static void pc_compat_2_3(MachineState *machine)

{
    PCMachineState *pcms = PC_MACHINE(machine);
    savevm_skip_section_footers();
    if (kvm_enabled()) {
        pcms->smm = ON_OFF_AUTO_OFF;
    }
    global_state_set_optional();
    savevm_skip_configuration();
}

If I comment
//pcms->smm = ON_OFF_AUTO_OFF;

I have the same freeze too.

So,it's seem to come from somewhere in

bool pc_machine_is_smm_enabled(PCMachineState *pcms)

{
    bool smm_available = false;

    if (pcms->smm == ON_OFF_AUTO_OFF) {
        return false;
    }

    if (tcg_enabled() || qtest_enabled()) {
        smm_available = true;
    } else if (kvm_enabled()) {
        smm_available = kvm_has_smm();    >> maybe here ?
    }

    if (smm_available) {
        return true;
    }

    if (pcms->smm == ON_OFF_AUTO_ON) {
        error_report("System Management Mode not supported by this hypervisor.");
        exit(1);
    }
    return false;
}

bool kvm_has_smm(void)

{
    return kvm_check_extension(kvm_state, KVM_CAP_X86_SMM);
}

I'm not sure if it's a qemu bug or kernel/kvm bug.

Help is welcome.

Regards,

Alexandre Derumier