public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>
To: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: kvm-45 problems
Date: Wed, 10 Oct 2007 13:23:11 +0200	[thread overview]
Message-ID: <470CB61F.9040209@bull.net> (raw)
In-Reply-To: <470CB04A.2010303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 1667 bytes --]

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
-- 
---------------- Laurent.Vivier-6ktuUTfB/bM@public.gmane.org  -----------------
"Given enough eyeballs, all bugs are shallow" E. S. Raymond

[-- Attachment #1.1.2: smp_call_function_mask-kvm --]
[-- Type: text/plain, Size: 1470 bytes --]

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 #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 314 bytes --]

-------------------------------------------------------------------------
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/

[-- Attachment #3: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

  parent reply	other threads:[~2007-10-10 11:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-05 15:36 kvm-45 problems Farkas Levente
     [not found] ` <47065A1A.9070607-lWVWdrzSO4GHXe+LvDLADg@public.gmane.org>
2007-10-08 23:55   ` Dong, Eddie
     [not found]     ` <10EA09EFD8728347A513008B6B0DA77A014E8AFF-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-09  6:45       ` Farkas Levente
     [not found]         ` <470B2381.7080302-lWVWdrzSO4GHXe+LvDLADg@public.gmane.org>
2007-10-09  7:30           ` Zhao, Yunfeng
     [not found]             ` <10EA09EFD8728347A513008B6B0DA77A02125F53-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-09  9:50               ` Avi Kivity
     [not found]                 ` <470B4ED5.4060607-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-09  9:52                   ` Farkas Levente
     [not found]                     ` <470B4F6B.6030900-lWVWdrzSO4GHXe+LvDLADg@public.gmane.org>
2007-10-09  9:54                       ` Avi Kivity
     [not found]                         ` <470B4FCF.9070703-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-09  9:56                           ` Farkas Levente
     [not found]                             ` <470B506B.8090905-lWVWdrzSO4GHXe+LvDLADg@public.gmane.org>
2007-10-09  9:57                               ` Avi Kivity
2007-10-09 10:18                   ` Avi Kivity
     [not found]                     ` <470B557A.9030602-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-09 11:00                       ` Zhao, Yunfeng
2007-10-10  2:47                       ` Zhao, Yunfeng
     [not found]                         ` <10EA09EFD8728347A513008B6B0DA77A02125F5A-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-10 10:58                           ` Avi Kivity
     [not found]                             ` <470CB04A.2010303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-10 11:23                               ` Laurent Vivier [this message]
2007-10-12  2:53                       ` Zhao, Yunfeng
     [not found]                         ` <10EA09EFD8728347A513008B6B0DA77A02125F6D-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-12  6:05                           ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=470CB61F.9040209@bull.net \
    --to=laurent.vivier-6ktuutfb/bm@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox