From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753148AbcFFWmm (ORCPT ); Mon, 6 Jun 2016 18:42:42 -0400 Received: from mail-oi0-f53.google.com ([209.85.218.53]:34941 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751164AbcFFWmk (ORCPT ); Mon, 6 Jun 2016 18:42:40 -0400 MIME-Version: 1.0 In-Reply-To: References: <1464868639-8924-1-git-send-email-wanpeng.li@hotmail.com> <20160602120023.GC3190@twins.programming.kicks-ass.net> <1464875988.16365.119.camel@redhat.com> From: Wanpeng Li Date: Tue, 7 Jun 2016 06:42:39 +0800 Message-ID: Subject: Re: [PATCH] sched/cputime: add steal clock warps handling during cpu hotplug To: Paolo Bonzini Cc: Rik van Riel , Peter Zijlstra , "linux-kernel@vger.kernel.org" , kvm , Wanpeng Li , Ingo Molnar , Thomas Gleixner , Frederic Weisbecker , Radim Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2016-06-06 21:40 GMT+08:00 Paolo Bonzini : > > > On 02/06/2016 15:59, Rik van Riel wrote: >> 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). > > Why? The preexisting guest steal time is always added to by > KVM, so the time won't restart from zero. > > Continuing the previous count on CPU hot-unplug followed by hot-plug > is less obvious, but I think it's overall the right thing to do. > > In fact, I was going to test a patch this week as simple as this: > > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > index eea2a6f72b31..1ef5e48b3a36 100644 > --- a/arch/x86/kernel/kvm.c > +++ b/arch/x86/kernel/kvm.c > @@ -301,8 +301,6 @@ static void kvm_register_steal_time(void) > if (!has_steal_clock) > return; > > - memset(st, 0, sizeof(*st)); > - > wrmsrl(MSR_KVM_STEAL_TIME, (slow_virt_to_phys(st) | KVM_MSR_ENABLED)); > pr_info("kvm-stealtime: cpu %d, msr %llx\n", > cpu, (unsigned long long) slow_virt_to_phys(st)); Thanks for the suggestion, I will try it today. Regards, Wanpeng Li