diff options
author | vs195195 <none@none> | 2008-07-14 22:13:43 -0700 |
---|---|---|
committer | vs195195 <none@none> | 2008-07-14 22:13:43 -0700 |
commit | 6de1798e30a31fa2f766b6b011c3c3d279f28ad0 (patch) | |
tree | fadd884122c5f21b09b898e2f50016b08bd64037 /usr/src | |
parent | a74f7440e9d4ba2cf59e6cbfc445479a28170f2a (diff) | |
download | illumos-gate-6de1798e30a31fa2f766b6b011c3c3d279f28ad0.tar.gz |
6716568 fpsd:fpsd daemon gives "kstat_lookup failed" error when processor state is changed to "no-intr"
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/fps/fpsd/fpsd.h | 1 | ||||
-rw-r--r-- | usr/src/cmd/fps/fpsd/fpsd_main.c | 25 | ||||
-rw-r--r-- | usr/src/cmd/fps/fpsd/fpsd_sched.c | 31 |
3 files changed, 41 insertions, 16 deletions
diff --git a/usr/src/cmd/fps/fpsd/fpsd.h b/usr/src/cmd/fps/fpsd/fpsd.h index 1819023041..679cc8f832 100644 --- a/usr/src/cmd/fps/fpsd/fpsd.h +++ b/usr/src/cmd/fps/fpsd/fpsd.h @@ -88,6 +88,7 @@ typedef struct char m_machine[MAXNAMELEN]; /* machine name e.g. sun4u */ uint_t m_num_fpus; /* num of fpus in the system */ uint_t m_num_on_fpuids; /* num of online cpus */ + int m_max_cpuid; /* maximum cpuid for this system */ fps_cpu_t *m_cpus; /* array of cpus to test */ int m_cpuids_size; /* size of previous array */ int m_num_cpus_to_test; /* Num cpus to run test */ diff --git a/usr/src/cmd/fps/fpsd/fpsd_main.c b/usr/src/cmd/fps/fpsd/fpsd_main.c index 7f54b01d41..b206cac7c8 100644 --- a/usr/src/cmd/fps/fpsd/fpsd_main.c +++ b/usr/src/cmd/fps/fpsd/fpsd_main.c @@ -79,7 +79,6 @@ void terminate_process(); static int door_id = -1; static char *str_fps_fmri = NULL; -static int max_cpuids = 0; /* Local static functions */ @@ -409,21 +408,19 @@ fpsd_probe(mach_conf_t *m_stat) processorid_t *cpuid_list; kid_t ret; + int total_onln = sysconf(_SC_NPROCESSORS_ONLN); /* probe the system and fill in mach_conf_t elements */ (void) sysinfo(SI_MACHINE, m_stat->m_machine, sizeof (m_stat->m_machine) - 1); - m_stat->m_num_fpus = (uint_t)sysconf(_SC_NPROCESSORS_CONF); - if (1 == m_stat->m_reprobe) { /* Reprobe request */ fpsd_message(FPSD_NO_EXIT, FPS_DEBUG, REPRBE_REQ); fpsd.d_iteration = 0; fpsd.d_interval = 0; fpsd.d_fpuid_index = 0; - m_stat->m_num_fpus = 0; m_stat->m_num_on_fpuids = 0; m_stat->m_cpuids_size = 0; m_stat->total_iter = 0; @@ -441,10 +438,7 @@ fpsd_probe(mach_conf_t *m_stat) * cpu_info for each. */ - m_stat->m_num_on_fpuids = (uint_t)sysconf(_SC_NPROCESSORS_ONLN); - fpsd_message(FPSD_NO_EXIT, FPS_DEBUG, NUM_ONLN_CPUS, - m_stat->m_num_on_fpuids); - cpuid_list = (processorid_t *)malloc(m_stat->m_num_on_fpuids * + cpuid_list = (processorid_t *)malloc(m_stat->m_num_fpus * sizeof (processorid_t)); if (NULL == cpuid_list) { fpsd_message(FPSD_NO_EXIT, FPS_INFO, LIBRARY_CALL_FAIL, @@ -453,15 +447,18 @@ fpsd_probe(mach_conf_t *m_stat) } cpuid_index = 0; - for (i = 0; i < max_cpuids; i++) { + for (i = 0; i < m_stat->m_max_cpuid; i++) { if (p_online(i, P_STATUS) == P_ONLINE) { cpuid_list[cpuid_index++] = i; } - if (cpuid_index == m_stat->m_num_on_fpuids) { + if (cpuid_index == total_onln) { /* Break after all onln cpuids found */ break; } } + m_stat->m_num_on_fpuids = (uint_t)cpuid_index; + fpsd_message(FPSD_NO_EXIT, FPS_DEBUG, NUM_ONLN_CPUS, + m_stat->m_num_on_fpuids); /* * Get cpu-brand info all valid cpuids using kstat. @@ -616,7 +613,7 @@ parse_and_set_cpu_id_list(char *strCPUs) invalid = 1; } if (num_cpus == fpsd.d_conf->m_num_fpus) { - /* More than max configurable cpus */ + /* More than max supported cpus */ fpsd_message(FPSD_NO_EXIT, FPS_ERROR, INVAL_PROP_VALUE, strCPUs); invalid = 1; @@ -808,23 +805,23 @@ static int fpsd_init() { m_conf_p = fpsd.d_conf; m_conf_p->m_machine[0] = '\0'; - m_conf_p->m_num_fpus = 0; m_conf_p->m_num_on_fpuids = 0; m_conf_p->m_cpuids_size = 0; m_conf_p->total_iter = 0; m_conf_p->m_reprobe = 0; m_conf_p->m_num_cpus_to_test = 0; + m_conf_p->m_num_fpus = (uint_t)sysconf(_SC_NPROCESSORS_MAX); (void) mutex_init(&log_mutex, USYNC_THREAD, NULL); - max_cpuids = (int)sysconf(_SC_CPUID_MAX) + 1; + m_conf_p->m_max_cpuid = (int)sysconf(_SC_CPUID_MAX) + 1; /* * Allocate enough memory to accomodate maximum number of CPUs * supported by this platform. */ m_conf_p->m_cpus = malloc(sizeof (fps_cpu_t) * - (int)sysconf(_SC_NPROCESSORS_MAX)); + m_conf_p->m_num_fpus); if (NULL == m_conf_p->m_cpus) return (1); else diff --git a/usr/src/cmd/fps/fpsd/fpsd_sched.c b/usr/src/cmd/fps/fpsd/fpsd_sched.c index a37deb4b2a..283feaca66 100644 --- a/usr/src/cmd/fps/fpsd/fpsd_sched.c +++ b/usr/src/cmd/fps/fpsd/fpsd_sched.c @@ -344,7 +344,7 @@ test_fpu_thr(/* ARGSUSED */ void *arg) */ #define MINSLEEP 8 - num_cpus = sysconf(_SC_NPROCESSORS_ONLN); + num_cpus = fpsd.d_conf->m_num_on_fpuids; intvl = poll_intvl = fpsd.d_interval; @@ -586,6 +586,32 @@ test_fpu_thr(/* ARGSUSED */ void *arg) } /* + * get_num_onln_cpus(): returns the number of processors that are in + * "on-line" state only. This number will be less than the number + * returned by sysconf(_SC_NPROCESSORS_ONLN) if there are some + * processors in "no-intr" state. + */ + +static int +get_num_onln_cpus() +{ + int i; + int num_onln = 0; + int total_onln = sysconf(_SC_NPROCESSORS_ONLN); + + for (i = 0; i < fpsd.d_conf->m_max_cpuid; i++) { + if (p_online(i, P_STATUS) == P_ONLINE) { + num_onln++; + } + if (num_onln == total_onln) { + /* Break after all onln cpuids found */ + break; + } + } + return (num_onln); +} + +/* * Identifies the fpu on which test will be scheduled next. */ @@ -603,7 +629,8 @@ identify_fpu_to_run_test(int *freq, int *iteration, int *fpu_index) { *iteration = *freq = 0; while (fpuid == -1) { - num_onln = (int)sysconf(_SC_NPROCESSORS_ONLN); + /* Check if the number of online processors has changed */ + num_onln = get_num_onln_cpus(); if (num_onln != fpsd.d_conf->m_num_on_fpuids) { fpsd_message(FPSD_NO_EXIT, FPS_DEBUG, REPROBE_MSG); fpsd.d_conf->m_reprobe = 1; |