Re: [PATCH][RFC][ModemManager] udev rules: port to hwdb where applicable



Hi Aleksander,

On Mon, Jul 22, 2013 at 8:51 AM, Aleksander Morgado
<aleksander lanedo com> wrote:
I also fixed up some bugs in the existing udev rule files found in the process.

I wouldn't mind to see these in separate commits.

Ok, but as you write below you'd be happy to just drop the old udev
files, so I'll send a patch doing that instead.

Also, I wouldn't mind
to know why some .rules files got split.

The hwdb rules can (essentially) only match on the modalias, so it can
replace any rule matching on idVendor, idProduct, and so on. However,
the rule file that was split contained one rule which matched on the
product name (rather than id), which we cannot do in hwdb.

 * For what I can see, not every rules file was ported to the hwdb
format. Is it because not every rule we have can be expressed in the
hwdb format, or why?

The few rules that were left did not fit the hwdb scheme, so could not
be immediately ported. I don't think it makes sense to port them as
they are anyway very small.

 * Is there a good place to read about the new hwdb format?

It is not extensively documented, but I'm happy to answer any
questions you might have.

Some information can be found at the end of
<http://www.freedesktop.org/software/systemd/man/udev.html>, also in
the original NEWS item:
<http://cgit.freedesktop.org/systemd/systemd/tree/NEWS#n913>.

Essentially, the hwdb is an indexed database of properties associated
with modaila (or other keys, but in this context modalias is what is
used). The crucial difference between the hwdb and old udev rules is
that the cost of look-up is O(1), rather than O(n) in the size of the
database.

 * How much is the improvement we're looking for?

In absolute terms quite modest (I measured a speed-up of 14 ms per
added usb device), but in relative terms it is significant: we cut
down more than 70% of the overall processing time by converting the
four biggest "offenders" to hwdb:
<https://plus.google.com/114015603831160344127/posts/CR4fidfduHf>.

 * systemd/udev 196 is from late 2012; if all the rules can be converted
to the new hwdb format and we decide to use it, we should probably just
require that udev version. I personally wouldn't like to maintain two
different sources of rules.

Great. That sounds reasonable. I'll resubmit with this change.

 * Which other projects are already shipping hwdb files instead of plain
udev rules?

systemd shipps quite a few data sources already
<http://cgit.freedesktop.org/systemd/systemd/tree/hwdb>. These are
used internally, but also externally by bluez, and I just submitted
patches to port pciutils
<http://thread.gmane.org/gmane.linux.kernel.pci/24047> and usbutils
<http://thread.gmane.org/gmane.linux.usb.general/90372> to do the
same.

I also submitted patches similar to this one to port gphoto2
<http://sourceforge.net/mailarchive/forum.php?thread_name=CAG-2HqVsNezxM9vh17uiTPQob4S0fWxoVmW%2BCO_iUzmM6SkiHw%40mail.gmail.com&forum_name=gphoto-devel>,
sane <http://lists.alioth.debian.org/pipermail/sane-devel/2013-July/031491.html>
and media-player-info
<http://lists.freedesktop.org/archives/devkit-devel/2013-July/001405.html>.
Those are all recent though, so only the gphoto2 one has been accepted
so far.

Cheers,

Tom


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]