Hi,
I'm not really sure whom to write to, so ... I'm writing to all of you, for
now ;-)
I just bought a USB wireless stick with an RTL8187B inside. The idea was to
use it with my laptop. In principle, it works just fine ... if it didn't
cause the computer to triple its idle power consumption from some
7.5 to ~ 22.5 Watts.
I don't have a clue (yet) where exactly all that power goes to, and how
much of it is actually being used by the stick itself (it's getting pretty
warm, too - maybe you have a clue what to expect there?). But apparently,
quite a bit of that increased power consumption is due to the CPU entering
ACPI sleep states for a much smaller proportion of time, and not entering
the highest sleep state at all anymore (which otherwise makes up around
98 % of the time) due to some polling/high-frequency interrupt of the
driver. After all, even the most inefficient voltage regulator can't
make 15 W from USB's max. 2.5 W (I hope ...).
Now, the obvious question is: Is there anything one could do about that?
And if not, or possibly even if: Any recommendation for a power-efficient
USB 802.11 adapter - in particular something that does not cause
CPU wakeups all the time when there is no actual network traffic?
Florian
On Sat, Dec 19, 2009 at 10:30 AM, Andrea Merello <[email protected]> wrote:
> Hmm.. Well.. I guess that effectively a USB softmac card on a slow
> computer might produce a noticeable overhead, even if I never tried
> before..
Oh, I have an old machine with a celeron 366Mhz, where I run a zd1211
with the vendor driver as AP.... throughput to a USB disk sharing a
hub something like 430kB/s but can be over 70kB to the the local
non-USB hard disk. (some of the difference in speed is obviously just
data bandwidth contention). There are significant overhead at the USB
level, I think; but in any case, the CPU probably can't sleep because
the USB sub-system is always doing something, if even just for
processing beacons.
On 12/18/2009 12:59 PM, Florian Zumbiehl wrote:
>
> Well, yeah, I meant "payload I care about", of course :-)
>
> For comparison, if I plug in and configure my prism2 card to connect
> to the same AP, power consumption goes up by ~ 2 Watts while idling.
> Given that it seems to be possible to build a wifi interface (plus driver)
> that does manage to stay connected on a budget of ~ 2 Watts, I would hope
> that there is such a thing for USB, too. b-only would be fine, too - it's
> USB 1.1 only, anyhow.
I have no idea what the relative power consumption is for USB and PCI.
Certainly, a PCI card can assume a cleaner power source - the USB is
going to have to do heavier regulation.
One other thing to try is to turn off the LED. Unset
CONFIG_MAC80211_LEDS in your .config. That should save some power.
Hi,
> > I'll play around with AP settings a bit and report back to you.
> > If you can think of any particular useful tests I could do, please
> > let me know, I'll see what I can do.
> >
> > But yeah - even if the device draws more than the allowed 500 mA,
> > I hope very much that it doesn't draw anywhere close to 3 A ... ;-)
>
> On the AP you might set the beacon interval lower. And also, I'm not
> sure if the rtl8187 driver configure the BSSID register so that once
> you are associated to the network the card will filter all packets
> from other APs, but in case it does not you can try to set your AP on
> a channel where no other AP are working, otherwise other APs beacons
> will be reiceved.
I did some tests now, with some interesting results:
time spent in C0 / C2 / C3 [%] --\
additional power consumption relative to (1) [W] --\ |
| |
(1) No USB devices connected ...................: 0.0 ? / ? / 98
(2) USB memory stick, idle .....................: 3.8 2 / 98 / 0
(3) RTL8187, interface down ....................: 3.8 2 / 98 / 0
(4) RTL8187, interface up, 100 ms beacons ......: 15.6 48 / 52 / 0
(5) RTL8187, interface up, 1 s beacons .........: 6.0-15.6 29 / 71 / 0
In test setup (5) the current into the laptop is fluctuating so heavily
that I don't have a clue what the average is. But apparently, it's low
enough to keep the fan off - with 100 ms beacons, the fan turns on
regularly.
The time spent in the different C states was measured with powertop, the
power consumption was measured using a DMM.
So, a base load of 3.8 W seems to be caused by any connected usb device
preventing C3 and some 250 ms polling done by uhci_hcd, plus a bit for
the device itself. According to
http://www.mail-archive.com/[email protected]/msg19354.html
(why aren't there any message IDs on any of those archive sites, BTW?)
that's the expected behaviour.
What I don't quite understand, though, is, why the CPU stays in C0 for
so long when the wifi interface is up. If I let some CPU intensive
application run in parallel, its performance isn't reduced very much
by the RTL8187 being active. Also, top doesn't show anyone to be
consuming those 48 % of the cycles (powertop and top being at the
top with < 1 % ...).
> > I would assume that it's some timers you are using? As I understand it,
> > other interrupts (which cannot really be predicted) don't prevent
> > the power management code from switching the CPU into deep sleep
> > modes?!
>
> Hmm.. I think I know not enough about C3 state rules.
> I think the rtl8187 does not use timers.
> The only difference is that the interrupt is raised by the (PCI) USB
> controller, then it forwards things to the USB layer, then it calls a
> callback on the rtl8187 driver, and then it passes to the mac80211
> layer. So the problem might be not the interrupt itself but the amount
> of work to do..
But that shouldn't need anywhere close to 350 million cycles per second,
should it? ;-)
> > Any suggestions as to how to recognize those? Or even a recommendation
> > for a specific device/chipset?
>
> I know that intel ipw2200 and the older ipw2100 should be fullmac.
But there aren't any USB devices with those, are there?
Anyhow, I guess I'll stay with the cardbus prism card, for the USB
host controller being active already needs twice as much power as
the whole card needs.
Florian
On Sat, Dec 19, 2009 at 6:44 PM, Florian Zumbiehl <[email protected]> wrote:
> So, a base load of 3.8 W seems to be caused by any connected usb device
> preventing C3 and some 250 ms polling done by uhci_hcd, plus a bit for
> the device itself. According to
> http://www.mail-archive.com/[email protected]/msg19354.html
> (why aren't there any message IDs on any of those archive sites, BTW?)
> that's the expected behaviour.
Presumably power-management changes have a time granuarity i.e. if you
make the CPU busy for one moment, it would stay in the higher-power
state for a while before dropping down? That's the standard thing to
do for prevent the power state being changed too often (and have bad
effects of some sort)?
Hi!
First of all I heve to say that I'm not working on those drivers since
years, so my informations are not up to date.
However since the rtl8187 cards are all "softmac" cards I think that
they will always consume a bit of CPU when they are alive.
This means that all the 802.11 protocol is handled by your CPU and
that the rtl8187 dongle passes all packets to the kernel.
So even if no network traffic is running, management packets are still
handled by the kernel.
As someone told before this management traffic is for examples beacons.
Probably your prism2 card was a so called "fullmac" card. That menas
that all this management stuff can be done on the wifi card without
generating load on the host CPU.
One thing I can say is that the ieee 802.11 protocol allows certains
power save functionalities but, provided that mac80211 / rtl8187
driver support it (and I'm really not sure), this will probably only
reduces power consumption on the USB, not on the host processor.
Well, it may be interesting to do a serious analisys about how much
power is drained by the card when it is up and in RX, when the
mac80211 sends probes, and how much is related to the CPU, however,
because you estimated that the power drain increase is too much for
being directly related to the usb stuff, I think is really possible
that the big problem is related to beacons.
Even if potentially the 802.11 protocol can probably work even without
beacons (even it might seems a contraddiction, I think it is true if
you are NOT using powersave functionality), currently I suspect the
mac80211 wants them in order to calculate network quality (missed
beacon rate) and it might even send more probes (TX is other power
burnt out) if it cannot detect beacons.
Even worse, even if one will modify the mac80211 in order to live
without beacons, I think it can't be told to the rtl8187 to filter out
beacons. The HW can filter out all management frames, but not only
beacons.
This means that, IMHO, there is no way to avoid the CPU work on
rtl8187 when you are connected to a network (unless the network AP is
yours and you reduce beacon interval as someone suggested). Maybe you
can force some powersave mode on the CPU, by scaling the cpu clock
frequency, avoiding taht some "ondemand" policy can rise the clock
when the CPU is loaded (I doubt beacons processing is enough to
trigger this), but If you tracked down that interrupts are the causes
of the CPU don't entering C3 state, I _think_ you can't do much..
So far If you are looking for a card that make you save power, I
suggest you to get a fullmac one.
Andrea
On Sat, Dec 19, 2009 at 12:28 AM, Larry Finger
<[email protected]> wrote:
> On 12/18/2009 12:59 PM, Florian Zumbiehl wrote:
>>
>> Well, yeah, I meant "payload I care about", of course :-)
>>
>> For comparison, if I plug in and configure my prism2 card to connect
>> to the same AP, power consumption goes up by ~ 2 Watts while idling.
>> Given that it seems to be possible to build a wifi interface (plus driver)
>> that does manage to stay connected on a budget of ~ 2 Watts, I would hope
>> that there is such a thing for USB, too. b-only would be fine, too - it's
>> USB 1.1 only, anyhow.
>
> I have no idea what the relative power consumption is for USB and PCI.
> Certainly, a PCI card can assume a cleaner power source - the USB is
> going to have to do heavier regulation.
>
> One other thing to try is to turn off the LED. Unset
> CONFIG_MAC80211_LEDS in your .config. That should save some power.
>
Hi,
> > For comparison, if I plug in and configure my prism2 card to connect
> > to the same AP, power consumption goes up by ~ 2 Watts while idling.
> > Given that it seems to be possible to build a wifi interface (plus driver)
> > that does manage to stay connected on a budget of ~ 2 Watts, I would hope
> > that there is such a thing for USB, too. b-only would be fine, too - it's
> > USB 1.1 only, anyhow.
>
> I have no idea what the relative power consumption is for USB and PCI.
> Certainly, a PCI card can assume a cleaner power source - the USB is
> going to have to do heavier regulation.
Yeah - plus, the chip, according to realtek's website, wants 3.3 and
1.something V. If they are using a linear regulator for that - there must
be a reason for that low price, after all ... ;-)
> One other thing to try is to turn off the LED. Unset
> CONFIG_MAC80211_LEDS in your .config. That should save some power.
That's already off ...
Florian
Hi,
> > I don't have a clue (yet) where exactly all that power goes to, and how
> > much of it is actually being used by the stick itself (it's getting pretty
> > warm, too - maybe you have a clue what to expect there?). But apparently,
> > quite a bit of that increased power consumption is due to the CPU entering
> > ACPI sleep states for a much smaller proportion of time, and not entering
> > the highest sleep state at all anymore (which otherwise makes up around
> > 98 % of the time) due to some polling/high-frequency interrupt of the
> > driver. After all, even the most inefficient voltage regulator can't
> > make 15 W from USB's max. 2.5 W (I hope ...).
>
> My RTL8187B does get quite warm. The 'lsusb -v' output says that the
> device can draw up to 500 mA or the maximum 2.5 W, but it does seem
> warmer than that.
That's my impression, too ... but it doesn't feel like 15 Watts,
either :-)
> > Now, the obvious question is: Is there anything one could do about that?
>
> AFAIK, the rtl8187 driver is not running any polling loops. It will
> interrupt the machine whenever it receives something or whenever data
> needs to be transmitted. You could cut the frequency by changing the
> beacon interval to 2 s. It is probably now set at 0.1 s.
Beacons are sent by the AP only, aren't they? I guess I could try
playing with the AP's config. On the other hand, the point of a wifi
interface for my laptop is not primarily to connect to my own
network ...
> > And if not, or possibly even if: Any recommendation for a power-efficient
> > USB 802.11 adapter - in particular something that does not cause
> > CPU wakeups all the time when there is no actual network traffic?
>
> Not all network traffic is data.
Well, yeah, I meant "payload I care about", of course :-)
For comparison, if I plug in and configure my prism2 card to connect
to the same AP, power consumption goes up by ~ 2 Watts while idling.
Given that it seems to be possible to build a wifi interface (plus driver)
that does manage to stay connected on a budget of ~ 2 Watts, I would hope
that there is such a thing for USB, too. b-only would be fine, too - it's
USB 1.1 only, anyhow.
Florian
On 12/18/2009 12:02 PM, Florian Zumbiehl wrote:
> Hi,
>
> I'm not really sure whom to write to, so ... I'm writing to all of you, for
> now ;-)
>
> I just bought a USB wireless stick with an RTL8187B inside. The idea was to
> use it with my laptop. In principle, it works just fine ... if it didn't
> cause the computer to triple its idle power consumption from some
> 7.5 to ~ 22.5 Watts.
>
> I don't have a clue (yet) where exactly all that power goes to, and how
> much of it is actually being used by the stick itself (it's getting pretty
> warm, too - maybe you have a clue what to expect there?). But apparently,
> quite a bit of that increased power consumption is due to the CPU entering
> ACPI sleep states for a much smaller proportion of time, and not entering
> the highest sleep state at all anymore (which otherwise makes up around
> 98 % of the time) due to some polling/high-frequency interrupt of the
> driver. After all, even the most inefficient voltage regulator can't
> make 15 W from USB's max. 2.5 W (I hope ...).
My RTL8187B does get quite warm. The 'lsusb -v' output says that the
device can draw up to 500 mA or the maximum 2.5 W, but it does seem
warmer than that.
> Now, the obvious question is: Is there anything one could do about that?
AFAIK, the rtl8187 driver is not running any polling loops. It will
interrupt the machine whenever it receives something or whenever data
needs to be transmitted. You could cut the frequency by changing the
beacon interval to 2 s. It is probably now set at 0.1 s.
> And if not, or possibly even if: Any recommendation for a power-efficient
> USB 802.11 adapter - in particular something that does not cause
> CPU wakeups all the time when there is no actual network traffic?
Not all network traffic is data.
Larry
> Yeah - plus, the chip, according to realtek's website, wants 3.3 and
> 1.something V. If they are using a linear regulator for that - there must
> be a reason for that low price, after all ... ;-)
Hmm they are using at least one switching DC/DC..
On my rtl8187L there is a relatively big inductor and a big, probably
schottky, diode on the PCB near to two little ICs (well one is
certainly an IC, the other could be even a couple of transistors in a
single package.. I don't know).
On one of two coil pin the 3.3V is present. So it should be the
switching DC/DC for the 3.3.
On one of the two ICS (the little one, that i'm not sure what is it
really) there is present both 3.3V and 1.8V so it could be the
regulator for 1.8V
There are a couple of little inductors or ferrite bead in apparently
0803 or similar package but they looks like they are used as filters
and I can't see any other diode, so the little ic _might_ be a linear
used for 1.8V.
Unfortunately I couldn't find the marking code on the net about it..
it is a sot23-5 marked ajp22
Oh And there is another of those ajp22 on another PCB place...I did
some measurement on it, but I didn't find anything that convinced me
about what is it..
Andrea
Hi,
> > So, a base load of 3.8 W seems to be caused by any connected usb device
> > preventing C3 and some 250 ms polling done by uhci_hcd, plus a bit for
> > the device itself. According to
> > http://www.mail-archive.com/[email protected]/msg19354.html
> > (why aren't there any message IDs on any of those archive sites, BTW?)
> > that's the expected behaviour.
>
> Presumably power-management changes have a time granuarity i.e. if you
> make the CPU busy for one moment, it would stay in the higher-power
> state for a while before dropping down? That's the standard thing to
> do for prevent the power state being changed too often (and have bad
> effects of some sort)?
Well, yeah, but: There are "only" some 1050 wakeups per second going on,
1000 of which are the timer tick, despite NO_HZ. And all of them in total
seem to be using < 1 % of the CPU. Given that
/proc/acpi/processor/CPU0/power lists a latency of 65 ?s for C3, I don't
quite see how that fits together.
Florian
Andrea Merello <[email protected]> writes:
> Even if potentially the 802.11 protocol can probably work even without
> beacons (even it might seems a contraddiction, I think it is true if
> you are NOT using powersave functionality), currently I suspect the
> mac80211 wants them in order to calculate network quality (missed
> beacon rate) and it might even send more probes (TX is other power
> burnt out) if it cannot detect beacons.
mac80211 does support beacon filtering, see IEEE80211_HW_BEACON_FILTER
for more.
> Even worse, even if one will modify the mac80211 in order to live
> without beacons, I think it can't be told to the rtl8187 to filter out
> beacons. The HW can filter out all management frames, but not only
> beacons.
Yeah, HW support is needed for this feature.
--
Kalle Valo
>> Well, it may be interesting to do a serious analisys about how much
>> power is drained by the card when it is up and in RX, when the
>> mac80211 sends probes, and how much is related to the CPU, however,
>> because you estimated that the power drain increase is too much for
>> being directly related to the usb stuff, I think is really possible
>> that the big problem is related to beacons.
>
> I'll play around with AP settings a bit and report back to you.
> If you can think of any particular useful tests I could do, please
> let me know, I'll see what I can do.
>
> But yeah - even if the device draws more than the allowed 500 mA,
> I hope very much that it doesn't draw anywhere close to 3 A ... ;-)
On the AP you might set the beacon interval lower. And also, I'm not
sure if the rtl8187 driver configure the BSSID register so that once
you are associated to the network the card will filter all packets
from other APs, but in case it does not you can try to set your AP on
a channel where no other AP are working, otherwise other APs beacons
will be reiceved.
> I would assume that it's some timers you are using? As I understand it,
> other interrupts (which cannot really be predicted) don't prevent
> the power management code from switching the CPU into deep sleep
> modes?!
Hmm.. I think I know not enough about C3 state rules.
I think the rtl8187 does not use timers.
The only difference is that the interrupt is raised by the (PCI) USB
controller, then it forwards things to the USB layer, then it calls a
callback on the rtl8187 driver, and then it passes to the mac80211
layer. So the problem might be not the interrupt itself but the amount
of work to do..
> It's only a PIII, which is too slow with frequency changes for
> the ondemand governor, and the speedstep driver also causes other
> yet-unresolved problems (audio stuttering) when loaded.
> So it's not really a solution in this case, even though you are
> right that the actual CPU cycles used would suggest that newer
> processors should be able to stay at their minimum frequency with
> the ondemand governor.
Hmm.. Well.. I guess that effectively a USB softmac card on a slow
computer might produce a noticeable overhead, even if I never tried
before..
>> So far If you are looking for a card that make you save power, I
>> suggest you to get a fullmac one.
>
> Any suggestions as to how to recognize those? Or even a recommendation
> for a specific device/chipset?
I know that intel ipw2200 and the older ipw2100 should be fullmac.
Some prism, as you said are fullmac, and even some Marvell (for sure
some PCI, I don't know about USB) are fullmac.
There might be other but I don't know for sure..
Hi,
[...]
> As someone told before this management traffic is for examples beacons.
IC - I hadn't thought that softmac really meant basically "radio only" =:-)
> Probably your prism2 card was a so called "fullmac" card. That menas
> that all this management stuff can be done on the wifi card without
> generating load on the host CPU.
Yeah, it is.
> One thing I can say is that the ieee 802.11 protocol allows certains
> power save functionalities but, provided that mac80211 / rtl8187
> driver support it (and I'm really not sure), this will probably only
> reduces power consumption on the USB, not on the host processor.
That certainly would be nice, too, but it seems that most of the power
consumption really comes from the host processor. I guess I should
measure the current going through the USB connetion ...
> Well, it may be interesting to do a serious analisys about how much
> power is drained by the card when it is up and in RX, when the
> mac80211 sends probes, and how much is related to the CPU, however,
> because you estimated that the power drain increase is too much for
> being directly related to the usb stuff, I think is really possible
> that the big problem is related to beacons.
I'll play around with AP settings a bit and report back to you.
If you can think of any particular useful tests I could do, please
let me know, I'll see what I can do.
But yeah - even if the device draws more than the allowed 500 mA,
I hope very much that it doesn't draw anywhere close to 3 A ... ;-)
[...]
> This means that, IMHO, there is no way to avoid the CPU work on
> rtl8187 when you are connected to a network (unless the network AP is
> yours and you reduce beacon interval as someone suggested). Maybe you
> can force some powersave mode on the CPU, by scaling the cpu clock
> frequency, avoiding taht some "ondemand" policy can rise the clock
> when the CPU is loaded (I doubt beacons processing is enough to
> trigger this), but If you tracked down that interrupts are the causes
> of the CPU don't entering C3 state, I _think_ you can't do much..
I would assume that it's some timers you are using? As I understand it,
other interrupts (which cannot really be predicted) don't prevent
the power management code from switching the CPU into deep sleep
modes?!
It's only a PIII, which is too slow with frequency changes for
the ondemand governor, and the speedstep driver also causes other
yet-unresolved problems (audio stuttering) when loaded.
So it's not really a solution in this case, even though you are
right that the actual CPU cycles used would suggest that newer
processors should be able to stay at their minimum frequency with
the ondemand governor.
> So far If you are looking for a card that make you save power, I
> suggest you to get a fullmac one.
Any suggestions as to how to recognize those? Or even a recommendation
for a specific device/chipset?
Florian