Mercurial > illumos > illumos-gate
changeset 4892:5fe372d29888
6594536 Fix for 6587576 broke SPARC.
author | mh27603 |
---|---|
date | Sat, 18 Aug 2007 10:18:14 -0700 |
parents | f4f971e9574d |
children | 0177e932e294 |
files | usr/src/uts/common/os/cpu.c |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/os/cpu.c Sat Aug 18 10:07:23 2007 -0700 +++ b/usr/src/uts/common/os/cpu.c Sat Aug 18 10:18:14 2007 -0700 @@ -2785,6 +2785,7 @@ { char clkstr[sizeof ("18446744073709551615") + 1]; /* ui64 MAX */ const char *lfreqs = clkstr; + boolean_t locked = B_FALSE; /* * A NULL pointer means we only support one speed. @@ -2797,9 +2798,13 @@ /* * Make sure the frequency doesn't change while a snapshot is - * going on. + * going on. Of course, we only need to worry about this if + * the kstat exists. */ - mutex_enter(cp->cpu_info_kstat->ks_lock); + if (cp->cpu_info_kstat != NULL) { + mutex_enter(cp->cpu_info_kstat->ks_lock); + locked = B_TRUE; + } /* * Free any previously allocated string. @@ -2816,7 +2821,8 @@ /* * kstat is free to take a snapshot once again. */ - mutex_exit(cp->cpu_info_kstat->ks_lock); + if (locked) + mutex_exit(cp->cpu_info_kstat->ks_lock); } /*