Bug 436085

Summary: sane-backends install wery expensive not-optimized udev rules
Product: [openSUSE] openSUSE 11.1 Reporter: Kay Sievers <kasievers>
Component: HotplugAssignee: Johannes Meixner <jsmeix>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P3 - Medium    
Version: Factory   
Target Milestone: Beta 4   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: fixed /etc/udev/rules.d/55-libsane.rules
fixed /etc/udev/rules.d/56-sane-backends-autoconfig.rules
fixed /etc/udev/rules.d/55-hpmud.rules

Description Kay Sievers 2008-10-16 13:48:43 UTC
The rules in /etc/udev/rules.d/55-libsane.rules are written in a way to cause searches in the entire parent device chain for the files "idVendor" and "idProduct" for _every_ event on the system. This causes a high system load, and delayed bootup, if you have thousends of devices.

These attributes exist only at USB devices, and there is no need to search these attributes at every device in the system.

Please guard the whole file by SUBSYSTEM=="usb", and skip it, if that is not the case.

Also these attributes do not exist at any parent device, and ATTR{} (only the device the event is for) should be used instead of SYSFS{} (search all parents), which would optimize the whole thing dramatically.

Thanks!
Comment 1 Kay Sievers 2008-10-16 13:52:44 UTC
Same problem with:
  /etc/udev/rules.d/56-sane-backends-autoconfig.rules
Comment 2 Johannes Meixner 2008-10-21 12:43:13 UTC
Many thanks for the info!

Fixed package sane-backends submitted to FACTORY/STABLE right now.
Comment 3 Johannes Meixner 2008-10-21 12:44:28 UTC
Created attachment 246837 [details]
fixed /etc/udev/rules.d/55-libsane.rules
Comment 4 Johannes Meixner 2008-10-21 12:45:17 UTC
Created attachment 246838 [details]
fixed /etc/udev/rules.d/56-sane-backends-autoconfig.rules
Comment 5 Johannes Meixner 2008-10-21 12:54:04 UTC
Same for /etc/udev/rules.d/55-hpmud.rules (package hplip).
Will fix hplip too...
Comment 6 Johannes Meixner 2008-10-21 13:26:33 UTC
Fixed package hplip submitted to FACTORY/STABLE right now.
Comment 7 Johannes Meixner 2008-10-21 13:27:09 UTC
Created attachment 246853 [details]
fixed /etc/udev/rules.d/55-hpmud.rules
Comment 8 Johannes Meixner 2008-10-21 13:28:24 UTC
Should be completely fixed now.
Comment 9 Kay Sievers 2008-10-21 13:58:35 UTC
With the current files I get:
  $ time udevadm test /class/block/sda1 2>/dev/null
  real    0m0.059s
  user    0m0.018s
  sys     0m0.035s

After replacing the 3 files with the attached ones I get:
  $ time udevadm test /class/block/sda1 2>/dev/null
  real    0m0.037s
  user    0m0.005s
  sys     0m0.025s

Without the 3 files I get:
  $ time udevadm test /class/block/sda1 2>/dev/null
  real	0m0.034s
  user	0m0.006s
  sys	0m0.021s

Looks good. Very nice! Thanks!
Comment 10 Johannes Meixner 2008-10-22 06:14:37 UTC
Very many thanks for testing it!