From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] sched: fix race between sched_move_domain() and vcpu_wake() Date: Fri, 11 Oct 2013 12:47:15 +0100 Message-ID: References: <1381426196-11392-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1381426196-11392-1-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel , xen-devel@lists.xen.org Cc: George Dunlap , Andrew Cooper , Juergen Gross List-Id: xen-devel@lists.xenproject.org On 10/10/2013 18:29, "David Vrabel" wrote: > From: David Vrabel > > sched_move_domain() changes v->processor for all the domain's VCPUs. > If another domain, softirq etc. triggers a simultaneous call to > vcpu_wake() (e.g., by setting an event channel as pending), then > vcpu_wake() may lock one schedule lock and try to unlock another. > > vcpu_schedule_lock() attempts to handle this but only does so for the > window between reading the schedule_lock from the per-CPU data and the > spin_lock() call. This does not help with sched_move_domain() > changing v->processor between the calls to vcpu_schedule_lock() and > vcpu_schedule_unlock(). > > Fix the race by taking the schedule_lock for v->processor in > sched_move_domain(). > > Signed-off-by: David Vrabel > Cc: George Dunlap > Cc: Juergen Gross > Cc: Andrew Cooper Acked-by: Keir Fraser