diff options
author | Frank Van Der Linden <Frank.Vanderlinden@Sun.COM> | 2009-12-16 09:50:00 -0800 |
---|---|---|
committer | Frank Van Der Linden <Frank.Vanderlinden@Sun.COM> | 2009-12-16 09:50:00 -0800 |
commit | 3006ae8299c242a6ac48c0384a6167bcc3303d69 (patch) | |
tree | dd636c6c8374be2896e9aed8d5ba5777a2a29f31 | |
parent | 34de876298c5177ddeb98f3af7e4e3012f16e2a7 (diff) | |
download | illumos-gate-3006ae8299c242a6ac48c0384a6167bcc3303d69.tar.gz |
6740460 Dom0 hangs while running libsched - no resources to continue
-rw-r--r-- | usr/src/uts/i86pc/os/intr.c | 2 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/mp_startup.c | 2 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/machcpuvar.h | 9 | ||||
-rw-r--r-- | usr/src/uts/i86xpv/os/xpv_timestamp.c | 13 |
4 files changed, 17 insertions, 9 deletions
diff --git a/usr/src/uts/i86pc/os/intr.c b/usr/src/uts/i86pc/os/intr.c index 4f9f7f2f4b..786cd29e8f 100644 --- a/usr/src/uts/i86pc/os/intr.c +++ b/usr/src/uts/i86pc/os/intr.c @@ -934,6 +934,8 @@ do_interrupt(struct regs *rp, trap_trace_rec_t *ttp) cpu_idle_exit(CPU_IDLE_CB_FLAG_INTR); + ++*(uint16_t *)&cpu->cpu_m.mcpu_istamp; + /* * If it's a softint go do it now. */ diff --git a/usr/src/uts/i86pc/os/mp_startup.c b/usr/src/uts/i86pc/os/mp_startup.c index d9369d0b5c..0ba377f67c 100644 --- a/usr/src/uts/i86pc/os/mp_startup.c +++ b/usr/src/uts/i86pc/os/mp_startup.c @@ -258,6 +258,8 @@ mp_startup_init(int cpun) #endif cp->cpu_m.mcpu_idle_cpu = cpu_idle; + cp->cpu_m.mcpu_istamp = cpun << 16; + procp = curthread->t_procp; mutex_enter(&cpu_lock); diff --git a/usr/src/uts/i86pc/sys/machcpuvar.h b/usr/src/uts/i86pc/sys/machcpuvar.h index 955468a714..b652331715 100644 --- a/usr/src/uts/i86pc/sys/machcpuvar.h +++ b/usr/src/uts/i86pc/sys/machcpuvar.h @@ -136,6 +136,15 @@ struct machcpu { struct cpu_ucode_info *mcpu_ucode_info; void *mcpu_pm_mach_state; + + /* + * A stamp that is unique per processor and changes + * whenever an interrupt happens. Userful for detecting + * if a section of code gets interrupted. + * The high order 16 bits will hold the cpu->cpu_id. + * The low order bits will be incremented on every interrupt. + */ + volatile uint32_t mcpu_istamp; }; #define NINTR_THREADS (LOCK_LEVEL-1) /* number of interrupt threads */ diff --git a/usr/src/uts/i86xpv/os/xpv_timestamp.c b/usr/src/uts/i86xpv/os/xpv_timestamp.c index da7f263a6f..d7d13f984b 100644 --- a/usr/src/uts/i86xpv/os/xpv_timestamp.c +++ b/usr/src/uts/i86xpv/os/xpv_timestamp.c @@ -87,14 +87,9 @@ dtrace_xpv_getsystime(void) vcpu_time_info_t *src; vcpu_time_info_t __vti, *dst = &__vti; uint64_t tsc_delta; - kthread_t *t = curthread; uint64_t tsc; hrtime_t result; - - /* - * This stops us from wandering off the virtual cpu. - */ - t->t_preempt++; + uint32_t stamp; src = &CPU->cpu_m.mcpu_vcpu_info->time; @@ -104,6 +99,7 @@ dtrace_xpv_getsystime(void) */ do { dst->version = src->version; + stamp = CPU->cpu_m.mcpu_istamp; membar_consumer(); @@ -122,7 +118,8 @@ dtrace_xpv_getsystime(void) membar_consumer(); - } while ((src->version & 1) | (dst->version ^ src->version)); + } while (((src->version & 1) | (dst->version ^ src->version)) || + CPU->cpu_m.mcpu_istamp != stamp); if (dst->tsc_shift >= 0) tsc_delta <<= dst->tsc_shift; @@ -132,8 +129,6 @@ dtrace_xpv_getsystime(void) result = dst->system_time + ((uint64_t)(tsc_delta * (uint64_t)dst->tsc_to_system_mul) >> 32); - t->t_preempt--; - return (result); } |