Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2283628ybv; Fri, 14 Feb 2020 15:28:19 -0800 (PST) X-Google-Smtp-Source: APXvYqy2rNvLcVP6JET0aQv20Z2QJtJHGZimEem0cXN7VkLAZel2tecaGVWHkimjploKifbMInxG X-Received: by 2002:aca:48cd:: with SMTP id v196mr3663516oia.102.1581722899414; Fri, 14 Feb 2020 15:28:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581722899; cv=none; d=google.com; s=arc-20160816; b=xfhImN1CIG8PqaJyEHOVrKkgNaV8hDMvW/4ktb/6IGxu0a2U25j2irBduLocjbX5HQ cLtHrA+NiB24KVhgtNxz+smssAGiGIkJZX8vc8LtatXzfv6A5nsxaB1lUDWlC+BobuRo m2WbIsK783nOT/qIUala5dvUzpczyLV7SinmGFcHh5fHl0phZZYZq1vWQ8VhcMctGHz/ disUkOao2h+QMkXeyp2ssZgwHOBiUJ1T4vSUQrY3PE3Bw1yCWFd6v3FPAGF3Zpmc4KUS fNxhSEil6yPH6FQWsi/MV4c7c9tQBBUV2ihE7sg8Vnq0aX0ixR/JQewEsD1O7TAHOFTv KZig== 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=w2YudPijii+dzE2cW4maD6E6FQY1WRpU8HmwPnvoM5k=; b=0nNYPKKC1QkcR0wp0Ideay5TkXWdi3Qe84miH9rqhP44r9V8jx3ExmZxffh4hOoNXb YRXkCBLyQO0M8RKj92Iendc8j/Kva+g/34qxVpDV7G+SDnE7k5V690RZX4lmz4ts+CEP BwtdFi+i7FGegusj0/9kqsXEAdJ68y2aqeQIGxENcFv+0MYoNAc+jdrb2IxMlyuK2EmP 9eUiPesav1+7I8LDZJ9hbjLQFI81g4vNr9yHD+Ye4wib6hZmYm4bWE7Sl/yt34TigrqS Ymi8ZM9q8bJh6fgP2ye+XnfAejPCjUrM0Kjyp8cQqirIqlxyxUXpSOYph3W5Blb3LFwf 7dwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=wIWeAYgn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id l198si2087819oig.120.2020.02.14.15.28.07; Fri, 14 Feb 2020 15:28:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=wIWeAYgn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728292AbgBNX1s (ORCPT + 99 others); Fri, 14 Feb 2020 18:27:48 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:1035 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727649AbgBNX1s (ORCPT ); Fri, 14 Feb 2020 18:27:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1581722867; x=1613258867; h=date:from:to:subject:message-id:references:mime-version: in-reply-to; bh=w2YudPijii+dzE2cW4maD6E6FQY1WRpU8HmwPnvoM5k=; b=wIWeAYgn40YOrYt2FC6c5BTIphd+RIWYLpUy4SbFnDl1Cp9drlyhvVc6 N6VynUKymRW5+/IXaVCtxQa6ACgoS7pFMti42jWpUJ9wV9sdUlKLIfV9c JA7UZLw1SXo1k6n10q7e3xqgNSG/14gZHHn0S6xD+tF38IR+IZUBgLjbu 0=; IronPort-SDR: 4QzLk7agU2cCkHMRbCkf+yxdh7O3HX/h13ILndMQD5DBXAC5QIGb3xBDBxJz+ZI2EvA/bpTqBv mUC+a3+dOYhg== X-IronPort-AV: E=Sophos;i="5.70,442,1574121600"; d="scan'208";a="26558954" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1d-74cf8b49.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 14 Feb 2020 23:27:45 +0000 Received: from EX13MTAUEB002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1d-74cf8b49.us-east-1.amazon.com (Postfix) with ESMTPS id 9E2B3C0845; Fri, 14 Feb 2020 23:27:38 +0000 (UTC) Received: from EX13D08UEB001.ant.amazon.com (10.43.60.245) by EX13MTAUEB002.ant.amazon.com (10.43.60.12) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 14 Feb 2020 23:27:25 +0000 Received: from EX13MTAUEB002.ant.amazon.com (10.43.60.12) by EX13D08UEB001.ant.amazon.com (10.43.60.245) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 14 Feb 2020 23:27:25 +0000 Received: from dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (172.22.96.68) by mail-relay.amazon.com (10.43.60.234) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Fri, 14 Feb 2020 23:27:19 +0000 Received: by dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (Postfix, from userid 4335130) id F07DD4028E; Fri, 14 Feb 2020 23:27:18 +0000 (UTC) Date: Fri, 14 Feb 2020 23:27:18 +0000 From: Anchal Agarwal To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [RFC PATCH v3 10/12] xen: Introduce wrapper for save/restore sched clock offset Message-ID: <305f20fbf503b637b1a08b7bec543f49271a725a.1581721799.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 Introduce wrappers for save/restore xen_sched_clock_offset to be used by PM hibernation code to avoid system instability during resume. Signed-off-by: Anchal Agarwal --- arch/x86/xen/time.c | 15 +++++++++++++-- arch/x86/xen/xen-ops.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 8cf632dda605..eeb6d3d2eaab 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -379,12 +379,23 @@ static const struct pv_time_ops xen_time_ops __initconst = { static struct pvclock_vsyscall_time_info *xen_clock __read_mostly; static u64 xen_clock_value_saved; +/*This is needed to maintain a monotonic clock value during PM hibernation */ +void xen_save_sched_clock_offset(void) +{ + xen_clock_value_saved = xen_clocksource_read() - xen_sched_clock_offset; +} + +void xen_restore_sched_clock_offset(void) +{ + xen_sched_clock_offset = xen_clocksource_read() - xen_clock_value_saved; +} + void xen_save_time_memory_area(void) { struct vcpu_register_time_memory_area t; int ret; - xen_clock_value_saved = xen_clocksource_read() - xen_sched_clock_offset; + xen_save_sched_clock_offset(); if (!xen_clock) return; @@ -426,7 +437,7 @@ void xen_restore_time_memory_area(void) out: /* Need pvclock_resume() before using xen_clocksource_read(). */ pvclock_resume(); - xen_sched_clock_offset = xen_clocksource_read() - xen_clock_value_saved; + xen_restore_sched_clock_offset(); } static void xen_setup_vsyscall_time_info(void) diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index d84c357994bd..9f49124df033 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h @@ -72,6 +72,8 @@ void xen_save_time_memory_area(void); void xen_restore_time_memory_area(void); void xen_init_time_ops(void); void xen_hvm_init_time_ops(void); +void xen_save_sched_clock_offset(void); +void xen_restore_sched_clock_offset(void); irqreturn_t xen_debug_interrupt(int irq, void *dev_id); -- 2.24.1.AMZN