From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F6FAC433E2 for ; Thu, 2 Jul 2020 18:23:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6452C208C7 for ; Thu, 2 Jul 2020 18:23:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="gqArI3DQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6452C208C7 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 F12748D0032; Thu, 2 Jul 2020 14:23:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC1358D000C; Thu, 2 Jul 2020 14:23:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D624A8D0032; Thu, 2 Jul 2020 14:23:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0254.hostedemail.com [216.40.44.254]) by kanga.kvack.org (Postfix) with ESMTP id BA6958D000C for ; Thu, 2 Jul 2020 14:23:39 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7FBD1181AC9CB for ; Thu, 2 Jul 2020 18:23:39 +0000 (UTC) X-FDA: 76993958958.26.heat86_431494626e8b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 585A31804B661 for ; Thu, 2 Jul 2020 18:23:39 +0000 (UTC) X-HE-Tag: heat86_431494626e8b X-Filterd-Recvd-Size: 4898 Received: from smtp-fw-33001.amazon.com (smtp-fw-33001.amazon.com [207.171.190.10]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Jul 2020 18:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1593714218; x=1625250218; h=date:from:to:subject:message-id:references:mime-version: in-reply-to; bh=42TBP3y4PhPFoPiNAsOF6sq0ISwy0yvaTgprwGJN3gs=; b=gqArI3DQHtn1L2MkSfq/YBuf/AiCtMbE6j8vOQleOTW18+umcSBh8b1X fWQhO2254GD1Yx+wItnv1LzeF5PkT5/7Pz/dUbzITx+cf6WwmgfyY7uEq pSpHMVd4YThvuOvnqu4Z1YCdOUZ6bg6zufvGvQt8bnFf/5zW5ht3pAjbX A=; IronPort-SDR: LmEWe+lBjje6IkAwKMPzWi2nEZ4tgqKNfXE84BMIprWb5gWec64tizT5QYDEjeSJ/XdZT9iLjF RRHpr+GD/3WQ== X-IronPort-AV: E=Sophos;i="5.75,305,1589241600"; d="scan'208";a="55693384" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 02 Jul 2020 18:23:37 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com (Postfix) with ESMTPS id 7E718A255A; Thu, 2 Jul 2020 18:23:35 +0000 (UTC) Received: from EX13D10UWB004.ant.amazon.com (10.43.161.121) by EX13MTAUWB001.ant.amazon.com (10.43.161.249) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Jul 2020 18:23:28 +0000 Received: from EX13MTAUWB001.ant.amazon.com (10.43.161.207) by EX13D10UWB004.ant.amazon.com (10.43.161.121) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Jul 2020 18:23:28 +0000 Received: from dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (172.22.96.68) by mail-relay.amazon.com (10.43.161.249) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 2 Jul 2020 18:23:28 +0000 Received: by dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (Postfix, from userid 4335130) id 8E2C940844; Thu, 2 Jul 2020 18:23:28 +0000 (UTC) Date: Thu, 2 Jul 2020 18:23:28 +0000 From: Anchal Agarwal To: , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 10/11] xen: Update sched clock offset to avoid system instability in hibernation Message-ID: <20200702182328.GA3751@dev-dsk-anchalag-2a-9c2d1d96.us-west-2.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) X-Rspamd-Queue-Id: 585A31804B661 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 xen_sched_clock_offset in syscore suspend/resume during PM hibernation. Commit '867cefb4cb1012: ("xen: Fix x86 sched_clock() interface for xen")' fixes xen guest time handling during migration. A similar issue is seen during PM hibernation when system runs CPU intensive workload. Post resume pvclock resets the value to 0 however, xen sched_clock_offset is never updated. System instability is seen during resume from hibernation when system is under heavy CPU load. Since xen_sched_clock_offset is not updated, system does not see the monotonic clock value and the scheduler would then think that heavy CPU hog tasks need more time in CPU, causing the system to freeze Signed-off-by: Anchal Agarwal --- arch/x86/xen/suspend.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index 10cd14326472..4d8b1d2390b9 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c @@ -95,6 +95,7 @@ static int xen_syscore_suspend(void) gnttab_suspend(); xen_manage_runstate_time(-1); + xen_save_sched_clock_offset(); xrfp.domid = DOMID_SELF; xrfp.gpfn = __pa(HYPERVISOR_shared_info) >> PAGE_SHIFT; ret = HYPERVISOR_memory_op(XENMEM_remove_from_physmap, &xrfp); @@ -110,6 +111,12 @@ static void xen_syscore_resume(void) xen_hvm_map_shared_info(); pvclock_resume(); + /* + * Restore xen_sched_clock_offset during resume to maintain + * monotonic clock value + */ + xen_restore_sched_clock_offset(); + xen_manage_runstate_time(0); gnttab_resume(); } -- 2.20.1