From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: x86: kvm: Revert "remove sched notifier for cross-cpu migrations" Date: Tue, 24 Mar 2015 19:59:08 -0300 Message-ID: <20150324225908.GB7067@amt.cnet> References: <20150323232151.GA12772@amt.cnet> <20150324153412.GB21710@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm-devel , stable@vger.kernel.org, Paolo Bonzini , Andy Lutomirski To: Radim =?utf-8?B?S3LEjW3DocWZ?= Return-path: Content-Disposition: inline In-Reply-To: <20150324153412.GB21710@potion.brq.redhat.com> Sender: stable-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Tue, Mar 24, 2015 at 04:34:12PM +0100, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: > 2015-03-23 20:21-0300, Marcelo Tosatti: > > The following point: > >=20 > > 2. per-CPU pvclock time info is updated if the > > underlying CPU changes. > >=20 > > Is not true anymore since "KVM: x86: update pvclock area conditiona= lly, > > on cpu migration". >=20 > I think that the revert doesn't fix point 2.: "KVM: x86: update pvcl= ock > [...]" changed the host to skip clock update on physical CPU change, = but > guest's task migration notifier isn't tied to it at all. "per-CPU pvclock time info is updated if the underlying CPU changes" is the same as "always perform clock update on physical CPU change". That was a requirement for the original patch, to drop migration notifiers. > (Guest can have all tasks pinned, so the revert changed nothing.) >=20 > > Add task migration notification back. > >=20 > > Problem noticed by Andy Lutomirski. >=20 > What is the problem? >=20 > Thanks. The problem is this: T1) guest thread1 on vcpu1. T2) guest thread1 on vcpu2. T3) guest thread1 on vcpu1. Inside a pvclock read loop. Since the writes by hypervisor of pvclock area are not ordered,=20 you cannot rely on version being updated _before_=20 the rest of pvclock data. (in the case above, "has the physical cpu changed" check, inside the guests thread1, obviously fails).