Date: Fri, 26 Nov 2010 17:31:03 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r215876 - stable/8/sys/x86/cpufreq Message-ID: <201011261731.oAQHV37K061110@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Fri Nov 26 17:31:02 2010 New Revision: 215876 URL: http://svn.freebsd.org/changeset/base/215876 Log: MFC r215398: hwpstate: use CPU_FOREACH when binding to all available processors Modified: stable/8/sys/x86/cpufreq/hwpstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/x86/cpufreq/hwpstate.c ============================================================================== --- stable/8/sys/x86/cpufreq/hwpstate.c Fri Nov 26 17:14:38 2010 (r215875) +++ stable/8/sys/x86/cpufreq/hwpstate.c Fri Nov 26 17:31:02 2010 (r215876) @@ -157,7 +157,6 @@ DRIVER_MODULE(hwpstate, cpu, hwpstate_dr static int hwpstate_goto_pstate(device_t dev, int pstate) { - struct pcpu *pc; int i; uint64_t msr; int j; @@ -171,18 +170,15 @@ hwpstate_goto_pstate(device_t dev, int p if(limit > id) id = limit; - error = 0; /* * We are going to the same Px-state on all cpus. + * Probably should take _PSD into account. */ - for (i = 0; i < mp_ncpus; i++) { - /* Find each cpu. */ - pc = pcpu_find(i); - if (pc == NULL) - return (ENXIO); - thread_lock(curthread); + error = 0; + CPU_FOREACH(i) { /* Bind to each cpu. */ - sched_bind(curthread, pc->pc_cpuid); + 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)); @@ -204,10 +200,10 @@ hwpstate_goto_pstate(device_t dev, int p HWPSTATE_DEBUG(dev, "error: loop is not enough.\n"); error = ENXIO; } - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); } + thread_lock(curthread); + sched_unbind(curthread); + thread_unlock(curthread); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011261731.oAQHV37K061110>