From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Arcangeli Subject: Re: KVM: protect concurrent make_all_cpus_request Date: Wed, 17 Jun 2009 18:52:02 +0200 Message-ID: <20090617165202.GD12816@random.random> References: <20090617135347.GC14583@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, Avi Kivity To: Marcelo Tosatti Return-path: Received: from mx2.redhat.com ([66.187.237.31]:49524 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751775AbZFQQwC (ORCPT ); Wed, 17 Jun 2009 12:52:02 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5HGq49s007612 for ; Wed, 17 Jun 2009 12:52:04 -0400 Content-Disposition: inline In-Reply-To: <20090617135347.GC14583@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jun 17, 2009 at 10:53:47AM -0300, Marcelo Tosatti wrote: > > > make_all_cpus_request contains a race condition which can > trigger false request completed status, as follows: > > CPU0 CPU1 > > if (test_and_set_bit(req,&vcpu->requests)) > .... if (test_and_set_bit(req,&vcpu->requests)) > .. return > proceed to smp_call_function_many(wait=1) > > Use a spinlock to serialize concurrent CPUs. Agreed, this is the safest...