Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp97106ybk; Tue, 19 May 2020 16:32:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxiGHrWp5MG1dnwXY6v+77WS49KEZgC08wWruChw0iHBAHcS2o54rwL8s3BmElrXadfc5D X-Received: by 2002:a05:6402:849:: with SMTP id b9mr1035508edz.226.1589931137324; Tue, 19 May 2020 16:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589931137; cv=none; d=google.com; s=arc-20160816; b=OWQa807e5+PNwma6R+qNrETMdeZVdAv+CV9JNBcGbvOtN/U3bGAAcB2N2WQTz9QRCb zy+MJJ7Mez65p9nmssAYZQdIy+GX86W5PBXIwJ7wieQZxQ6oq37sqGN+EHyhaNbykvF1 7CFILbI7M4d1lhze2ZU3vNHem1IE1Mo52M5xoyP2Ts5v889h4vtQ/a9ea6WrBsAPgeXN go9yXIX5tR9EpbzPwDZcalLoIgM0mDnStM7m9hp28M43i/ZFaqJRyj4ETUKCj9v0ljNx kr1nSfdg1ymglFH/jZM5af7PIVkAOSh4/mLaimhCz5/31NlgC4+pqPFNJllsaaQtPF4Y Bt4Q== 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=r7lbs73sfsvJ86GyRkYhd6/aeNxAVZ1wrAJ3MEWq1QM=; b=LiJMIWNvIjgh/Bw394XCShfOQWWWNrgOyqAhNvPLfpqyF6H6c6rZSRq9kXXgLdGdil ra5D7Jm2S4tu5eZHm23Xx9PikJStqeii8uQk/UpHjK/LDKENse2cc/+eDkyB69myz3Zt qTN8vN5bB9wIcB6AUQnnq6Xl/mQdMxnFpRhjMlf/wOwL/da4qMQkoeki1/Uzxxd7ybkV QO8P43EbHDDcaT9H+HpVVnKy/VoskMnOH1G4h+6vmfkadM4xTo2cqZQVVbWT19LWJQZi 4C5kCPT3ptdYLkLtI0MeHhxuCbhi636Zgwr3riNwtbiXJ9WdUAvVfBtFwTQlMpqIQbY2 5XSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=vIqPsPAp; 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 m22si806417eje.448.2020.05.19.16.31.53; Tue, 19 May 2020 16:32: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=vIqPsPAp; 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 S1728493AbgESX37 (ORCPT + 99 others); Tue, 19 May 2020 19:29:59 -0400 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:51238 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728432AbgESX36 (ORCPT ); Tue, 19 May 2020 19:29:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1589930997; x=1621466997; h=date:from:to:subject:message-id:references:mime-version: in-reply-to; bh=r7lbs73sfsvJ86GyRkYhd6/aeNxAVZ1wrAJ3MEWq1QM=; b=vIqPsPAplA6WpXtqyybTqMVOdFQYsDFx+OvQzEHCEdTY3aiD7ihfOx59 g+5BMFzLzIVKJIoC8HddpFK/h1w7AKRMg77HKOsDj3+9/F3v4v+Z7Pp9M Zk9x3dzk4C1EP8xfQi0G4jq2PYRjluRTA/stvNspoNmy/5TtEmH7VzYiX 0=; IronPort-SDR: 9zWNpH8TfAOVXYXC65zH0YTjctxGH5l94tqUBCBdTwFQ9nB5vkppYKlmCsdTEitS5G1lbnrQj9 3msnk5oBY8Ww== X-IronPort-AV: E=Sophos;i="5.73,411,1583193600"; d="scan'208";a="31182653" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 19 May 2020 23:29:55 +0000 Received: from EX13MTAUEE002.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 304E8A2003; Tue, 19 May 2020 23:29:53 +0000 (UTC) Received: from EX13D08UEE001.ant.amazon.com (10.43.62.126) by EX13MTAUEE002.ant.amazon.com (10.43.62.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 19 May 2020 23:29:40 +0000 Received: from EX13MTAUEE002.ant.amazon.com (10.43.62.24) by EX13D08UEE001.ant.amazon.com (10.43.62.126) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 19 May 2020 23:29:39 +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; Tue, 19 May 2020 23:29:39 +0000 Received: by dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (Postfix, from userid 4335130) id 81BF340712; Tue, 19 May 2020 23:29:39 +0000 (UTC) Date: Tue, 19 May 2020 23:29:39 +0000 From: Anchal Agarwal To: , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH 11/12] xen: Update sched clock offset to avoid system instability in hibernation Message-ID: <4066d54951f4ba9437eb0ff6aeb5288fcd20c2fb.1589926004.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 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index dae0f74f5390..7e5275944810 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c @@ -105,6 +105,8 @@ static int xen_syscore_suspend(void) xen_save_steal_clock(cpu); } + xen_save_sched_clock_offset(); + xrfp.domid = DOMID_SELF; xrfp.gpfn = __pa(HYPERVISOR_shared_info) >> PAGE_SHIFT; @@ -126,6 +128,12 @@ static void xen_syscore_resume(void) pvclock_resume(); + /* + * Restore xen_sched_clock_offset during resume to maintain + * monotonic clock value + */ + xen_restore_sched_clock_offset(); + /* Nonboot CPUs will be resumed when they're brought up */ xen_restore_steal_clock(smp_processor_id()); -- 2.24.1.AMZN