rpms/cpuspeed/F-10 cpuspeed.init,1.41,1.42 cpuspeed.spec,1.72,1.73

Jarod Wilson jwilson at fedoraproject.org
Tue Sep 29 15:21:35 UTC 2009


Author: jwilson

Update of /cvs/pkgs/rpms/cpuspeed/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv31655

Modified Files:
	cpuspeed.init cpuspeed.spec 
Log Message:
* Tue Aug 04 2009 Adam Jackson <ajax at redhat.com> 1.5-12
- Move buildroot dir creation to %install

* Fri Jun 26 2009 Jarod Wilson <jarod at redhat.com> 1.5-10
- Fix #505837 for real this time, even tested on an actual
  p4-clockmod system, seems to DTRT



Index: cpuspeed.init
===================================================================
RCS file: /cvs/pkgs/rpms/cpuspeed/F-10/cpuspeed.init,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -p -r1.41 -r1.42
--- cpuspeed.init	3 Nov 2008 20:34:41 -0000	1.41
+++ cpuspeed.init	29 Sep 2009 15:21:34 -0000	1.42
@@ -1,9 +1,26 @@
 #!/bin/sh
-# Startup script for cpuspeed
+
+# the following is the LSB init header see
+# http://www.linux-foundation.org/spec//booksets/LSB-Core-generic/LSB-Core-generic.html#INITSCRCOMCONV
+#
+### BEGIN INIT INFO
+# Provides: cpuspeed
+# Should-Start: 
+# Default-Start: 1 2 3 4 5
+# Short-Description: processor frequency scaling support
+# Description: This script enables/disables processor frequency
+#              scaling support, either using the cpuspeed daemon
+#              or in-kernel frequency scaling support
+### END INIT INFO
+
+# the following is the chkconfig init header
+#
+# cpuspeed: processor frequency scaling support
 #
 # chkconfig: 12345 06 99
 # description: Run dynamic CPU speed daemon and/or load appropriate
 #              cpu frequency scaling kernel modules and/or governors
+#
 
 # Source function library.
 . /etc/rc.d/init.d/functions
@@ -37,10 +54,17 @@ some_file_exist() {
 governor_is_module() {
   # Check to see if the requested cpufreq governor
   # is provided as a kernel module or not
-  module_info=`/sbin/modinfo cpufreq-${governor}`
+  module_info=`/sbin/modinfo cpufreq-${governor} > /dev/null 2>&1`
   return $?
 }
 
+is_p4_clockmod() {
+  if [ `/sbin/lsmod | grep -c -w "p4.clockmod"` -ge 1 -a -d "/sys/devices/system/cpu/cpu0/thermal_throttle" ]; then
+    return 0
+  fi
+  return 1
+}
+
 governor_module_loaded() {
 # Check to see if we have a module loaded for
 # the current cpufreq governor
@@ -81,7 +105,7 @@ start_cpuspeed() {
   else
     DOWN_THRESHOLD=80
   fi
-  OPTS="$OPTS -p $UP_THRESHOLD $DOWN_THRESHOLD"
+  OPTS="$OPTS -r -p $UP_THRESHOLD $DOWN_THRESHOLD"
   if [ -n "$MIN_SPEED" ]; then
     OPTS="$OPTS -m $MIN_SPEED"
   fi
@@ -110,6 +134,11 @@ stop_cpuspeed() {
 }
 
 start() {
+  if [ $(id -u) -ne 0 ]; then
+    echo -n "Insufficient privileges to start cpuspeed service: "
+    failure; echo
+    return 4
+  fi
   if [ ! -f $lockfile ] && [ ! -d "$xendir" ]; then
     cpu_vendor=$(awk '/vendor_id/{print $3}' /proc/cpuinfo | tail -n 1)
     cpu_family=$(awk '/cpu family/{print $4}' /proc/cpuinfo | tail -n 1)
@@ -154,7 +183,9 @@ start() {
         default_governor=ondemand
         ;;
       p4-clockmod)
-        default_governor=none
+        # not actually a governor, we want to bail without doing either
+	# in-kernel scaling or starting up the cpuspeed daemon in this case
+        default_governor=p4passive
         ;;
       *)
         default_governor=userspace
@@ -162,6 +193,12 @@ start() {
     esac
     governor=${GOVERNOR:-${default_governor}}
 
+    if [ "${governor}" == "p4passive" ]; then
+      echo -n "Enabling p4-clockmod driver (passive cooling only): "
+      success; echo
+      return 0
+    fi
+
     # Load governor module, if need be, and validate
     governor_is_module && /sbin/modprobe cpufreq-${governor}
     if [ `grep -c -w ${governor} ${cpu0freqd}/scaling_available_governors` -ge 1 ]; then
@@ -180,10 +217,6 @@ start() {
     if [ "${governor}" == "userspace" ]; then
       start_cpuspeed
       RETVAL=$?
-    elif [ "${drv}" == "p4-clockmod" -a "${governor}" == "none" ]; then
-      echo -n "Enabling p4-clockmod driver (passive cooling only): "
-      success
-      RETVAL=0
     else
       if [ -n "$MIN_SPEED" ]; then
         adjust_cpufreq scaling_min_freq $MIN_SPEED
@@ -219,6 +252,16 @@ start() {
 }
 
 stop() {
+  if [ $(id -u) -ne 0 ]; then
+    echo -n "Insufficient privileges to stop cpuspeed service: "
+    failure; echo
+    return 4
+  fi
+  is_p4_clockmod && p4status="true"
+  if [ "$p4status" == "true" -a "x${GOVERNOR}" == "x" ]; then
+    echo "p4-clockmod passive cooling support cannot be stopped"
+    return 0
+  fi
   [ ! -f ${cpu0freqd}/scaling_driver ] && return 0
   drv=`cat ${cpu0freqd}/scaling_driver`
   governor_module_loaded && module_loaded=true
@@ -256,22 +299,30 @@ case "$1" in
     ;;
 
   status)
+    is_p4_clockmod && p4status="true"
+    if [ "$p4status" == "true" -a "x${GOVERNOR}" == "x" ]; then
+      echo "p4-clockmod passive cooling is enabled"
+      exit 0
+    fi
     governor_module_loaded && module_loaded=true
     if [ -d "$xendir" ]; then
       echo "Frequency scaling not supported under xen kernels"
+      RETVAL=0
     elif [ $module_loaded == true -o ${governor} == "performance" ]; then
       echo "Frequency scaling enabled using ${governor} governor"
+      RETVAL=0
     else
       status $prog
+      RETVAL="$?"
     fi
     ;;
 
-  restart)
+  restart|reload|force-reload)
     stop
     start
     ;;
 
-  condrestart)
+  condrestart|try-restart)
     governor_module_loaded && module_loaded=true
     if [ $module_loaded == true -o -n "`pidof $prog`" -o ${governor} == "performance" ]; then
       stop
@@ -281,7 +332,7 @@ case "$1" in
 
   *)
     echo $"Usage: $0 {start|stop|restart|condrestart|status}"
