Bug 313381

Summary: wpa_supplicant wakes up the cpu
Product: [Fedora] Fedora Reporter: William Lovaton <walovaton>
Component: wpa_supplicantAssignee: Dan Williams <dcbw>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: bnocera, mgarski
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-03-26 14:05:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 204948    
Attachments:
Description Flags
Lightly tested fix against 0.5.7
none
Slightly more tested fix none

Description William Lovaton 2007-10-01 00:01:29 UTC
According to powertop wpa_supplicant is waking up the cpu 1.5 times per second:

Wakeups-from-idle per second : 15,9     interval: 15,0s
Top causes for wakeups:
  27,3% (  2,0)     <kernel core> : clocksource_register (clocksource_watchdog) 
  20,0% (  1,5)    wpa_supplicant : schedule_timeout (process_timeout) 
   7,3% (  0,5)    gnome-terminal : schedule_timeout (process_timeout) 
   3,6% (  0,3)   <kernel module> : neigh_table_init_no_netlink
(neigh_periodic_timer) 
   3,6% (  0,3)     <kernel core> : neigh_table_init_no_netlink
(neigh_periodic_timer) 
   3,6% (  0,3)          nautilus : schedule_timeout (process_timeout) 
   3,6% (  0,3)      avahi-daemon : schedule_timeout (process_timeout) 
   2,7% (  0,2)                 X : do_setitimer (it_real_fn) 
   2,7% (  0,2)             gedit : schedule_timeout (process_timeout) 
   2,7% (  0,2)    mapping-daemon : schedule_timeout (process_timeout) 
   2,7% (  0,2)    NetworkManager : __netdev_watchdog_up (dev_watchdog) 
   2,7% (  0,2)              init : schedule_timeout (process_timeout) 
   2,7% (  0,2)          sendmail : schedule_timeout (process_timeout) 
   2,7% (  0,2)       gnome-panel : schedule_timeout (process_timeout) 
   1,8% (  0,1)   gnome-power-man : schedule_timeout (process_timeout) 

As shown above, besides the kernel, wpa_supplicant is the only one waking up the
cpu more than one time per second running my Gnome desktop on an updated Rawhide
system as of today.

Packages versions are:
wpa_supplicant-0.5.7-9.fc8
NetworkManager-0.7.0-0.3.svn2914.fc8
NetworkManager-gnome-0.7.0-0.3.svn2914.fc8
NetworkManager-glib-0.7.0-0.3.svn2914.fc8

Is there something that can be done to solve this?

Comment 1 Alan Jenkins 2007-10-09 18:38:57 UTC
Created attachment 221641 [details]
Lightly tested fix against 0.5.7

I also see it, though at 1.0 wakeups/sec.  I tried to fix it but the source is 

hard to understand :-(.  It probably wouldn't be too hard to find where it 
says "1 second", change it to "5 seconds" and see if it still works.

There's no fundamentally good reason for it to wake up - if you strace the 
daemon you'll see the only system call it makes is the select() call that it 
sleeps on.  I'm sure it's not polling information from the kernel, just doing 
some internal book-keeping.

Patch Works For Me (tm).  Might eat children, who knows, but should at least 
point out the problem.

Warning: After testing this patch my machine went up to 320 wakeups/s with no
reason shown on powertop.  I've not experienced this before and it could be
connected to my patch.

Comment 2 Dan Williams 2007-10-09 20:19:54 UTC
Alan; any chance you could push the patch to the hostap lists?  http://w1.fi is
the site; if you don't want to I could probably try to push it up.

Comment 3 Alan Jenkins 2007-10-09 21:17:24 UTC
Created attachment 221841 [details]
Slightly more tested fix

The previous one only stopped wpa_supplicant showing up on powertop because it
turned it into a busy loop :-).

This one is slightly less radical in it's aim.	It still uses a regular timer
tick, but it shuts it down once no timers are active.  On my setup, this means
wpa_supplicant stops showing up about 15 seconds after it's started.

The obstacle to removing the regular timer tick and only waking up when an
individual timer expires is that timers can be adjusted.  If a timer is enabled

while a different timer has yet to expire, you have to work out how long is
left on the existing timer, in order to find which timer will expire first.  If

you rely on the system clock, "date -s" will cause problems.  The only widely
available *monotonic* clock appears to be times(2).

Comment 4 Alan Jenkins 2007-10-09 21:21:42 UTC
Dan: I'm on it.  I added a bug there in parallel with posting on this one.  
I've still got to rebase it off their current version, then I won't mind 
squawking on the ML if they don't pick up the bug.

Comment 5 Alan Jenkins 2008-01-12 20:24:27 UTC
OK, they've implemented this now (my patch wasn't perfect and they re-wrote 
it).  Unfortunately their Bugzilla is down right now, but if you pull the 
latest from their GIT repo and use that, the wakeups should be gone.

git://w1.fi/srv/git/hostap.git

commit: 0ac3d3876ced310e45cc68e02d9a9bebe283dfbd

git-web: 
<http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commit;h=0ac3d3876ced310e45cc68e02d9a9bebe283dfbd>

Comment 6 Christopher Aillon 2008-03-26 07:21:50 UTC
This should be fixed in rawhide since we're using a dev release with your
changes, right?

Comment 7 Dan Williams 2008-03-26 14:05:11 UTC
yup, we're using 0.6.3 from early march