8446 uts: pci_check_bios() should check for BIOS
[unleashed.git] / include / sys / sysdc_impl.h
blobbbc3814361d7dec1f7957b4d5ba7c54ab6f6f63b
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_SYSDC_IMPL_H
27 #define _SYS_SYSDC_IMPL_H
29 #include <sys/types.h>
30 #include <sys/time.h>
31 #include <sys/list.h>
33 #include <sys/sysdc.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 struct _kthread;
40 struct cpupart;
43 * Tracks per-processor-set information for SDC. Its main use is to
44 * implement per-processor-set breaks.
46 typedef struct sysdc_pset {
47 list_node_t sdp_node; /* node on sysdc_psets list */
48 struct cpupart *sdp_cpupart; /* associated cpu partition */
49 size_t sdp_nthreads; /* reference count */
51 /* The remainder is only touched by sysdc_update() */
52 hrtime_t sdp_onproc_time; /* time onproc at last update */
53 boolean_t sdp_need_break; /* threads forced to minpri */
54 uint_t sdp_should_break; /* # updates need_break is set */
55 uint_t sdp_dont_break; /* after break, # updates until next */
57 /* debugging fields */
58 uint_t sdp_onproc_threads;
59 hrtime_t sdp_vtime_last_interval;
60 uint_t sdp_DC_last_interval;
61 } sysdc_pset_t;
64 * Per-thread information, pointed to by t_cldata.
66 typedef struct sysdc {
67 uint_t sdc_target_DC; /* target duty cycle */
68 uint_t sdc_minpri; /* our minimum priority */
69 uint_t sdc_maxpri; /* our maximum priority */
71 sysdc_pset_t *sdc_pset; /* the processor set bound to */
73 /* protected by sdl_lock */
74 struct _kthread *sdc_thread; /* back-pointer, or NULL if freeable */
76 /* protected by arrangement between thread and sysdc_update() */
77 struct sysdc *sdc_next; /* next in hash table, NULL if not in */
79 /* protected by thread_lock() */
80 uint_t sdc_nupdates; /* number of sysdc_update_times() */
82 hrtime_t sdc_base_O; /* on-cpu time at last reset */
83 hrtime_t sdc_base_R; /* runnable time at last reset */
85 uint_t sdc_sleep_updates; /* 0, or nupdates when we slept */
86 clock_t sdc_ticks; /* sdc_tick() calls */
87 clock_t sdc_update_ticks; /* value of ticks for forced update */
88 clock_t sdc_pri_check; /* lbolt when we checked our priority */
89 hrtime_t sdc_last_base_O; /* onproc time at sysdc_update() */
91 uint_t sdc_pri; /* our last computed priority */
92 uint_t sdc_epri; /* our actual thread priority */
94 /* for debugging only */
95 clock_t sdc_reset; /* lbolt when we reset our bases */
96 hrtime_t sdc_cur_O; /* on-cpu time at last prio check */
97 hrtime_t sdc_cur_R; /* runnable time at last prio check */
98 hrtime_t sdc_last_O; /* onproc time at thread update */
99 uint_t sdc_cur_DC; /* our actual duty cycle at last chk */
100 } sysdc_t;
103 * Hash bucket of active SDC threads.
105 typedef struct sysdc_list {
106 kmutex_t sdl_lock; /* lock keeping threads from exiting */
107 sysdc_t *volatile sdl_list; /* list of active threads in bucket */
108 char sdl_pad[64 - sizeof (kmutex_t) - sizeof (sysdc_t *)];
109 } sysdc_list_t;
112 * Args to CL_ENTERCLASS().
114 typedef struct sysdc_params {
115 uint_t sdp_minpri;
116 uint_t sdp_maxpri;
117 uint_t sdp_DC;
118 } sysdc_params_t;
121 * Duty cycles are percentages in the range [1,100].
123 #define SYSDC_DC_MAX 100u /* 1 <= DC <= DC_MAX */
125 #ifdef __cplusplus
127 #endif
129 #endif /* _SYS_SYSDC_IMPL_H */