Re: VIA EPIA 5000 and ACPI Cx levels

2010-10-14 Thread b. f.
On 10/10/10, Bruce Cran br...@cran.org.uk wrote:
 On Sunday 10 October 2010 21:49:30 b. f. wrote:

 If it has an i8254, that can also be used in one-shot mode if
 hint.attimer.0.timecounter=0 is used, since r212778.

 Thanks, I didn't know about that. After enabling it things are quite
 different: kern.eventtimer.periodic is now 1, and setting
 hw.acpi.cpu.cx_lowest=C2 results in 100% time being reported as being spent
 in
 C2 mode according to dev.cpu.0.cx_usage - using C3 causes the system to
 hang.
 Shouldn't a fully loaded CPU spent more time in C1 state though? When I run
 a
 program that results in 0% idle time cx_usage still reports that no time was
 spent in C1 state.

I'm not sure what is going on here: if you set
hint.attimer.0.timecounter=0 and kern.eventtimer.timer=i8254 in
/boot/loader.conf, then the system should try to use the i8254 in
one-shot mode, unless you've specifically set periodic mode.  If
kern.eventtimer.periodic=1, then you are _not_ using one-shot mode.
If it was 0 before your latest changes, then you were previously using
one-shot mode.  But, as I wrote earlier, for kern.hz128 and
kern.eventtimer.singlemul=1, periodic mode may result in more sleeping
than one-shot mode, though at a price.  This may be what you are
seeing.

The C-state used is determined in acpi_cpu_idle() in
src/sys/dev/acpica/acpi_cpu.c, if you are using ACPI.  I think that if
the latency for the C2 state is low enough, the number of callouts and
interrupts sufficiently low, and the scheduler quanta large enough,
it's possible for your machine to mostly use C2 rather than C1.  You
can take a look at the algorithm, and make some experiments.  Note
that bus mastering activity, which can include routine USB polling,
may prevent the use of C3.  This or the high latency of C3 may account
for your machine not using it. Also note that you shouldn't use a
LAPIC timer if you are using C3 or deeper sleep states.

b.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: VIA EPIA 5000 and ACPI Cx levels

2010-10-14 Thread Bruce Cran
On Thu, 14 Oct 2010 19:43:36 +
b. f. bf1...@googlemail.com wrote:

 I'm not sure what is going on here: if you set
 hint.attimer.0.timecounter=0 and kern.eventtimer.timer=i8254 in
 /boot/loader.conf, then the system should try to use the i8254 in
 one-shot mode, unless you've specifically set periodic mode.  If
 kern.eventtimer.periodic=1, then you are _not_ using one-shot mode.
 If it was 0 before your latest changes, then you were previously using
 one-shot mode.  But, as I wrote earlier, for kern.hz128 and
 kern.eventtimer.singlemul=1, periodic mode may result in more sleeping
 than one-shot mode, though at a price.  This may be what you are
 seeing.

Sorry, that was a typo: kern.eventtimer.periodic=0 after setting
hint.attimer.0.timecounter=0. I'm seeing 145 interrupts per second now,
so setting hz=100 and using singlemul mode would further
decrease it - but I guess it's not something you would want to do on a
router or desktop.

 This or the high latency of C3 may account
 for your machine not using it. Also note that you shouldn't use a
 LAPIC timer if you are using C3 or deeper sleep states.

Thanks. It sounds like things are working as they should then. Good to
know the new timer code is working properly on this more unusual
hardware!

-- 
Bruce Cran
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


VIA EPIA 5000 and ACPI Cx levels

2010-10-10 Thread Bruce Cran
I recently upgraded to HEAD on my VIA EPIA C3 box, and had thought about 
trying out the new one-shot timer mode. Reading mav@'s email it seems that 
since it doesn't have LAPIC or HPET timers it won't work. However I thought I 
should still get power savings by using higher Cx levels, but setting 
hw.acpi.cpu.cx_lowest to C3 I'm only seeing 0.8% time spent in C2 mode, the 
rest being in C1. The CPU's idle so I don't understand why it's not going into 
deeper sleep modes. Is this likely to just be an ACPI bug?

-- 
Bruce Cran
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: VIA EPIA 5000 and ACPI Cx levels

2010-10-10 Thread b. f.
I recently upgraded to HEAD on my VIA EPIA C3 box, and had thought about
trying out the new one-shot timer mode. Reading mav@'s email it seems that
since it doesn't have LAPIC or HPET timers it won't work. However I thought I
should still get power savings by using higher Cx levels, but setting
hw.acpi.cpu.cx_lowest to C3 I'm only seeing 0.8% time spent in C2 mode, the
rest being in C1. The CPU's idle so I don't understand why it's not going into
deeper sleep modes. Is this likely to just be an ACPI bug?

If it has an i8254, that can also be used in one-shot mode if
hint.attimer.0.timecounter=0 is used, since r212778.  But for low
values of kern.hz, I've found that periodic mode can result in fewer
interrupts (albeit increased latencies and lower accuracy in
accounting) than one-shot mode, if kern.eventtimer.singlemul=1.  As
for the power-saving states, are you using a simple 'sysctl
dev.cpu.0.cx_usage' to find the percentages?  If you're doing
something more involved, you may be affecting the measurements.  Also,
does the system think that the deeper sleep states are available on
your machine?  If so, what are their latencies?  If they are high,
they may be used less often, or not at all.  Did you follow some of
the other recommendations to allow more sleeping, like at:

http://wiki.freebsd.org/TuningPowerConsumption

? Or apply mav's extra patch to further reduce interrupts:

http://people.freebsd.org/~mav/tm6292_idle.patch

?

b.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: VIA EPIA 5000 and ACPI Cx levels

2010-10-10 Thread Bruce Cran
On Sunday 10 October 2010 21:49:30 b. f. wrote:

 If it has an i8254, that can also be used in one-shot mode if
 hint.attimer.0.timecounter=0 is used, since r212778.  

Thanks, I didn't know about that. After enabling it things are quite 
different: kern.eventtimer.periodic is now 1, and setting 
hw.acpi.cpu.cx_lowest=C2 results in 100% time being reported as being spent in 
C2 mode according to dev.cpu.0.cx_usage - using C3 causes the system to hang.  
Shouldn't a fully loaded CPU spent more time in C1 state though? When I run a 
program that results in 0% idle time cx_usage still reports that no time was 
spent in C1 state.

 But for low
 values of kern.hz, I've found that periodic mode can result in fewer
 interrupts (albeit increased latencies and lower accuracy in
 accounting) than one-shot mode, if kern.eventtimer.singlemul=1.  As
 for the power-saving states, are you using a simple 'sysctl
 dev.cpu.0.cx_usage' to find the percentages? If you're doing
 something more involved, you may be affecting the measurements.  Also,
 does the system think that the deeper sleep states are available on
 your machine?  If so, what are their latencies?  If they are high,
 they may be used less often, or not at all.  

I'm just using dev.cpu.0.cx_usage to check the Cx level usage. According to 
dev.cpu.0.cx_supported, I have:

C1/0, C2/90, C3/900


 Did you follow some of
 the other recommendations to allow more sleeping, like at:
 
 http://wiki.freebsd.org/TuningPowerConsumption

I haven't done anything extra yet, since I was mainly interested in seeing if 
one-shot mode worked on this box.  I can't use powerd because running at 
266MHz (I only have 533 and 266 available) results in too much of a slowdown.

-- 
Bruce Cran
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org