From owner-svn-src-stable-8@FreeBSD.ORG Fri Nov 26 17:31:03 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46CBD1065673; Fri, 26 Nov 2010 17:31:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31AB58FC17; Fri, 26 Nov 2010 17:31:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAQHV3r1061112; Fri, 26 Nov 2010 17:31:03 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAQHV37K061110; Fri, 26 Nov 2010 17:31:03 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201011261731.oAQHV37K061110@svn.freebsd.org> From: Andriy Gapon Date: Fri, 26 Nov 2010 17:31:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215876 - stable/8/sys/x86/cpufreq X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 17:31:03 -0000 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); }