[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c3665c0918a56d8789995d53f9fbe77131938a66.1598042152.git.anchalag@amazon.com>
Date: Fri, 21 Aug 2020 22:30:11 +0000
From: Anchal Agarwal <anchalag@...zon.com>
To: <tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
<hpa@...or.com>, <x86@...nel.org>, <boris.ostrovsky@...cle.com>,
<jgross@...e.com>, <linux-pm@...r.kernel.org>,
<linux-mm@...ck.org>, <kamatam@...zon.com>,
<sstabellini@...nel.org>, <konrad.wilk@...cle.com>,
<roger.pau@...rix.com>, <axboe@...nel.dk>, <davem@...emloft.net>,
<rjw@...ysocki.net>, <len.brown@...el.com>, <pavel@....cz>,
<peterz@...radead.org>, <eduval@...zon.com>, <sblbir@...zon.com>,
<anchalag@...zon.com>, <xen-devel@...ts.xenproject.org>,
<vkuznets@...hat.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <dwmw@...zon.co.uk>,
<benh@...nel.crashing.org>
Subject: [PATCH v3 09/11] xen: Introduce wrapper for save/restore sched clock
offset
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 <anchalag@...zon.com>
---
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 91f5b330dcc6..e45349178ffc 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -387,12 +387,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;
@@ -435,7 +446,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 9f0a4345220e..9a79e210119c 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -69,6 +69,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.16.6
Powered by blists - more mailing lists