2 * Copyright (c) 2003-2011 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
30 #include <sys/param.h>
31 #include <sys/kernel.h>
32 #include <sys/sysctl.h>
33 #include <i386/cpuid.h>
35 #include <i386/machine_routines.h>
36 #include <i386/pal_routines.h>
37 #include <i386/ucode.h>
38 #include <kern/clock.h>
39 #include <libkern/libkern.h>
40 #include <i386/lapic.h>
44 _i386_cpu_info SYSCTL_HANDLER_ARGS
46 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
55 if (arg2
== 0 && ((char *)ptr
)[0] == '\0') {
59 if (arg2
== sizeof(uint8_t)) {
60 value
= (uint32_t) *(uint8_t *)ptr
;
62 arg2
= sizeof(uint32_t);
64 return SYSCTL_OUT(req
, ptr
, arg2
? (size_t) arg2
: strlen((char *)ptr
)+1);
68 i386_cpu_info SYSCTL_HANDLER_ARGS
70 void *ptr
= (uint8_t *)cpuid_info() + (uintptr_t)arg1
;
71 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
75 i386_cpu_info_nonzero SYSCTL_HANDLER_ARGS
77 void *ptr
= (uint8_t *)cpuid_info() + (uintptr_t)arg1
;
78 int value
= *(uint32_t *)ptr
;
83 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
86 cpu_mwait SYSCTL_HANDLER_ARGS
88 i386_cpu_info_t
*cpu_info
= cpuid_info();
89 void *ptr
= (uint8_t *)cpu_info
->cpuid_mwait_leafp
+ (uintptr_t)arg1
;
90 if (cpu_info
->cpuid_mwait_leafp
== NULL
)
92 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
96 cpu_thermal SYSCTL_HANDLER_ARGS
98 i386_cpu_info_t
*cpu_info
= cpuid_info();
99 void *ptr
= (uint8_t *)cpu_info
->cpuid_thermal_leafp
+ (uintptr_t)arg1
;
100 if (cpu_info
->cpuid_thermal_leafp
== NULL
)
102 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
106 cpu_arch_perf SYSCTL_HANDLER_ARGS
108 i386_cpu_info_t
*cpu_info
= cpuid_info();
109 void *ptr
= (uint8_t *)cpu_info
->cpuid_arch_perf_leafp
+ (uintptr_t)arg1
;
110 if (cpu_info
->cpuid_arch_perf_leafp
== NULL
)
112 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
116 cpu_xsave SYSCTL_HANDLER_ARGS
118 i386_cpu_info_t
*cpu_info
= cpuid_info();
119 void *ptr
= (uint8_t *)cpu_info
->cpuid_xsave_leafp
+ (uintptr_t)arg1
;
120 if (cpu_info
->cpuid_xsave_leafp
== NULL
)
122 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
127 cpu_features SYSCTL_HANDLER_ARGS
129 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
130 __unused
void *unused_arg1
= arg1
;
131 __unused
int unused_arg2
= arg2
;
135 cpuid_get_feature_names(cpuid_features(), buf
, sizeof(buf
));
137 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
141 cpu_extfeatures SYSCTL_HANDLER_ARGS
143 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
144 __unused
void *unused_arg1
= arg1
;
145 __unused
int unused_arg2
= arg2
;
149 cpuid_get_extfeature_names(cpuid_extfeatures(), buf
, sizeof(buf
));
151 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
155 cpu_leaf7_features SYSCTL_HANDLER_ARGS
157 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
158 __unused
void *unused_arg1
= arg1
;
159 __unused
int unused_arg2
= arg2
;
162 uint32_t leaf7_features
= cpuid_info()->cpuid_leaf7_features
;
163 if (leaf7_features
== 0)
167 cpuid_get_leaf7_feature_names(leaf7_features
, buf
, sizeof(buf
));
169 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
173 cpu_logical_per_package SYSCTL_HANDLER_ARGS
175 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
176 __unused
void *unused_arg1
= arg1
;
177 __unused
int unused_arg2
= arg2
;
178 i386_cpu_info_t
*cpu_info
= cpuid_info();
180 if (!(cpuid_features() & CPUID_FEATURE_HTT
))
183 return SYSCTL_OUT(req
, &cpu_info
->cpuid_logical_per_package
,
184 sizeof(cpu_info
->cpuid_logical_per_package
));
188 cpu_flex_ratio_desired SYSCTL_HANDLER_ARGS
190 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
191 __unused
void *unused_arg1
= arg1
;
192 __unused
int unused_arg2
= arg2
;
193 i386_cpu_info_t
*cpu_info
= cpuid_info();
195 if (cpu_info
->cpuid_model
!= 26)
198 return SYSCTL_OUT(req
, &flex_ratio
, sizeof(flex_ratio
));
202 cpu_flex_ratio_min SYSCTL_HANDLER_ARGS
204 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
205 __unused
void *unused_arg1
= arg1
;
206 __unused
int unused_arg2
= arg2
;
207 i386_cpu_info_t
*cpu_info
= cpuid_info();
209 if (cpu_info
->cpuid_model
!= 26)
212 return SYSCTL_OUT(req
, &flex_ratio_min
, sizeof(flex_ratio_min
));
216 cpu_flex_ratio_max SYSCTL_HANDLER_ARGS
218 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
219 __unused
void *unused_arg1
= arg1
;
220 __unused
int unused_arg2
= arg2
;
221 i386_cpu_info_t
*cpu_info
= cpuid_info();
223 if (cpu_info
->cpuid_model
!= 26)
226 return SYSCTL_OUT(req
, &flex_ratio_max
, sizeof(flex_ratio_max
));
230 cpu_ucode_update SYSCTL_HANDLER_ARGS
232 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
233 __unused
void *unused_arg1
= arg1
;
234 __unused
int unused_arg2
= arg2
;
238 error
= SYSCTL_IN(req
, &addr
, sizeof(addr
));
242 int ret
= ucode_interface(addr
);
246 extern uint64_t panic_restart_timeout
;
248 panic_set_restart_timeout(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
250 int new_value
= 0, old_value
= 0, changed
= 0, error
;
253 if (panic_restart_timeout
) {
254 absolutetime_to_nanoseconds(panic_restart_timeout
, &nstime
);
255 old_value
= nstime
/ NSEC_PER_SEC
;
258 error
= sysctl_io_number(req
, old_value
, sizeof(int), &new_value
, &changed
);
259 if (error
== 0 && changed
) {
260 nanoseconds_to_absolutetime(((uint64_t)new_value
) * NSEC_PER_SEC
, &panic_restart_timeout
);
266 * Populates the {CPU, vector, latency} triple for the maximum observed primary
270 misc_interrupt_latency_max(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
272 int changed
= 0, error
;
276 interrupt_populate_latency_stats(buf
, sizeof(buf
));
278 error
= sysctl_io_string(req
, buf
, sizeof(buf
), 0, &changed
);
280 if (error
== 0 && changed
) {
281 interrupt_reset_latency_stats();
288 * Triggers a machine-check exception - for a suitably configured kernel only.
290 extern void mca_exception_panic(void);
292 misc_machine_check_panic(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
294 int changed
= 0, error
;
298 error
= sysctl_io_string(req
, buf
, sizeof(buf
), 0, &changed
);
300 if (error
== 0 && changed
) {
301 mca_exception_panic();
307 SYSCTL_NODE(_machdep
, OID_AUTO
, cpu
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
310 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, max_basic
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
311 (void *)offsetof(i386_cpu_info_t
, cpuid_max_basic
),sizeof(uint32_t),
312 i386_cpu_info
, "IU", "Max Basic Information value");
314 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, max_ext
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
315 (void *)offsetof(i386_cpu_info_t
, cpuid_max_ext
), sizeof(uint32_t),
316 i386_cpu_info
, "IU", "Max Extended Function Information value");
318 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, vendor
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
319 (void *)offsetof(i386_cpu_info_t
, cpuid_vendor
), 0,
320 i386_cpu_info
, "A", "CPU vendor");
322 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, brand_string
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
323 (void *)offsetof(i386_cpu_info_t
, cpuid_brand_string
), 0,
324 i386_cpu_info
, "A", "CPU brand string");
326 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, family
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
327 (void *)offsetof(i386_cpu_info_t
, cpuid_family
), sizeof(uint8_t),
328 i386_cpu_info
, "I", "CPU family");
330 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, model
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
331 (void *)offsetof(i386_cpu_info_t
, cpuid_model
), sizeof(uint8_t),
332 i386_cpu_info
, "I", "CPU model");
334 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extmodel
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
335 (void *)offsetof(i386_cpu_info_t
, cpuid_extmodel
), sizeof(uint8_t),
336 i386_cpu_info
, "I", "CPU extended model");
338 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfamily
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
339 (void *)offsetof(i386_cpu_info_t
, cpuid_extfamily
), sizeof(uint8_t),
340 i386_cpu_info
, "I", "CPU extended family");
342 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, stepping
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
343 (void *)offsetof(i386_cpu_info_t
, cpuid_stepping
), sizeof(uint8_t),
344 i386_cpu_info
, "I", "CPU stepping");
346 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, feature_bits
, CTLTYPE_QUAD
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
347 (void *)offsetof(i386_cpu_info_t
, cpuid_features
), sizeof(uint64_t),
348 i386_cpu_info
, "IU", "CPU features");
350 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, leaf7_feature_bits
,
351 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
352 (void *)offsetof(i386_cpu_info_t
, cpuid_leaf7_features
),
354 i386_cpu_info_nonzero
, "IU", "CPU Leaf7 features");
356 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfeature_bits
, CTLTYPE_QUAD
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
357 (void *)offsetof(i386_cpu_info_t
, cpuid_extfeatures
), sizeof(uint64_t),
358 i386_cpu_info
, "IU", "CPU extended features");
360 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, signature
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
361 (void *)offsetof(i386_cpu_info_t
, cpuid_signature
), sizeof(uint32_t),
362 i386_cpu_info
, "I", "CPU signature");
364 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, brand
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
365 (void *)offsetof(i386_cpu_info_t
, cpuid_brand
), sizeof(uint8_t),
366 i386_cpu_info
, "I", "CPU brand");
368 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, features
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
370 cpu_features
, "A", "CPU feature names");
372 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, leaf7_features
,
373 CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
375 cpu_leaf7_features
, "A", "CPU Leaf7 feature names");
377 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfeatures
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
379 cpu_extfeatures
, "A", "CPU extended feature names");
381 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, logical_per_package
,
382 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
384 cpu_logical_per_package
, "I", "CPU logical cpus per package");
386 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, cores_per_package
,
387 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
388 (void *)offsetof(i386_cpu_info_t
, cpuid_cores_per_package
),
390 i386_cpu_info
, "I", "CPU cores per package");
392 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, microcode_version
,
393 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
394 (void *)offsetof(i386_cpu_info_t
, cpuid_microcode_version
),
396 i386_cpu_info
, "I", "Microcode version number");
398 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, processor_flag
,
399 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
400 (void *)offsetof(i386_cpu_info_t
, cpuid_processor_flag
),
402 i386_cpu_info
, "I", "CPU processor flag");
405 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, mwait
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
408 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, linesize_min
,
409 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
410 (void *)offsetof(cpuid_mwait_leaf_t
, linesize_min
),
412 cpu_mwait
, "I", "Monitor/mwait minimum line size");
414 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, linesize_max
,
415 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
416 (void *)offsetof(cpuid_mwait_leaf_t
, linesize_max
),
418 cpu_mwait
, "I", "Monitor/mwait maximum line size");
420 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, extensions
,
421 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
422 (void *)offsetof(cpuid_mwait_leaf_t
, extensions
),
424 cpu_mwait
, "I", "Monitor/mwait extensions");
426 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, sub_Cstates
,
427 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
428 (void *)offsetof(cpuid_mwait_leaf_t
, sub_Cstates
),
430 cpu_mwait
, "I", "Monitor/mwait sub C-states");
433 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, thermal
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
436 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, sensor
,
437 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
438 (void *)offsetof(cpuid_thermal_leaf_t
, sensor
),
440 cpu_thermal
, "I", "Thermal sensor present");
442 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, dynamic_acceleration
,
443 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
444 (void *)offsetof(cpuid_thermal_leaf_t
, dynamic_acceleration
),
446 cpu_thermal
, "I", "Dynamic Acceleration Technology (Turbo Mode)");
448 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, invariant_APIC_timer
,
449 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
450 (void *)offsetof(cpuid_thermal_leaf_t
, invariant_APIC_timer
),
452 cpu_thermal
, "I", "Invariant APIC Timer");
454 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, thresholds
,
455 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
456 (void *)offsetof(cpuid_thermal_leaf_t
, thresholds
),
458 cpu_thermal
, "I", "Number of interrupt thresholds");
460 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, ACNT_MCNT
,
461 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
462 (void *)offsetof(cpuid_thermal_leaf_t
, ACNT_MCNT
),
464 cpu_thermal
, "I", "ACNT_MCNT capability");
466 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, core_power_limits
,
467 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
468 (void *)offsetof(cpuid_thermal_leaf_t
, core_power_limits
),
470 cpu_thermal
, "I", "Power Limit Notifications at a Core Level");
472 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, fine_grain_clock_mod
,
473 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
474 (void *)offsetof(cpuid_thermal_leaf_t
, fine_grain_clock_mod
),
476 cpu_thermal
, "I", "Fine Grain Clock Modulation");
478 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, package_thermal_intr
,
479 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
480 (void *)offsetof(cpuid_thermal_leaf_t
, package_thermal_intr
),
482 cpu_thermal
, "I", "Package Thermal interrupt and Status");
484 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, hardware_feedback
,
485 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
486 (void *)offsetof(cpuid_thermal_leaf_t
, hardware_feedback
),
488 cpu_thermal
, "I", "Hardware Coordination Feedback");
490 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, energy_policy
,
491 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
492 (void *)offsetof(cpuid_thermal_leaf_t
, energy_policy
),
494 cpu_thermal
, "I", "Energy Efficient Policy Support");
496 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, xsave
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
499 SYSCTL_PROC(_machdep_cpu_xsave
, OID_AUTO
, extended_state
,
500 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
501 (void *)offsetof(cpuid_xsave_leaf_t
, extended_state
),
502 sizeof(cpuid_xsave_leaf_t
),
503 cpu_xsave
, "IU", "XSAVE Extended State");
506 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, arch_perf
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
509 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, version
,
510 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
511 (void *)offsetof(cpuid_arch_perf_leaf_t
, version
),
513 cpu_arch_perf
, "I", "Architectural Performance Version Number");
515 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, number
,
516 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
517 (void *)offsetof(cpuid_arch_perf_leaf_t
, number
),
519 cpu_arch_perf
, "I", "Number of counters per logical cpu");
521 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, width
,
522 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
523 (void *)offsetof(cpuid_arch_perf_leaf_t
, width
),
525 cpu_arch_perf
, "I", "Bit width of counters");
527 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events_number
,
528 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
529 (void *)offsetof(cpuid_arch_perf_leaf_t
, events_number
),
531 cpu_arch_perf
, "I", "Number of monitoring events");
533 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events
,
534 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
535 (void *)offsetof(cpuid_arch_perf_leaf_t
, events
),
537 cpu_arch_perf
, "I", "Bit vector of events");
539 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_number
,
540 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
541 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_number
),
543 cpu_arch_perf
, "I", "Number of fixed-function counters");
545 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_width
,
546 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
547 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_width
),
549 cpu_arch_perf
, "I", "Bit-width of fixed-function counters");
552 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, cache
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
555 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, linesize
,
556 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
557 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_linesize
),
559 i386_cpu_info
, "I", "Cacheline size");
561 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, L2_associativity
,
562 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
563 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_L2_associativity
),
565 i386_cpu_info
, "I", "L2 cache associativity");
567 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, size
,
568 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
569 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_size
),
571 i386_cpu_info
, "I", "Cache size (in Kbytes)");
574 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, tlb
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
576 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, inst
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
578 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, data
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
581 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, small
,
582 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
583 (void *)offsetof(i386_cpu_info_t
,
584 cpuid_tlb
[TLB_INST
][TLB_SMALL
][0]),
586 i386_cpu_info_nonzero
, "I",
587 "Number of small page instruction TLBs");
589 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small
,
590 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
591 (void *)offsetof(i386_cpu_info_t
,
592 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][0]),
594 i386_cpu_info_nonzero
, "I",
595 "Number of small page data TLBs (1st level)");
597 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small_level1
,
598 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
599 (void *)offsetof(i386_cpu_info_t
,
600 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][1]),
602 i386_cpu_info_nonzero
, "I",
603 "Number of small page data TLBs (2nd level)");
605 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, large
,
606 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
607 (void *)offsetof(i386_cpu_info_t
,
608 cpuid_tlb
[TLB_INST
][TLB_LARGE
][0]),
610 i386_cpu_info_nonzero
, "I",
611 "Number of large page instruction TLBs");
613 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large
,
614 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
615 (void *)offsetof(i386_cpu_info_t
,
616 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][0]),
618 i386_cpu_info_nonzero
, "I",
619 "Number of large page data TLBs (1st level)");
621 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large_level1
,
622 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
623 (void *)offsetof(i386_cpu_info_t
,
624 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][1]),
626 i386_cpu_info_nonzero
, "I",
627 "Number of large page data TLBs (2nd level)");
629 SYSCTL_PROC(_machdep_cpu_tlb
, OID_AUTO
, shared
,
630 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
631 (void *)offsetof(i386_cpu_info_t
, cpuid_stlb
),
633 i386_cpu_info_nonzero
, "I",
634 "Number of shared TLBs");
637 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, address_bits
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
640 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, physical
,
641 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
642 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_physical
),
644 i386_cpu_info
, "I", "Number of physical address bits");
646 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, virtual,
647 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
648 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_virtual
),
650 i386_cpu_info
, "I", "Number of virtual address bits");
653 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, core_count
,
654 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
655 (void *)offsetof(i386_cpu_info_t
, core_count
),
657 i386_cpu_info
, "I", "Number of enabled cores per package");
659 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, thread_count
,
660 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
661 (void *)offsetof(i386_cpu_info_t
, thread_count
),
663 i386_cpu_info
, "I", "Number of enabled threads per package");
665 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, flex_ratio
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
668 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, desired
,
669 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
671 cpu_flex_ratio_desired
, "I", "Flex ratio desired (0 disabled)");
673 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, min
,
674 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
676 cpu_flex_ratio_min
, "I", "Flex ratio min (efficiency)");
678 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, max
,
679 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
681 cpu_flex_ratio_max
, "I", "Flex ratio max (non-turbo)");
683 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, ucupdate
,
684 CTLTYPE_INT
| CTLFLAG_WR
| CTLFLAG_LOCKED
, 0, 0,
685 cpu_ucode_update
, "S", "Microcode update interface");
687 static const uint32_t apic_timer_vector
= (LAPIC_DEFAULT_INTERRUPT_BASE
+ LAPIC_TIMER_INTERRUPT
);
688 static const uint32_t apic_IPI_vector
= (LAPIC_DEFAULT_INTERRUPT_BASE
+ LAPIC_INTERPROCESSOR_INTERRUPT
);
690 SYSCTL_NODE(_machdep
, OID_AUTO
, vectors
, CTLFLAG_RD
| CTLFLAG_LOCKED
, 0,
691 "Interrupt vector assignments");
693 SYSCTL_UINT (_machdep_vectors
, OID_AUTO
, timer
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, (uint32_t *)&apic_timer_vector
, 0, "");
694 SYSCTL_UINT (_machdep_vectors
, OID_AUTO
, IPI
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, (uint32_t *)&apic_IPI_vector
, 0, "");
696 uint64_t pmap_pv_hashlist_walks
;
697 uint64_t pmap_pv_hashlist_cnts
;
698 uint32_t pmap_pv_hashlist_max
;
699 uint32_t pmap_kernel_text_ps
= PAGE_SIZE
;
700 extern uint32_t pv_hashed_kern_low_water_mark
;
702 /*extern struct sysctl_oid_list sysctl__machdep_pmap_children;*/
704 SYSCTL_NODE(_machdep
, OID_AUTO
, pmap
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
707 SYSCTL_QUAD (_machdep_pmap
, OID_AUTO
, hashwalks
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_walks
, "");
708 SYSCTL_QUAD (_machdep_pmap
, OID_AUTO
, hashcnts
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_cnts
, "");
709 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, hashmax
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_max
, 0, "");
710 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, kernel_text_ps
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_kernel_text_ps
, 0, "");
711 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, kern_pv_reserve
, CTLFLAG_RW
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pv_hashed_kern_low_water_mark
, 0, "");
713 SYSCTL_NODE(_machdep
, OID_AUTO
, memmap
, CTLFLAG_RD
|CTLFLAG_LOCKED
, NULL
, "physical memory map");
715 uint64_t firmware_Conventional_bytes
= 0;
716 uint64_t firmware_RuntimeServices_bytes
= 0;
717 uint64_t firmware_ACPIReclaim_bytes
= 0;
718 uint64_t firmware_ACPINVS_bytes
= 0;
719 uint64_t firmware_PalCode_bytes
= 0;
720 uint64_t firmware_Reserved_bytes
= 0;
721 uint64_t firmware_Unusable_bytes
= 0;
722 uint64_t firmware_other_bytes
= 0;
724 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Conventional
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Conventional_bytes
, "");
725 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, RuntimeServices
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_RuntimeServices_bytes
, "");
726 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPIReclaim
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_ACPIReclaim_bytes
, "");
727 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPINVS
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_ACPINVS_bytes
, "");
728 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, PalCode
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_PalCode_bytes
, "");
729 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Reserved
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Reserved_bytes
, "");
730 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Unusable
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Unusable_bytes
, "");
731 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Other
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_other_bytes
, "");
733 SYSCTL_NODE(_machdep
, OID_AUTO
, tsc
, CTLFLAG_RD
|CTLFLAG_LOCKED
, NULL
, "Timestamp counter parameters");
735 SYSCTL_QUAD(_machdep_tsc
, OID_AUTO
, frequency
,
736 CTLFLAG_RD
|CTLFLAG_LOCKED
, &tscFreq
, "");
738 extern uint32_t deep_idle_rebase
;
739 SYSCTL_UINT(_machdep_tsc
, OID_AUTO
, deep_idle_rebase
,
740 CTLFLAG_RW
|CTLFLAG_KERN
|CTLFLAG_LOCKED
, &deep_idle_rebase
, 0, "");
742 SYSCTL_NODE(_machdep_tsc
, OID_AUTO
, nanotime
,
743 CTLFLAG_RD
|CTLFLAG_LOCKED
, NULL
, "TSC to ns conversion");
744 SYSCTL_QUAD(_machdep_tsc_nanotime
, OID_AUTO
, tsc_base
,
745 CTLFLAG_RD
| CTLFLAG_LOCKED
,
746 (uint64_t *) &pal_rtc_nanotime_info
.tsc_base
, "");
747 SYSCTL_QUAD(_machdep_tsc_nanotime
, OID_AUTO
, ns_base
,
748 CTLFLAG_RD
| CTLFLAG_LOCKED
,
749 (uint64_t *)&pal_rtc_nanotime_info
.ns_base
, "");
750 SYSCTL_UINT(_machdep_tsc_nanotime
, OID_AUTO
, scale
,
751 CTLFLAG_RD
| CTLFLAG_LOCKED
,
752 (uint32_t *)&pal_rtc_nanotime_info
.scale
, 0, "");
753 SYSCTL_UINT(_machdep_tsc_nanotime
, OID_AUTO
, shift
,
754 CTLFLAG_RD
| CTLFLAG_LOCKED
,
755 (uint32_t *)&pal_rtc_nanotime_info
.shift
, 0, "");
756 SYSCTL_UINT(_machdep_tsc_nanotime
, OID_AUTO
, generation
,
757 CTLFLAG_RD
| CTLFLAG_LOCKED
,
758 (uint32_t *)&pal_rtc_nanotime_info
.generation
, 0, "");
760 SYSCTL_NODE(_machdep
, OID_AUTO
, misc
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
761 "Miscellaneous x86 kernel parameters");
763 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, panic_restart_timeout
,
764 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
766 panic_set_restart_timeout
, "I", "Panic restart timeout in seconds");
768 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, interrupt_latency_max
,
769 CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
771 misc_interrupt_latency_max
, "A", "Maximum Interrupt latency");
773 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, machine_check_panic
,
774 CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
776 misc_machine_check_panic
, "A", "Machine-check exception test");
780 extern void timer_queue_trace_cpu(int);
782 misc_timer_queue_trace(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
784 int changed
= 0, error
;
788 error
= sysctl_io_string(req
, buf
, sizeof(buf
), 0, &changed
);
790 if (error
== 0 && changed
) {
791 timer_queue_trace_cpu(0);
796 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, timer_queue_trace
,
797 CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
799 misc_timer_queue_trace
, "A", "Cut timer queue tracepoint");
801 extern long NMI_count
;
802 extern void NMI_cpus(void);
804 misc_nmis(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
806 int new = 0, old
= 0, changed
= 0, error
;
810 error
= sysctl_io_number(req
, old
, sizeof(int), &new, &changed
);
811 if (error
== 0 && changed
) {
818 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, nmis
,
819 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
821 misc_nmis
, "I", "Report/increment NMI count");
823 /* Parameters related to timer coalescing tuning, to be replaced
824 * with a dedicated systemcall in the future.
826 /* Enable processing pending timers in the context of any other interrupt */
827 SYSCTL_INT(_kern
, OID_AUTO
, interrupt_timer_coalescing_enabled
,
828 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
829 &interrupt_timer_coalescing_enabled
, 0, "");
830 /* Upon entering idle, process pending timers with HW deadlines
831 * this far in the future.
833 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_idle_entry_hard_deadline_max
,
834 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
835 &idle_entry_timer_processing_hdeadline_threshold
, 0, "");
836 /* Coalescing tuning parameters for various thread/task attributes */
837 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_bg_scale
,
838 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
839 &tcoal_prio_params
.timer_coalesce_bg_shift
, 0, "");
841 SYSCTL_QUAD(_kern
, OID_AUTO
, timer_coalesce_bg_ns_max
,
842 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
843 &tcoal_prio_params
.timer_coalesce_bg_ns_max
, "");
845 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_kt_scale
,
846 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
847 &tcoal_prio_params
.timer_coalesce_kt_shift
, 0, "");
849 SYSCTL_QUAD(_kern
, OID_AUTO
, timer_coalesce_kt_ns_max
,
850 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
851 &tcoal_prio_params
.timer_coalesce_kt_ns_max
, "");
853 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_fp_scale
,
854 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
855 &tcoal_prio_params
.timer_coalesce_fp_shift
, 0, "");
857 SYSCTL_QUAD(_kern
, OID_AUTO
, timer_coalesce_fp_ns_max
,
858 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
859 &tcoal_prio_params
.timer_coalesce_fp_ns_max
, "");
861 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_ts_scale
,
862 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
863 &tcoal_prio_params
.timer_coalesce_ts_shift
, 0, "");
865 SYSCTL_QUAD(_kern
, OID_AUTO
, timer_coalesce_ts_ns_max
,
866 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
867 &tcoal_prio_params
.timer_coalesce_ts_ns_max
, "");
869 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_tier0_scale
,
870 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
871 &tcoal_prio_params
.latency_qos_scale
[0], 0, "");
873 SYSCTL_QUAD(_kern
, OID_AUTO
, timer_coalesce_tier0_ns_max
,
874 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
875 &tcoal_prio_params
.latency_qos_ns_max
[0], "");
877 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_tier1_scale
,
878 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
879 &tcoal_prio_params
.latency_qos_scale
[1], 0, "");
881 SYSCTL_QUAD(_kern
, OID_AUTO
, timer_coalesce_tier1_ns_max
,
882 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
883 &tcoal_prio_params
.latency_qos_ns_max
[1], "");
885 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_tier2_scale
,
886 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
887 &tcoal_prio_params
.latency_qos_scale
[2], 0, "");
889 SYSCTL_QUAD(_kern
, OID_AUTO
, timer_coalesce_tier2_ns_max
,
890 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
891 &tcoal_prio_params
.latency_qos_ns_max
[2], "");
893 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_tier3_scale
,
894 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
895 &tcoal_prio_params
.latency_qos_scale
[3], 0, "");
897 SYSCTL_QUAD(_kern
, OID_AUTO
, timer_coalesce_tier3_ns_max
,
898 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
899 &tcoal_prio_params
.latency_qos_ns_max
[3], "");
901 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_tier4_scale
,
902 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
903 &tcoal_prio_params
.latency_qos_scale
[4], 0, "");
905 SYSCTL_QUAD(_kern
, OID_AUTO
, timer_coalesce_tier4_ns_max
,
906 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
907 &tcoal_prio_params
.latency_qos_ns_max
[4], "");
909 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_tier5_scale
,
910 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
911 &tcoal_prio_params
.latency_qos_scale
[5], 0, "");
913 SYSCTL_QUAD(_kern
, OID_AUTO
, timer_coalesce_tier5_ns_max
,
914 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
915 &tcoal_prio_params
.latency_qos_ns_max
[5], "");
917 /* Track potentially expensive eager timer evaluations on QoS tier
920 extern uint32_t ml_timer_eager_evaluations
;
922 SYSCTL_INT(_machdep
, OID_AUTO
, eager_timer_evaluations
,
923 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
924 &ml_timer_eager_evaluations
, 0, "");
926 extern uint64_t ml_timer_eager_evaluation_max
;
928 SYSCTL_QUAD(_machdep
, OID_AUTO
, eager_timer_evaluation_max
,
929 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
930 &ml_timer_eager_evaluation_max
, "");
932 /* Communicate the "user idle level" heuristic to the timer layer, and
933 * potentially other layers in the future.
937 timer_set_user_idle_level(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
) {
938 int new_value
= 0, old_value
= 0, changed
= 0, error
;
940 old_value
= ml_timer_get_user_idle_level();
942 error
= sysctl_io_number(req
, old_value
, sizeof(int), &new_value
, &changed
);
944 if (error
== 0 && changed
) {
945 if (ml_timer_set_user_idle_level(new_value
) != KERN_SUCCESS
)
952 SYSCTL_PROC(_machdep
, OID_AUTO
, user_idle_level
,
953 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
955 timer_set_user_idle_level
, "I", "User idle level heuristic, 0-128");