From patchwork Thu Jul 2 18:22:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anchal Agarwal X-Patchwork-Id: 11640161 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5441739 for ; Thu, 2 Jul 2020 18:23:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7919120870 for ; Thu, 2 Jul 2020 18:23:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="c7fmKlSS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7919120870 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9E1BE8D002B; Thu, 2 Jul 2020 14:23:25 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9918A8D000C; Thu, 2 Jul 2020 14:23:25 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 833238D002B; Thu, 2 Jul 2020 14:23:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id 6CDBD8D000C for ; Thu, 2 Jul 2020 14:23:25 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 33F2A2C14 for ; Thu, 2 Jul 2020 18:23:25 +0000 (UTC) X-FDA: 76993958370.10.snail78_050640126e8b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id D2DDA16A07E for ; Thu, 2 Jul 2020 18:23:24 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,prvs=445caddfd=anchalag@amazon.com,,RULES_HIT:30012:30054:30064:30069:30075:30080,0,RBL:52.95.49.90:@amazon.com:.lbl8.mailshell.net-64.10.201.10 62.18.0.100;04ygr5gfw1t8t9zugo8fq7mtwg1d4ypfox76ske87f9za1erkiuauf6o5opp19g.sqtmqaiqmty4fjhjapsz5nqq3fhwikpjba4du81awuin81kapgnxcs1simhoq5g.a-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:97,LUA_SUMMARY:none X-HE-Tag: snail78_050640126e8b X-Filterd-Recvd-Size: 5359 Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Jul 2020 18:23:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1593714204; x=1625250204; h=date:from:to:subject:message-id:references:mime-version: in-reply-to; bh=I7turOllMrL/CNEMBFGxOPTAV9RKwwcOD5Qzsp0RMCI=; b=c7fmKlSS9D6/IpT70PI5fH9mttjKMj5kvfM9pbdiE05xxjXwgnLe847s +vjzfqCLbXAwpMN9LnXKImKE5DG6XVgYNmdgsn5DvvPKGcUM/kIDFvp9r kknU0wIyk2LNukqQ9w0I+YFgMrW5O5TEQH2VjwpiHqPVuYdcBIutRKMO/ c=; IronPort-SDR: gtZOu0dMiB3ehEJQSAxthJy8slH3FlYoulPxQjoZIUWyHzAH9qA9TfOTryU3wg6sLJrulv+kzq yxHeXV2LgO7A== X-IronPort-AV: E=Sophos;i="5.75,305,1589241600"; d="scan'208";a="39736466" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2c-4e7c8266.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 02 Jul 2020 18:23:16 +0000 Received: from EX13MTAUEE002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2c-4e7c8266.us-west-2.amazon.com (Postfix) with ESMTPS id A0D51A2540; Thu, 2 Jul 2020 18:23:14 +0000 (UTC) Received: from EX13D08UEE002.ant.amazon.com (10.43.62.92) by EX13MTAUEE002.ant.amazon.com (10.43.62.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Jul 2020 18:22:51 +0000 Received: from EX13MTAUEE002.ant.amazon.com (10.43.62.24) by EX13D08UEE002.ant.amazon.com (10.43.62.92) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Jul 2020 18:22:51 +0000 Received: from dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (172.22.96.68) by mail-relay.amazon.com (10.43.62.224) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 2 Jul 2020 18:22:51 +0000 Received: by dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (Postfix, from userid 4335130) id 651F840844; Thu, 2 Jul 2020 18:22:51 +0000 (UTC) Date: Thu, 2 Jul 2020 18:22:51 +0000 From: Anchal Agarwal To: , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 08/11] x86/xen: save and restore steal clock during PM hibernation Message-ID: <20200702182251.GA3606@dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Rspamd-Queue-Id: D2DDA16A07E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index e8c924e93fc5..10cd14326472 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c @@ -94,10 +94,9 @@ static int xen_syscore_suspend(void) int ret; gnttab_suspend(); - + xen_manage_runstate_time(-1); xrfp.domid = DOMID_SELF; xrfp.gpfn = __pa(HYPERVISOR_shared_info) >> PAGE_SHIFT; - ret = HYPERVISOR_memory_op(XENMEM_remove_from_physmap, &xrfp); if (!ret) HYPERVISOR_shared_info = &xen_dummy_shared_info; @@ -111,7 +110,7 @@ static void xen_syscore_resume(void) xen_hvm_map_shared_info(); pvclock_resume(); - + xen_manage_runstate_time(0); gnttab_resume(); }