Bug 246341

Summary: newhidups wakes up 1000 times per second
Product: [Fedora] Fedora Reporter: Fabrice Bellet <fabrice>
Component: nutAssignee: Tomas Smetana <tsmetana>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 7CC: fabrice
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 2.2.1-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-01-25 11:01:10 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    

Description Fabrice Bellet 2007-06-30 18:16:08 UTC
Under powertop, newhidups generates a large amount of wakeups/second:

Wakeups-from-idle per second : 2381.6
no ACPI power usage estimate available

Top causes for wakeups:
  65.9% (936.8)         newhidups : schedule_timeout (process_timeout) 
[...]

Here is a strace sample:

20:12:13 select(87, NULL, [], NULL, {0, 1000}) = 0 (Timeout)
20:12:13 gettimeofday({1183227133, 69667}, NULL) = 0
20:12:13 ioctl(86, USBDEVFS_REAPURBNDELAY, 0xbfaed4f8) = -1 EAGAIN (Resource
temporarily unavailable)
20:12:13 select(87, NULL, [], NULL, {0, 1000}) = 0 (Timeout)
20:12:13 gettimeofday({1183227133, 70666}, NULL) = 0
20:12:13 ioctl(86, USBDEVFS_REAPURBNDELAY, 0xbfaed4f8) = -1 EAGAIN (Resource
temporarily unavailable)
20:12:13 select(87, NULL, [], NULL, {0, 1000}) = 0 (Timeout)
20:12:13 gettimeofday({1183227133, 71692}, NULL) = 0
20:12:13 ioctl(86, USBDEVFS_REAPURBNDELAY, 0xbfaed4f8) = -1 EAGAIN (Resource
temporarily unavailable)
20:12:13 select(87, NULL, [], NULL, {0, 1000}) = 0 (Timeout)
20:12:13 gettimeofday({1183227133, 72667}, NULL) = 0
20:12:13 ioctl(86, USBDEVFS_REAPURBNDELAY, 0xbfaed4f8) = -1 EAGAIN (Resource
temporarily unavailable)
20:12:13 select(87, NULL, [], NULL, {0, 1000}) = 0 (Timeout)
20:12:13 gettimeofday({1183227133, 73745}, NULL) = 0
[...]

newhidups probably could be more resource-friendly.

Comment 1 Tomas Smetana 2007-11-28 13:59:42 UTC
I'm not sure that newhidups (or usbhid-ups in nut 2.2.0) could be more
resource-friendly...  They keep polling the ups for changes.  The polling
frequency is configurable (-i parameter) but setting it to high means that any
power-outage or other problem might be discovered too late and nut may not
initiate the shutdown in time.  I'll try to tweak the default frequency.

Comment 2 Fabrice Bellet 2008-01-24 22:40:10 UTC
rawhide version 2.2.1 lowered the timeout value from 5000 to 250, so usbhid-ups
now only generates ~100 wakeups per seconds, which is much better :) This bug
can probably be closed now. Will version 2.2.1 be pushed for Fedora 8 eventually ?

Comment 3 Tomas Smetana 2008-01-25 11:01:10 UTC
I'll take a look at the new version and if it doesn't break API (I think I saw
something in the new release I didn't like) I will push it into F-8.

Closing the bug as per comment #2.