Page MenuHomeFreeBSD

hwpstate_amd: Use ipi instead of sched_bind + thread_lock
AcceptedPublic

Authored by aokblast on Sun, Jan 4, 3:18 PM.
Tags
None
Referenced Files
F141906848: D54505.diff
Mon, Jan 12, 8:21 AM
F141894920: D54505.id169079.diff
Mon, Jan 12, 3:32 AM
F141882062: D54505.diff
Sun, Jan 11, 11:01 PM
Unknown Object (File)
Sat, Jan 10, 4:02 PM
Unknown Object (File)
Sat, Jan 10, 8:09 AM
Unknown Object (File)
Sat, Jan 10, 5:33 AM
Unknown Object (File)
Sat, Jan 10, 5:14 AM
Unknown Object (File)
Fri, Jan 9, 6:55 PM
Subscribers

Details

Reviewers
olce
khng
markj

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 69780
Build 66663: arc lint + arc unit

Event Timeline

sys/x86/cpufreq/hwpstate_amd.c
226

Simpler:

req->res = rdmsr_safe(MSR_AMD_CPPC_ENABLE, &req->enable);
if (req->res == 0)
    req->res = rdmsr_safe(MSR_AMD_CPPC_CAPS_1, &req->caps);
if (req->res == 0)
    req->res = rdmsr_safe(MSR_AMD_CPPC_REQUEST, &req->req);

Just a suggestion, feel free to ignore.

228

Call it req for consistency with other places?

241–245

Just a thought: it might be nice to have an smp_rendezvous_cpu() variant which takes a CPU ID instead of a cpuset.

293–294

This should be done in the caller, not in the callback.

Keep in mind that smp rendezvous callbacks are invoked with interrupts disabled, so they should do as little work as possible. Calling device_printf() is ok, but other operations should be avoided if possible.

Simplify dump_sysctl_cb
Add helper functions for single cpu

sys/x86/cpufreq/hwpstate_amd.c
228

SYSCTL_HANDLER_ARGS have already used req as variable name.

241–245

I am also thinking about making some inline function like rdmsr_on_cpu and wrmsr_on_cpu which prevent us from writing callback each time when we just want to read and write a single MSR value at a time.

sys/kern/subr_smp.c
633 ↗(On Diff #169077)

Indentation looks wrong here.

This should really be added in a separate patch.

sys/x86/cpufreq/hwpstate_amd.c
241–245

I just remembered that it already exists: x86_msr_op().

sys/kern/subr_smp.c
633 ↗(On Diff #169077)

This has been in a seperate commit. I will make another differnetial tomorrow.

sys/x86/cpufreq/hwpstate_amd.c
215–218

Inverted tests here.

Looks ok with the comments addressed.

sys/kern/subr_smp.c
627 ↗(On Diff #169079)

Extra newline

sys/sys/smp.h
290 ↗(On Diff #169079)

Extra newline

sys/x86/cpufreq/hwpstate_amd.c
219

The return statement can be removed too.

Please see inline comments for remaining problems.

sys/x86/cpufreq/hwpstate_amd.c
243–246

Need to initialize ret even in case of success (see also suggested change after out label).

249–252

Simplification after early init of ret above.

280–281

Bug: ret set before jumps to out is crushed.

olce requested changes to this revision.Tue, Jan 6, 9:16 AM
This revision now requires changes to proceed.Tue, Jan 6, 9:16 AM
This revision is now accepted and ready to land.Sat, Jan 10, 8:38 AM