-    exit 3
+    exit 2
     ;;
 esac
 


Index: cpuspeed.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cpuspeed/F-10/cpuspeed.spec,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -p -r1.72 -r1.73
--- cpuspeed.spec	3 Nov 2008 20:34:41 -0000	1.72
+++ cpuspeed.spec	29 Sep 2009 15:21:35 -0000	1.73
@@ -1,7 +1,7 @@
 Summary:        CPU frequency adjusting daemon
 Name:           cpuspeed
 Version:        1.5
-Release:        2%{?dist}
+Release:        12%{?dist}
 Epoch:          1
 Group:          System Environment/Base
 License:        GPLv2+
@@ -17,7 +17,7 @@ Requires(preun): /sbin/chkconfig
 Requires(preun): /sbin/service
 
 BuildRequires:  automake util-linux groff gettext
-ExclusiveArch:	i386 x86_64 ppc ppc64 ia64 sparcv9 sparc64
+ExclusiveArch:	%{ix86} x86_64 ppc ppc64 ia64 sparcv9 sparc64
 Obsoletes:	kernel-utils
 
 Patch1:         cpuspeed-1.5-Makefile.patch
@@ -42,15 +42,15 @@ cp %{SOURCE1} .
 %build
 rm -rf $RPM_BUILD_ROOT
 
+RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e 's/-fexceptions/-fno-exceptions/g')
+make CFLAGS="$RPM_OPT_FLAGS -fpie -pie" LDFLAGS="-Wl,-z,relro,-z,now"
+
+%install
 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
 mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8/
 
-RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e 's/-fexceptions/-fno-exceptions/g')
-make CFLAGS="$RPM_OPT_FLAGS -fpie -pie" LDFLAGS="-Wl,-z,relro,-z,now"
-
-%install
 make DESTDIR=$RPM_BUILD_ROOT install
 install -m755 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/cpuspeed
 install -m644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/cpuspeed
@@ -81,6 +81,42 @@ fi
 exit 0
 
 %changelog
+* Tue Aug 04 2009 Adam Jackson <ajax at redhat.com> 1.5-12
+- Move buildroot dir creation to %%install
+
+* Fri Jul 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:1.5-11
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Fri Jun 26 2009 Jarod Wilson <jarod at redhat.com> 1.5-10
+- Fix #505837 for real this time, even tested on an actual
+  p4-clockmod system, seems to DTRT
+
+* Mon Jun 22 2009 Jarod Wilson <jarod at redhat.com> 1.5-9
+- Un-pooch fix for #505837 (caused #507216 and didn't work right
+  to begin with...)
+
+* Wed Jun 17 2009 Jarod Wilson <jarod at redhat.com> 1.5-8
+- Let p4-clockmod users override defaults and set a governor,
+  even if its generally a Bad Idea... (#505837)
+
+* Wed Jun 10 2009 Jarod Wilson <jarod at redhat.com> 1.5-7
+- Fix up lsb compliance a bit (#246895)
+- Correct a few more exit codes (rhel5 bz, #495049)
+
+* Tue Mar 17 2009 Jarod Wilson <jarod at redhat.com> 1.5-6
+- Fix up prior fix-up so that status and stop actually do the right thing
+  on NON-p4-clockmod systems
+
+* Fri Mar 06 2009 Jarod Wilson <jarod at redhat.com> 1.5-5
+- Fix up p4-clockmod support so start/stop/status actually report
+  something sane to the user
+
+* Mon Mar 02 2009 Jarod Wilson <jarod at redhat.com> 1.5-4
+- Fix up ExclusiveArch, now that 32-bit x86 is built i586 for F11
+
+* Tue Feb 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:1.5-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
+
 * Mon Nov 03 2008 Jarod Wilson <jarod at redhat.com> 1.5-2
 - Revive p4-clockmod support, for passive cooling only, when
   all else fails on Intel boxes




More information about the fedora-extras-commits mailing list