Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1635261 > unrolled thread

[PATCH] xen/x86: Do not call xen_init_time_ops() until shared_info is initialized

Started byBoris Ostrovsky <boris.ostrovsky@oracle.com>
First post2017-05-03 22:30 +0200
Last post2017-05-05 11:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] xen/x86: Do not call xen_init_time_ops() until shared_info is initialized Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-05-03 22:30 +0200
    Re: [PATCH] xen/x86: Do not call xen_init_time_ops() until  shared_info is initialized Juergen Gross <jgross@suse.com> - 2017-05-04 08:40 +0200
    Re: [PATCH] xen/x86: Do not call xen_init_time_ops() until  shared_info is initialized Juergen Gross <jgross@suse.com> - 2017-05-05 11:00 +0200

#1635261 — [PATCH] xen/x86: Do not call xen_init_time_ops() until shared_info is initialized

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2017-05-03 22:30 +0200
Subject[PATCH] xen/x86: Do not call xen_init_time_ops() until shared_info is initialized
Message-ID<tD94l-1P1-5@gated-at.bofh.it>
Routines that are set by xen_init_time_ops() use shared_info's
pvclock_vcpu_time_info area. This area is not properly available until
shared_info is mapped in xen_setup_shared_info().

This became especially problematic due to commit dd759d93f4dd ("x86/timers:
Add simple udelay calibration") where we end up reading tsc_to_system_mul
from xen_dummy_shared_info (i.e. getting zero value) and then trying
to divide by it in pvclock_tsc_khz().

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 arch/x86/xen/enlighten_pv.c | 9 +++++++--
 arch/x86/xen/time.c         | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index a732bc2..6f80a01 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -988,6 +988,13 @@ void xen_setup_shared_info(void)
 #endif
 
 	xen_setup_mfn_list_list();
+
+	/*
+	 * Now that shared info is set up we can start using routines that
+	 * point to pvclock area.
+	 */
+	if (system_state == SYSTEM_BOOTING)
+		xen_init_time_ops();
 }
 
 /* This is called once we have the cpu_possible_mask */
@@ -1286,8 +1293,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	x86_init.oem.arch_setup = xen_arch_setup;
 	x86_init.oem.banner = xen_banner;
 
-	xen_init_time_ops();
-
 	/*
 	 * Set up some pagetable state before starting to set any ptes.
 	 */
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 090c7eb..a1895a8 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -406,7 +406,7 @@ static void __init xen_time_init(void)
 		pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier);
 }
 
-void __init xen_init_time_ops(void)
+void __ref xen_init_time_ops(void)
 {
 	pv_time_ops = xen_time_ops;
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1635433 — Re: [PATCH] xen/x86: Do not call xen_init_time_ops() until shared_info is initialized

FromJuergen Gross <jgross@suse.com>
Date2017-05-04 08:40 +0200
SubjectRe: [PATCH] xen/x86: Do not call xen_init_time_ops() until shared_info is initialized
Message-ID<tDiAF-8dQ-3@gated-at.bofh.it>
In reply to#1635261
On 03/05/17 22:20, Boris Ostrovsky wrote:
> Routines that are set by xen_init_time_ops() use shared_info's
> pvclock_vcpu_time_info area. This area is not properly available until
> shared_info is mapped in xen_setup_shared_info().
> 
> This became especially problematic due to commit dd759d93f4dd ("x86/timers:
> Add simple udelay calibration") where we end up reading tsc_to_system_mul
> from xen_dummy_shared_info (i.e. getting zero value) and then trying
> to divide by it in pvclock_tsc_khz().
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Thanks,

Juergen

[toc] | [prev] | [next] | [standalone]


#1636259 — Re: [PATCH] xen/x86: Do not call xen_init_time_ops() until shared_info is initialized

FromJuergen Gross <jgross@suse.com>
Date2017-05-05 11:00 +0200
SubjectRe: [PATCH] xen/x86: Do not call xen_init_time_ops() until shared_info is initialized
Message-ID<tDHfI-7Oz-21@gated-at.bofh.it>
In reply to#1635261
On 03/05/17 22:20, Boris Ostrovsky wrote:
> Routines that are set by xen_init_time_ops() use shared_info's
> pvclock_vcpu_time_info area. This area is not properly available until
> shared_info is mapped in xen_setup_shared_info().
> 
> This became especially problematic due to commit dd759d93f4dd ("x86/timers:
> Add simple udelay calibration") where we end up reading tsc_to_system_mul
> from xen_dummy_shared_info (i.e. getting zero value) and then trying
> to divide by it in pvclock_tsc_khz().
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Pushed to xen/tip for-linus-4.12b


Thanks,

Juergen

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web