Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1694104ybt; Thu, 2 Jul 2020 11:25:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypb/O2kkl33fO1R/tCbs3aKB+9mTPKl0oRYDI9kNAISa6q7IXkkkktgLLo3jfH7Yz8nfLx X-Received: by 2002:aa7:cd52:: with SMTP id v18mr34563479edw.196.1593714317473; Thu, 02 Jul 2020 11:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593714317; cv=none; d=google.com; s=arc-20160816; b=zac6IAYFknodbOQ28/4So1jo97ULJrs54pFfYtNWvpPeB3E4mzI0RhRuQdVqgbT8Xn FSIBSRIHzx730UuZkpw+ld++DhsTLWPOlAWfHtKJ0xVAH0/PYtzFS2qIAT3drPout4t1 l06JbzYOI0t7a7sPnYsmOKsyoYTfVjSBpWCDjQo8599yjiC6mb1rbGAmF+QULtA1Eqmj bIrVXh9WKqlp7HwD98VaWXzUUI1PaUUxRfYhSTJrzPwME35lHRAzT+Uo1k2RJ4E2/OqH PNq4gbydSPg3n56u2srS/Hvd3FsfLzYql0MG15QMoxJ1gLy3H8sP6tWYJF2UtM2rNu7s +W+Q== 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:ironport-sdr:dkim-signature; bh=42TBP3y4PhPFoPiNAsOF6sq0ISwy0yvaTgprwGJN3gs=; b=qHNq6y4GdnItLeJfYXBBM1jteokTDxvANdxpLxW1tPe51EQuQL4OfBf0zTBPMmgVFB iMv/g2tBBW6rDY9W6cWZGbptFDJEuU8E4UydTkTGiE2U+u1hyS2Y41LE5XcfHbw67j/v CdK/VKbcpoEO1+rwGyMp46a7tr542deexeeJrSGDOJ39osYJOYnjeDfeJzZo1Ol5b8dh hmxEyaZN6uLppfhgvsG7eZi3liN5TKZsHOOCNrGCSQuWDZGM/xy5ylFhBoM5IZWpICKD S9i9xS4tJVw3eWlK/YqnzfpCkUNZVmp2/NiPZ/9l0QFzR0h22dmbOdH2aO4WlykhHU79 NCsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=gqArI3DQ; 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 dm4si6710712edb.143.2020.07.02.11.24.55; Thu, 02 Jul 2020 11:25: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=gqArI3DQ; 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 S1728279AbgGBSXo (ORCPT + 99 others); Thu, 2 Jul 2020 14:23:44 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:16415 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727993AbgGBSXh (ORCPT ); Thu, 2 Jul 2020 14:23:37 -0400 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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