From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161084AbcFBN7y (ORCPT ); Thu, 2 Jun 2016 09:59:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49800 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751978AbcFBN7w (ORCPT ); Thu, 2 Jun 2016 09:59:52 -0400 Message-ID: <1464875988.16365.119.camel@redhat.com> Subject: Re: [PATCH] sched/cputime: add steal clock warps handling during cpu hotplug From: Rik van Riel To: Peter Zijlstra , Wanpeng Li Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Wanpeng Li , Ingo Molnar , Thomas Gleixner , Frederic Weisbecker , Paolo Bonzini , Radim Date: Thu, 02 Jun 2016 09:59:48 -0400 In-Reply-To: <20160602120023.GC3190@twins.programming.kicks-ass.net> References: <1464868639-8924-1-git-send-email-wanpeng.li@hotmail.com> <20160602120023.GC3190@twins.programming.kicks-ass.net> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-3JNcNa8GLz67cBcvBH/r" Mime-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 02 Jun 2016 13:59:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-3JNcNa8GLz67cBcvBH/r Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2016-06-02 at 14:00 +0200, Peter Zijlstra wrote: > On Thu, Jun 02, 2016 at 07:57:19PM +0800, Wanpeng Li wrote: > >=20 > > From: Wanpeng Li > >=20 > > I observed that sometimes st is 100% instantaneous, then idle is > > 100%=C2=A0 > > even if there is a cpu hog on the guest cpu after the cpu hotplug > > comes=C2=A0 > > back(N.B. both guest and host are latest 4.7-rc1, this can not > > always=C2=A0 > > be readily reproduced). I add trace to capture it as below: > >=20 > > cpuhp/1-12=C2=A0=C2=A0=C2=A0=C2=A0[001] d.h1=C2=A0=C2=A0=C2=A0167.46165= 7: account_process_tick: steal > > =3D 1291385514, prev_steal_time =3D 0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 > > cpuhp/1-12=C2=A0=C2=A0=C2=A0=C2=A0[001] d.h1=C2=A0=C2=A0=C2=A0167.46165= 9: account_process_tick: > > steal_jiffies =3D 1291=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 > > -0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0[001] d.h1=C2=A0=C2=A0=C2=A0167.4= 62663: account_process_tick: steal =3D > > 18732255, prev_steal_time =3D 1291000000=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > > -0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0[001] d.h1=C2=A0=C2=A0=C2=A0167.4= 62664: account_process_tick: > > steal_jiffies =3D 18446744072437 > >=20 > > The steal clock warps and then steal_jiffies overflow, this patch > > align=C2=A0 > > prev_steal_time to the new steal clock timestamp, in order to > > avoid=C2=A0 > > overflow and st stuff can continue to work. > I would rather suggest fixing the steal clock thing to not jump like > that; is that at all possible? Not always possible, I suspect. If a guest is saved to disk and later restored (eg. after a host reboot), or live migrated to another host, I would expect to get totally disjoint steal time statistics from the "new run" of the guest (which is the same run of the guest OS). In fact, this code may also need to deal with the case where steal time suddenly increases by a ludicrous amount, and ignore those events, too. A safe threshold might be to only apply steal times that are positive and smaller than one second (as long as nohz_full has the one second timer tick left), ignoring intervals that are negative or longer than a second, and using those to sync up the guest with the host. --=20 All Rights Reversed. --=-3JNcNa8GLz67cBcvBH/r Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXUDvUAAoJEM553pKExN6DB6cH/AuYbZEf8ucGCX6GbzXQx6Wq 6qi4KufXCULDZfhV9xzEx/NH2o5WlEe59KbUOBugLXkSGmNKz27eS6ZfZBEJQszB 99ss9G0koLrEsdYX2XaTlIhCNzr/IbApMJKIx5pAONM6/ZrB28jf/juqtRJVrnCc 7rnyA6ezHAgWAeaV2Fxu39fTs58H7R+DTaegb/Zyo/LSNw8rFcoNtvjbQh6RHx4w OeuSm4hIhYORf+Mp/A5xhiOvId3jyvoValSPt7vGdKWaMhh6hmJ5QX5N3OrauiMv xIjuOx0v8g6udhKqJ8/EllmzZIuI9oqJLVnzGzBkdKajbkB6OkeN9xdQPiDXb2w= =uzH6 -----END PGP SIGNATURE----- --=-3JNcNa8GLz67cBcvBH/r--