Re: soft lockup in kvm_flush_remote_tlbs

david ahern
2007-10-25T18:34:03Z

The issue appears to be with the RHEL5 kernel (host OS is rhel5). I tried your suggestions below -- no effect; still hit the softlockup.

I then moved the host to the 2.6.23.1 kernel but with the kvm-48 code base. Surprisingly, I had no issues starting my guest with '-smp 4'.

david

Avi Kivity wrote:
>
> No, it looks like the problem is indeed in kvm_flush_remote_tlbs(), and
> not a corruption elsewhere.
>
> Things to check:
>
> - whether cpus_weight(mask) == needed
> - whether wrapping the whole thing in preempt_disable()/preempt_enable()
> helps
>
> hey! I see a bug!
>
>> continue;
>> cpu = vcpu->cpu;
>> if (cpu != -1 && cpu != raw_smp_processor_id())
>> if (!cpu_isset(cpu, cpus)) {
>> cpu_set(cpu, cpus);
>> ++needed;
>> }
>> }
>>
>
> vcpu->cpu can change during execution if this snippet due to a vcpu
> being migrated concurrently with this being executed. Since the
> compiler is free to reload 'cpu' from 'vcpu->cpu', the code can operate
> on corrupted data.
>
> A 'barrier();' after 'cpu = vcpu->cpu;' should fix it, if this is indeed
> the bug.