Re: sysctl(3): HW_PERFPOLICY

2015-03-12 Thread Jason McIntyre
On Thu, Mar 12, 2015 at 08:42:31AM +0100, Theo Buehler wrote:
 I am confused by the new documentation of HW_PERFPOLICY.  Is this bound
 to change?  Looking at the function sysctl_hwperfpolicy() in
 sys/kern/sched_bsd.c, I think the following is more accurate, although I
 don't know what has to go wrong that the string is actually set to
 `unknown'.
 
 For consistency with the rest of the manual page, I used .Dq instead
 of .Qq.
 
 $ apm -L
 $ sysctl hw.perfpolicy
 hw.perfpolicy=manual
 $ apm -A
 $ sysctl hw.perfpolicy
 hw.perfpolicy=auto
 $ apm -H
 $ sysctl hw.perfpolicy
 hw.perfpolicy=high
 
 

i couldn;t actually work out how to extract the possible values, so i
asked tedu. in his defense, he didn;t say my diff was correct - only
that it was good enough. perhaps his own perfpolicy was set to high ;)

i think the unknown will be a catchall for errors, and we shouldn;t
suggest to users that they can set it.

so my suggestion is below. i'll commit later if no one has yelled too
much.

jmc

Index: sysctl.3
===
RCS file: /cvs/src/lib/libc/gen/sysctl.3,v
retrieving revision 1.248
diff -u -r1.248 sysctl.3
--- sysctl.311 Mar 2015 19:42:38 -  1.248
+++ sysctl.312 Mar 2015 08:20:10 -
@@ -332,9 +332,10 @@
 .It Dv HW_PERFPOLICY
 The performance policy for power management.
 Can be one of
-.Qq manual
+.Dq manual ,
+.Dq automatic ,
 or
-.Qq automatic .
+.Dq high .
 .It Dv HW_PHYSMEM
 The total physical memory, in bytes.
 This variable is deprecated; use
@@ -377,6 +378,10 @@
 .It Dv HW_SETPERF
 Current CPU performance
 .Pq percentage .
+It is only modifiable if
+.Dv HW_PERFPOLICY
+is set to
+.Dq manual .
 .It Dv HW_USERMEM
 The amount of available non-kernel memory in bytes.
 This variable is deprecated; use



sysctl(3): HW_PERFPOLICY

2015-03-12 Thread Theo Buehler
I am confused by the new documentation of HW_PERFPOLICY.  Is this bound
to change?  Looking at the function sysctl_hwperfpolicy() in
sys/kern/sched_bsd.c, I think the following is more accurate, although I
don't know what has to go wrong that the string is actually set to
`unknown'.

For consistency with the rest of the manual page, I used .Dq instead
of .Qq.

$ apm -L
$ sysctl hw.perfpolicy
hw.perfpolicy=manual
$ apm -A
$ sysctl hw.perfpolicy
hw.perfpolicy=auto
$ apm -H
$ sysctl hw.perfpolicy
hw.perfpolicy=high


Index: lib/libc/gen/sysctl.3
===
RCS file: /cvs/src/lib/libc/gen/sysctl.3,v
retrieving revision 1.248
diff -u -p -r1.248 sysctl.3
--- lib/libc/gen/sysctl.3   11 Mar 2015 19:42:38 -  1.248
+++ lib/libc/gen/sysctl.3   12 Mar 2015 07:32:20 -
@@ -332,9 +332,11 @@ The software page size.
 .It Dv HW_PERFPOLICY
 The performance policy for power management.
 Can be one of
-.Qq manual
+.Dq manual ,
+.Dq auto ,
+.Dq high ,
 or
-.Qq automatic .
+.Dq unknown .
 .It Dv HW_PHYSMEM
 The total physical memory, in bytes.
 This variable is deprecated; use
@@ -377,6 +379,9 @@ The serial number of the machine.
 .It Dv HW_SETPERF
 Current CPU performance
 .Pq percentage .
+Only modifiable if
+.Dv HW_PERFPOLICY is set to
+.Dq manual .
 .It Dv HW_USERMEM
 The amount of available non-kernel memory in bytes.
 This variable is deprecated; use



Re: sysctl(3): HW_PERFPOLICY

2015-03-12 Thread Theo Buehler
On Thu, Mar 12, 2015 at 08:20:30AM +, Jason McIntyre wrote:
 i think the unknown will be a catchall for errors, and we shouldn;t
 suggest to users that they can set it.

This makes sense.  They actually can't set it to unknown.

 so my suggestion is below. i'll commit later if no one has yelled too
 much.

I like your wording of the second part better than mine.  However,
`automatic' really should be a literal `auto'.

$ sudo sysctl hw.perfpolicy=automatic
sysctl: hw.perfpolicy: Invalid argument
$ sudo sysctl hw.perfpolicy=auto
hw.perfpolicy: manual - auto
$



 jmc

 Index: sysctl.3
 ===
 RCS file: /cvs/src/lib/libc/gen/sysctl.3,v
 retrieving revision 1.248
 diff -u -r1.248 sysctl.3
 --- sysctl.3  11 Mar 2015 19:42:38 -  1.248
 +++ sysctl.3  12 Mar 2015 08:20:10 -
 @@ -332,9 +332,10 @@
  .It Dv HW_PERFPOLICY
  The performance policy for power management.
  Can be one of
 -.Qq manual
 +.Dq manual ,
 +.Dq automatic ,
  or
 -.Qq automatic .
 +.Dq high .
  .It Dv HW_PHYSMEM
  The total physical memory, in bytes.
  This variable is deprecated; use
 @@ -377,6 +378,10 @@
  .It Dv HW_SETPERF
  Current CPU performance
  .Pq percentage .
 +It is only modifiable if
 +.Dv HW_PERFPOLICY
 +is set to
 +.Dq manual .
  .It Dv HW_USERMEM
  The amount of available non-kernel memory in bytes.
  This variable is deprecated; use