From: "Jan Beulich" Subject: Re: [PATCH v3] x86/AMD: Add support for AMD's OSVW feature in guests Date: Wed, 01 Feb 2012 10:18:41 +0000 Message-ID: <4F291F910200007800070467@nat28.tlf.novell.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Boris Ostrovsky Cc: Christoph.Egger@amd.com, xen-devel@lists.xensource.com, keir@xen.org List-Id: xen-devel@lists.xenproject.org >>> On 31.01.12 at 20:16, Boris Ostrovsky wrote: > @@ -502,6 +503,20 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc > /* Needed, for example, to ensure writable p.t. state is synced. */ > domain_pause(d); > > + /* > + * Certain operations (e.g. CPU microcode updates) modify data which is > + * used during VCPU allocation/initialization > + */ > + while ( !spin_trylock(&vcpu_alloc_lock) ) > + if ( hypercall_preempt_check() ) > + { > + ret = hypercall_create_continuation( > + __HYPERVISOR_domctl, "h", u_domctl); > + domain_unpause(d); > + rcu_unlock_domain(d); > + break; This "break" will only get you out of the while() loop, falling through into the immediately following code (without holding the lock), which is not what you want afaict. Jan > + } > + > /* We cannot reduce maximum VCPUs. */ > ret = -EINVAL; > if ( (max < d->max_vcpus) && (d->vcpu[max] != NULL) )