[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: Problems with APIC on versions 4.9 and later (4.8 works)
On 26.01.2021 14:03, Claudemir Todo Bom wrote: > If this information is good for more tests, please send the patch and > I will test it! Here you go. For simplifying analysis it may be helpful if you could limit the number of CPUs in use, e.g. by "maxcpus=4" or at least "smt=0". Provided the problem still reproduces with such options, of course. Jan --- unstable.orig/xen/arch/x86/time.c +++ unstable/xen/arch/x86/time.c @@ -1574,6 +1574,12 @@ static void local_time_calibration(void) * TSC Reliability check */ +static struct {//temp + unsigned cpu; + signed iter; + cycles_t prev, now; +} check_log[NR_CPUS + 4]; +static unsigned check_idx;//temp /* * The Linux original version of this function is * Copyright (c) 2006, Red Hat, Inc., Ingo Molnar @@ -1582,6 +1588,7 @@ static void check_tsc_warp(unsigned long { static DEFINE_SPINLOCK(sync_lock); static cycles_t last_tsc; +unsigned idx, cpu = smp_processor_id();//temp cycles_t start, now, prev, end; int i; @@ -1592,6 +1599,15 @@ static void check_tsc_warp(unsigned long end = start + tsc_khz * 20ULL; now = start; +{//temp + spin_lock(&sync_lock); + idx = check_idx++; + check_log[idx].cpu = cpu; + check_log[idx].iter = -1; + check_log[idx].now = now; + spin_unlock(&sync_lock); +} + for ( i = 0; ; i++ ) { /* @@ -1626,7 +1642,14 @@ static void check_tsc_warp(unsigned long { spin_lock(&sync_lock); if ( *max_warp < prev - now ) +{//temp *max_warp = prev - now; + idx = check_idx++; + check_log[idx].cpu = cpu; + check_log[idx].iter = i; + check_log[idx].prev = prev; + check_log[idx].now = now; +} spin_unlock(&sync_lock); } } @@ -1663,6 +1686,12 @@ static void tsc_check_reliability(void) cpu_relax(); spin_unlock(&lock); +{//temp + unsigned i; + printk("CHK[%2u] %lx\n", cpu, tsc_max_warp);//temp + for(i = 0; i < ARRAY_SIZE(check_log) && check_log[i].now; ++i) + printk("chk[%4u] CPU%-2u %016lx %016lx #%d\n", i, check_log[i].cpu, check_log[i].prev, check_log[i].now, check_log[i].iter); +} } /* @@ -1677,6 +1706,7 @@ struct calibration_rendezvous { u64 master_tsc_stamp; }; +static bool rdzv_log;//temp static void time_calibration_rendezvous_tail(const struct calibration_rendezvous *r) { @@ -1686,6 +1716,7 @@ time_calibration_rendezvous_tail(const s c->local_stime = get_s_time_fixed(c->local_tsc); c->master_stime = r->master_stime; +if(rdzv_log) printk("RDZV[%2u] t=%016lx(%016lx) s=%012lx(%012lx)\n", smp_processor_id(), c->local_tsc, r->master_tsc_stamp, c->local_stime, r->master_stime);//temp raise_softirq(TIME_CALIBRATE_SOFTIRQ); } @@ -1699,6 +1730,7 @@ static void time_calibration_tsc_rendezv struct calibration_rendezvous *r = _r; unsigned int total_cpus = cpumask_weight(&r->cpu_calibration_map); +if(rdzv_log) printk("RDZV[%2u] t=%016lx\n", smp_processor_id(), rdtsc_ordered());//temp /* Loop to get rid of cache effects on TSC skew. */ for ( i = 4; i >= 0; i-- ) { @@ -1788,6 +1820,12 @@ static void time_calibration(void *unuse struct calibration_rendezvous r = { .semaphore = ATOMIC_INIT(0) }; +static unsigned long cnt, thr;//temp +if(system_state > SYS_STATE_smp_boot && ++cnt > thr) {//temp + thr |= cnt; + printk("TSC: %ps\n", time_calibration_rendezvous_fn); + rdzv_log = true; +} if ( clocksource_is_tsc() ) { @@ -1802,6 +1840,10 @@ static void time_calibration(void *unuse on_selected_cpus(&r.cpu_calibration_map, time_calibration_rendezvous_fn, &r, 1); +if(rdzv_log || system_state <= SYS_STATE_smp_boot) {//temp + rdzv_log = false; + printk("TSC: end rendezvous\n"); +} } static struct cpu_time_stamp ap_bringup_ref; @@ -1898,6 +1940,7 @@ void init_percpu_time(void) } t->stamp.local_tsc = tsc; t->stamp.local_stime = now; +printk("INIT[%2u] t=%016lx s=%012lx m=%012lx\n", smp_processor_id(), tsc, now, t->stamp.master_stime);//temp } /* @@ -2043,6 +2086,7 @@ static int __init verify_tsc_reliability * While with constant-rate TSCs the scale factor can be shared, when TSCs * are not marked as 'reliable', re-sync during rendezvous. */ +printk("TSC: c=%d r=%d\n", !!boot_cpu_has(X86_FEATURE_CONSTANT_TSC), !!boot_cpu_has(X86_FEATURE_TSC_RELIABLE));//temp if ( boot_cpu_has(X86_FEATURE_CONSTANT_TSC) && !boot_cpu_has(X86_FEATURE_TSC_RELIABLE) ) time_calibration_rendezvous_fn = time_calibration_tsc_rendezvous; @@ -2056,6 +2100,7 @@ int __init init_xen_time(void) { tsc_check_writability(); +printk("TSC: c=%d r=%d\n", !!boot_cpu_has(X86_FEATURE_CONSTANT_TSC), !!boot_cpu_has(X86_FEATURE_TSC_RELIABLE));//temp open_softirq(TIME_CALIBRATE_SOFTIRQ, local_time_calibration); /* NB. get_wallclock_time() can take over one second to execute. */
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |