Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp590836pxa; Fri, 21 Aug 2020 15:33:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2EpERQMOCQYruWhrb+YjamySRZy67rzb0DmUPbX4gyE/5ajO6js2+aY8AVbvQ/5WELTvp X-Received: by 2002:a17:907:206a:: with SMTP id qp10mr4504724ejb.497.1598049197022; Fri, 21 Aug 2020 15:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598049197; cv=none; d=google.com; s=arc-20160816; b=x2CyUZiWjXPUfDlqK6WSFSJXb94IFwBmVatfzXAKFuYCh5yjWYsoielswOv8v5PvL0 2YHXpYsoKqNVrsX8bij0ztdVexoctdv2fYwDd/cPYZXIzX700S3uXszATc+s2y+Hk+Wv 32g0Tr5B18GqE3hTMr6PGhbZeD2BfP9H7wkk6EKfmJdQ6YThKU0fH8EwKW2Ko5fivfDw 7+0jFq2lmvA5/Syjact3KbVYEIIdSzm94IZlA3M3HHZ5z0JZWlmj5rhfpE3BySM14FV3 viTmM1GJjGnrjJVbL3M/Ubj1E1Qf0sdww6+dYDk5hhRlSGaTYGShbbcO2g/AjiAG0LBh PGRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date:dkim-signature; bh=YPGbk1ro99+2byQqY7wPsPaRaSmgzuUay7e4tUoB1AM=; b=PMjcFbD2oTe1D9DZkMEvMjIUUJ4yIur4y1KbslSw+icWvCT7QT7mEfJ3K+yc+Wkj4p jhSdwIdJjBbElzlkhXIGi92v2PR7bGKTrQgER/2taw8ptWdiWlzPz/RIWe6u4RUIKGBz B/YJZlpZNTSh5V12XiGLTKVOlDYep0kAE3OZ9VgORsvRYCVzxMhMGET5Of3R2mgS8Lsh +GuNQoJ3DAXzgi/Xg5jvQyYexZ24boXg0FiVijnKR6J4biEFceCLpLpmJFlufhxgjgcy F9SeDlf6qupkUGKARPDQYEl2fWq3tjshGyd0YIGKWNXESQOdgcZ/e8uYl0Y/hrqCArbI MHow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=Y0GwpSGF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rn4si2237117ejb.490.2020.08.21.15.32.53; Fri, 21 Aug 2020 15:33:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=Y0GwpSGF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727063AbgHUWaU (ORCPT + 99 others); Fri, 21 Aug 2020 18:30:20 -0400 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:30896 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726747AbgHUWaU (ORCPT ); Fri, 21 Aug 2020 18:30:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1598049020; x=1629585020; h=date:from:to:subject:message-id:references:mime-version: in-reply-to; bh=YPGbk1ro99+2byQqY7wPsPaRaSmgzuUay7e4tUoB1AM=; b=Y0GwpSGFmXYdsWq+z4vz6YIJHIaIMEhXEyPR1F38J/jYNhI4dwoK55gM gzqqBGmRkvB3cn/X6nne40JI30uYbFIBgiA0iL7Xhq8vk08mnsCHMyIaK nYQMptdlbsflRcsvfsF8yX5yskkowFXllvR96x9X8S1sTI7lyC32Bsl/9 w=; X-IronPort-AV: E=Sophos;i="5.76,338,1592870400"; d="scan'208";a="49403800" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-5dd976cd.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 21 Aug 2020 22:30:19 +0000 Received: from EX13MTAUWC001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1d-5dd976cd.us-east-1.amazon.com (Postfix) with ESMTPS id 06E32A2486; Fri, 21 Aug 2020 22:30:11 +0000 (UTC) Received: from EX13D05UWC003.ant.amazon.com (10.43.162.226) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 21 Aug 2020 22:29:55 +0000 Received: from EX13MTAUWC001.ant.amazon.com (10.43.162.135) by EX13D05UWC003.ant.amazon.com (10.43.162.226) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 21 Aug 2020 22:29:55 +0000 Received: from dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (172.22.96.68) by mail-relay.amazon.com (10.43.162.232) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 21 Aug 2020 22:29:54 +0000 Received: by dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (Postfix, from userid 4335130) id 3480C40362; Fri, 21 Aug 2020 22:29:55 +0000 (UTC) Date: Fri, 21 Aug 2020 22:29:55 +0000 From: Anchal Agarwal To: , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v3 08/11] x86/xen: save and restore steal clock during PM hibernation Message-ID: <5c3be5c7519b1f63a51b08abc388c33bd6f66661.1598042152.git.anchalag@amazon.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Save/restore steal times in syscore suspend/resume during PM hibernation. Commit '5e25f5db6abb9: ("xen/time: do not decrease steal time after live migration on xen")' fixes xen guest steal time handling during migration. A similar issue is seen during PM hibernation. Currently, steal time accounting code in scheduler expects steal clock callback to provide monotonically increasing value. If the accounting code receives a smaller value than previous one, it uses a negative value to calculate steal time and results in incorrectly updated idle and steal time accounting. This breaks userspace tools which read /proc/stat. top - 08:05:35 up 2:12, 3 users, load average: 0.00, 0.07, 0.23 Tasks: 80 total, 1 running, 79 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,30100.0%id, 0.0%wa, 0.0%hi, 0.0%si,-1253874204672.0%st This can actually happen when a Xen PVHVM guest gets restored from hibernation, because such a restored guest is just a fresh domain from Xen perspective and the time information in runstate info starts over from scratch. Changelog: v1->v2: Removed patches that introduced new function calls for saving/restoring sched clock offset and using existing ones that are used during LM Signed-off-by: Anchal Agarwal --- arch/x86/xen/suspend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index 550aa0fc9465..b12db6966af6 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c @@ -99,6 +99,7 @@ static int xen_syscore_suspend(void) gnttab_suspend(); + xen_manage_runstate_time(-1); xrfp.domid = DOMID_SELF; xrfp.gpfn = __pa(HYPERVISOR_shared_info) >> PAGE_SHIFT; @@ -119,7 +120,7 @@ static void xen_syscore_resume(void) xen_hvm_map_shared_info(); pvclock_resume(); - + xen_manage_runstate_time(0); gnttab_resume(); } -- 2.16.6