Avi Kivity wrote:
> Zhao, Yunfeng wrote:
>> This fix cannot resolve this issue.
>> Against latest kvm commits, SMP linux with 4 vcpus still cannot boot up.
>> But the issue will not happen , if adding "-smp4 -no-acpi".
>>   
> 
> Can you try the attached patch?
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> diff --git a/kernel/kvm_main.c b/kernel/kvm_main.c
> index 0b2894a..61d931e 100644
> --- a/kernel/kvm_main.c
> +++ b/kernel/kvm_main.c
> @@ -235,11 +235,7 @@ void kvm_flush_remote_tlbs(struct kvm *kvm)
>        * to complete.
>        */
>       for (cpu = first_cpu(cpus); cpu != NR_CPUS; cpu = next_cpu(cpu, cpus))
> -             smp_call_function_single(cpu, ack_flush, &completed, 1, 0);
> -     while (atomic_read(&completed) != needed) {
> -             cpu_relax();
> -             barrier();
> -     }
> +             smp_call_function_single(cpu, ack_flush, &completed, 1, 1);
>  }
>  
>  int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)

This part will be obsolete as soon as linux will export
smp_call_function_mask(). This is already in mm tree:

ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.23-rc8/2.6.23-rc8-mm2/broken-out/x86_64-mm-export-i386-smp_call_function_mask-to-modules.patch
ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.23-rc8/2.6.23-rc8-mm2/broken-out/x86_64-mm-implement-missing-x86_64-function-smp_call_function_mask.patch

Apply these patches and try the attached patch for KVM.

Laurent
-- 
---------------- [EMAIL PROTECTED]  -----------------
"Given enough eyeballs, all bugs are shallow" E. S. Raymond
Index: kvm/drivers/kvm/kvm_main.c
===================================================================
--- kvm.orig/drivers/kvm/kvm_main.c     2007-09-12 17:49:51.000000000 +0200
+++ kvm/drivers/kvm/kvm_main.c  2007-09-12 17:58:18.000000000 +0200
@@ -198,21 +198,15 @@ static void vcpu_put(struct kvm_vcpu *vc
 
 static void ack_flush(void *_completed)
 {
-       atomic_t *completed = _completed;
-
-       atomic_inc(completed);
 }
 
 void kvm_flush_remote_tlbs(struct kvm *kvm)
 {
-       int i, cpu, needed;
+       int i, cpu;
        cpumask_t cpus;
        struct kvm_vcpu *vcpu;
-       atomic_t completed;
 
-       atomic_set(&completed, 0);
        cpus_clear(cpus);
-       needed = 0;
        for (i = 0; i < KVM_MAX_VCPUS; ++i) {
                vcpu = kvm->vcpus[i];
                if (!vcpu)
@@ -221,23 +215,9 @@ void kvm_flush_remote_tlbs(struct kvm *k
                        continue;
                cpu = vcpu->cpu;
                if (cpu != -1 && cpu != raw_smp_processor_id())
-                       if (!cpu_isset(cpu, cpus)) {
-                               cpu_set(cpu, cpus);
-                               ++needed;
-                       }
-       }
-
-       /*
-        * We really want smp_call_function_mask() here.  But that's not
-        * available, so ipi all cpus in parallel and wait for them
-        * to complete.
-        */
-       for (cpu = first_cpu(cpus); cpu != NR_CPUS; cpu = next_cpu(cpu, cpus))
-               smp_call_function_single(cpu, ack_flush, &completed, 1, 0);
-       while (atomic_read(&completed) != needed) {
-               cpu_relax();
-               barrier();
+                       cpu_set(cpu, cpus);
        }
+       smp_call_function_mask(cpus, ack_flush, NULL, 1);
 }
 
 int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to