MCPcopy Create free account
hub / github.com/F-Stack/f-stack / intel_hwp_dump_sysctl_handler

Function intel_hwp_dump_sysctl_handler

freebsd/x86/cpufreq/hwpstate_intel.c:120–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118 "Set 1 (default) to enable package-level control, 0 to disable");
119
120static int
121intel_hwp_dump_sysctl_handler(SYSCTL_HANDLER_ARGS)
122{
123 device_t dev;
124 struct pcpu *pc;
125 struct sbuf *sb;
126 struct hwp_softc *sc;
127 uint64_t data, data2;
128 int ret;
129
130 sc = (struct hwp_softc *)arg1;
131 dev = sc->dev;
132
133 pc = cpu_get_pcpu(dev);
134 if (pc == NULL)
135 return (ENXIO);
136
137 sb = sbuf_new(NULL, NULL, 1024, SBUF_FIXEDLEN | SBUF_INCLUDENUL);
138 sbuf_putc(sb, '\n');
139 thread_lock(curthread);
140 sched_bind(curthread, pc->pc_cpuid);
141 thread_unlock(curthread);
142
143 rdmsr_safe(MSR_IA32_PM_ENABLE, &data);
144 sbuf_printf(sb, "CPU%d: HWP %sabled\n", pc->pc_cpuid,
145 ((data & 1) ? "En" : "Dis"));
146
147 if (data == 0) {
148 ret = 0;
149 goto out;
150 }
151
152 rdmsr_safe(MSR_IA32_HWP_CAPABILITIES, &data);
153 sbuf_printf(sb, "\tHighest Performance: %03ju\n", data & 0xff);
154 sbuf_printf(sb, "\tGuaranteed Performance: %03ju\n", (data >> 8) & 0xff);
155 sbuf_printf(sb, "\tEfficient Performance: %03ju\n", (data >> 16) & 0xff);
156 sbuf_printf(sb, "\tLowest Performance: %03ju\n", (data >> 24) & 0xff);
157
158 rdmsr_safe(MSR_IA32_HWP_REQUEST, &data);
159 data2 = 0;
160 if (sc->hwp_pkg_ctrl && (data & IA32_HWP_REQUEST_PACKAGE_CONTROL))
161 rdmsr_safe(MSR_IA32_HWP_REQUEST_PKG, &data2);
162
163 sbuf_putc(sb, '\n');
164
165#define pkg_print(x, name, offset) do { \
166 if (!sc->hwp_pkg_ctrl || (data & x) != 0) \
167 sbuf_printf(sb, "\t%s: %03u\n", name, \
168 (unsigned)(data >> offset) & 0xff); \
169 else \
170 sbuf_printf(sb, "\t%s: %03u\n", name, \
171 (unsigned)(data2 >> offset) & 0xff); \
172} while (0)
173
174 pkg_print(IA32_HWP_REQUEST_EPP_VALID,
175 "Requested Efficiency Performance Preference", 24);
176 pkg_print(IA32_HWP_REQUEST_DESIRED_VALID,
177 "Requested Desired Performance", 16);

Callers

nothing calls this directly

Calls 10

cpu_get_pcpuFunction · 0.85
sbuf_newFunction · 0.85
sbuf_putcFunction · 0.85
sbuf_printfFunction · 0.85
sbuf_finishFunction · 0.85
sbuf_dataFunction · 0.85
sbuf_lenFunction · 0.85
sbuf_deleteFunction · 0.85
sched_bindFunction · 0.50
sched_unbindFunction · 0.50

Tested by

no test coverage detected