--- hwpstate.c.orig 2017-08-19 16:58:51.997734000 +0900 +++ hwpstate.c 2017-08-19 17:29:43.363170000 +0900 @@ -156,7 +156,6 @@ static int hwpstate_goto_pstate(device_t dev, int pstate) { - int i; uint64_t msr; int j; int limit; @@ -169,26 +168,11 @@ if(limit > id) id = limit; - /* - * We are going to the same Px-state on all cpus. - * Probably should take _PSD into account. - */ error = 0; - CPU_FOREACH(i) { - /* Bind to each cpu. */ - thread_lock(curthread); - sched_bind(curthread, i); - thread_unlock(curthread); HWPSTATE_DEBUG(dev, "setting P%d-state on cpu%d\n", id, PCPU_GET(cpuid)); /* Go To Px-state */ wrmsr(MSR_AMD_10H_11H_CONTROL, id); - } - CPU_FOREACH(i) { - /* Bind to each cpu. */ - thread_lock(curthread); - sched_bind(curthread, i); - thread_unlock(curthread); /* wait loop (100*100 usec is enough ?) */ for(j = 0; j < 100; j++){ /* get the result. not assure msr=id */ @@ -204,10 +188,6 @@ HWPSTATE_DEBUG(dev, "error: loop is not enough.\n"); error = ENXIO; } - } - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); return (error); } @@ -323,13 +303,6 @@ uint64_t msr; int error, type; - /* - * Only hwpstate0. - * It goes well with acpi_throttle. - */ - if (device_get_unit(dev) != 0) - return (ENXIO); - sc = device_get_softc(dev); sc->dev = dev;