|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH RFC v2] x86/time: set AP's TSC scale estimate earlier
NOW() (in particular) can be used ahead of init_percpu_time(). As the
initial scale value set is merely the BSP's, we can as well set it very
early when the AP is coming up.
Setting the scale alone, however, doesn't work, so the entire struct
cpu_time is copied.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
RFC: Copying the entire struct won't work very well when tsc_adjust[] is
in use (and values there differ between sockets).
This in particular mostly eliminates an anomaly with log messages issued
early while APs are coming up, when "boot" console timestamps are in use.
---
v2: Call the function from very early in start_secondary()
--- a/xen/arch/x86/include/asm/time.h
+++ b/xen/arch/x86/include/asm/time.h
@@ -21,6 +21,7 @@ mktime (unsigned int year, unsigned int
int time_suspend(void);
int time_resume(void);
+void preinit_percpu_time(unsigned int cpu);
void init_percpu_time(void);
void time_latch_stamps(void);
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -356,6 +356,8 @@ void asmlinkage start_secondary(void)
/* Safe to enable feature such as CR4.MCE with the IDT set up now. */
write_cr4(mmu_cr4_features);
+ preinit_percpu_time(cpu);
+
percpu_traps_init();
cpu_init();
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -2346,6 +2346,12 @@ void time_latch_stamps(void)
ap_bringup_ref.local_stime = get_s_time_fixed(ap_bringup_ref.local_tsc);
}
+void preinit_percpu_time(unsigned int cpu)
+{
+ /* Initial estimate for TSC rate etc. */
+ per_cpu(cpu_time, cpu) = per_cpu(cpu_time, 0);
+}
+
void init_percpu_time(void)
{
struct cpu_time *t = &this_cpu(cpu_time);
@@ -2353,9 +2359,6 @@ void init_percpu_time(void)
u64 tsc;
s_time_t now;
- /* Initial estimate for TSC rate. */
- t->tsc_scale = per_cpu(cpu_time, 0).tsc_scale;
-
if ( tsc_adjust )
{
unsigned int socket = cpu_to_socket(smp_processor_id());
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |