Skip to contentSkip to conversation

char/tpm: tpm_infineon no longer loaded for HP 2510p laptop

DISCUSSION Kay Sievers 2 participants 9 messages Aug 21, 2008 – Oct 4, 2008

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines · Bjorn Helgaas
Quoted 4 lines · Kay Sievers
Quoted 3 lines · Bjorn Helgaas

Can somebody elaborate on why we need to add "acpi*" aliases for all PNP devices? That broadens the kernel/user interface, so I'd like to understand why we need it.

Sorry, I should have prefaced my question with "I'm completely ignorant of this modalias stuff."

:)

Quoted 3 lines

Is there a "complete idiot's guide to modules
and udev"? There's precious little in Documentation/ other than a bunch of sample rules for various subsystems.

I don't know of any specific documentation, but it's pretty easy:
Devices, any kind of device, can export a match, based on specific properties of the subsystem it belongs to. In most cases its the same propery/id that is used inside the kernel, to find a (already loaded) driver which will bind this device.

Any unique string, hardware ID's, whatever, are stuffed into a modalias, prefixed by "<subsystem>:" to be unique.

PCI and USB are pretty obvious, they just stuff all their hardware ID'S into a string, in a defined order, and let every device export that value to userspace by MODALIAS environment key and the "modalias" sysfs file. Other subsystem may have simple strings to match, they define themselves.

Now, the drivers contain "match id tables" which are used by the core to bind devices to drivers. These tables area made available to file2alias.c in the module postprocessing, and will end up in the module file itself. The string is mangled to contain wildcards, so they can just be fnmatch()'d against the modalias value, which the devices export.

The string embedded in the modules are extracted by depmod, and put into the modules.aliases file in /lib/modules/. Every time modprobe is called with an alias, it searches through this file and loads all modules which contained a matching alias string.

Udev does nothing but stupidly running modprobe for every device which contains MODALIAS in the event environment, and passes $MODALIAS as an argument to modprobe.

That's basically the whole module autoloading today. :)

Quoted 5 lines
Quoted 3 lines

We already do ACPI module autoloading by MODALIAS for other things than pnp. ACPI exports the pnp devices with modalias, but the modules do not have a matching alias, this add them.

I'm guessing this has something to do with acpi_device_uevent().

That's where the MODALIAS environment value is composed, yes.

Quoted 6 lines
Quoted 3 lines

PNP has no MODALIAS support at all, and the current pnp-aliases would not work for the standard modalias method, they would need to change their format.

pnp_bus_type has no .uevent method. What if I added one? Would that help this situation?

Only if we would change the format of the aliases.

Quoted 2 lines

It seems wrong for file2alias.c to take every PNP device (even if it's an ISAPNP or PNPBIOS device) and add "acpi*" aliases for it.

Yeah, they are all exported by acpi too.

Quoted 4 lines
Quoted 3 lines

The plan is to replace the current pnp modprobe shell script hack in udev, when ACPI devices load the right modules without any special userspace mangling.

Quoted 8 lines

Is this the shell hack you mean (from etc/udev/rules.d/80-drivers.rules in udev-117)?

 SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", \
   RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do 

echo pnp:d$$id; done < /sys$devpath/id)'"

I agree that's gross.

Yeah, that's what we want to kill. :)

Quoted 1 line

Could I fix this by implementing pnp_device_uevent()?

Only if we change the format of the current pnp device aliases to something like:
pnp*:XYZ2324:*
pnp*:ABC1234:*

and create a "modalias" file at every pnp device, and add MODALIAS to the uevent. The modalias must contains all ID's which belong to that device in one single string, separated and terminated by a special character, something like:
pnp:ABC1234:XYZ2324:RST3445:

That's how acpi should work with this patch now.

Kay

#1 lore raw
Quoted 7 lines · Kay Sievers
Quoted 3 lines · Bjorn Helgaas

Is there a "complete idiot's guide to modules
and udev"? There's precious little in Documentation/ other than a bunch of sample rules for various subsystems.

I don't know of any specific documentation, but it's pretty easy:
...

Thanks for the tutorial.

Quoted 7 lines
Quoted 1 line

Could I fix this by implementing pnp_device_uevent()?

Only if we change the format of the current pnp device aliases to something like:
pnp*:XYZ2324:*
pnp*:ABC1234:*

Quoted 5 lines

and create a "modalias" file at every pnp device, and add MODALIAS to the uevent. The modalias must contains all ID's which belong to that device in one single string, separated and terminated by a special character, something like:
pnp:ABC1234:XYZ2324:RST3445:

This all sounds like good stuff that I'd like PNP to have. Is there any reason I shouldn't implement pnp_device_uevent()? Any backwards- compatibility issues?

I think that sounds like a better solution than doing this PNP ID mangling.

Bjorn

#2 lore raw
Quoted 24 lines · Bjorn Helgaas
Quoted 7 lines · Kay Sievers
Quoted 3 lines · Bjorn Helgaas

Is there a "complete idiot's guide to modules
and udev"? There's precious little in Documentation/ other than a bunch of sample rules for various subsystems.

I don't know of any specific documentation, but it's pretty easy:
...

Thanks for the tutorial.

Quoted 7 lines
Quoted 1 line

Could I fix this by implementing pnp_device_uevent()?

Only if we change the format of the current pnp device aliases to something like:
pnp*:XYZ2324:*
pnp*:ABC1234:*

Quoted 5 lines

and create a "modalias" file at every pnp device, and add MODALIAS to the uevent. The modalias must contains all ID's which belong to that device in one single string, separated and terminated by a special character, something like:
pnp:ABC1234:XYZ2324:RST3445:

Quoted 3 lines

This all sounds like good stuff that I'd like PNP to have. Is there any reason I shouldn't implement pnp_device_uevent()? Any backwards- compatibility issues?

Yeah, people probably use the current aliases in modprobe.conf files, I'm not sure, if we can change them.

Quoted 2 lines

I think that sounds like a better solution than doing this PNP ID mangling.

Sure, that will go with the acpi aliases + acpi modalias, or if you change pnp to have proper pnp aliases + pnp modalias, then with them, yes.

Thanks,
Kay

#3 lore raw
Quoted 32 lines · Kay Sievers
Quoted 24 lines · Bjorn Helgaas
Quoted 7 lines · Kay Sievers
Quoted 3 lines · Bjorn Helgaas

Is there a "complete idiot's guide to modules
and udev"? There's precious little in Documentation/ other than a bunch of sample rules for various subsystems.

I don't know of any specific documentation, but it's pretty easy:
...

Thanks for the tutorial.

Quoted 7 lines
Quoted 1 line

Could I fix this by implementing pnp_device_uevent()?

Only if we change the format of the current pnp device aliases to something like:
pnp*:XYZ2324:*
pnp*:ABC1234:*

Quoted 5 lines

and create a "modalias" file at every pnp device, and add MODALIAS to the uevent. The modalias must contains all ID's which belong to that device in one single string, separated and terminated by a special character, something like:
pnp:ABC1234:XYZ2324:RST3445:

Quoted 3 lines

This all sounds like good stuff that I'd like PNP to have. Is there any reason I shouldn't implement pnp_device_uevent()? Any backwards- compatibility issues?

Yeah, people probably use the current aliases in modprobe.conf files, I'm not sure, if we can change them.

Quoted 6 lines
Quoted 2 lines

I think that sounds like a better solution than doing this PNP ID mangling.

Sure, that will go with the acpi aliases + acpi modalias, or if you change pnp to have proper pnp aliases + pnp modalias, then with them, yes.

Since PNP currently doesn't generate any uevents or modalias files, I expect that a non-ACPI system will be unable to autoload modules for ISAPNP or PNPBIOS devices. Right?

Bjorn

#4 lore raw
Quoted 36 lines · Bjorn Helgaas
Quoted 35 lines · Kay Sievers
Quoted 24 lines · Bjorn Helgaas
Quoted 7 lines · Kay Sievers
Quoted 3 lines · Bjorn Helgaas

Is there a "complete idiot's guide to modules
and udev"? There's precious little in Documentation/ other than a bunch of sample rules for various subsystems.

I don't know of any specific documentation, but it's pretty easy:
...

Thanks for the tutorial.

Quoted 7 lines
Quoted 1 line

Could I fix this by implementing pnp_device_uevent()?

Only if we change the format of the current pnp device aliases to something like:
pnp*:XYZ2324:*
pnp*:ABC1234:*

Quoted 5 lines

and create a "modalias" file at every pnp device, and add MODALIAS to the uevent. The modalias must contains all ID's which belong to that device in one single string, separated and terminated by a special character, something like:
pnp:ABC1234:XYZ2324:RST3445:

Quoted 3 lines

This all sounds like good stuff that I'd like PNP to have. Is there any reason I shouldn't implement pnp_device_uevent()? Any backwards- compatibility issues?

Yeah, people probably use the current aliases in modprobe.conf files, I'm not sure, if we can change them.

Quoted 2 lines

I think that sounds like a better solution than doing this PNP ID mangling.

Quoted 7 lines
Quoted 3 lines

Sure, that will go with the acpi aliases + acpi modalias, or if you change pnp to have proper pnp aliases + pnp modalias, then with them, yes.

Since PNP currently doesn't generate any uevents or modalias files, I expect that a non-ACPI system will be unable to autoload modules for ISAPNP or PNPBIOS devices. Right?

They do create events, but without modalias. The shell script hack, which udev runs, will make the event behave like it contained one.

Kay

#5 lore raw
Quoted 7 lines · Kay Sievers
Quoted 3 lines · Bjorn Helgaas

Since PNP currently doesn't generate any uevents or modalias files, I expect that a non-ACPI system will be unable to autoload modules for ISAPNP or PNPBIOS devices. Right?

They do create events, but without modalias. The shell script hack, which udev runs, will make the event behave like it contained one.

I'm finally looking at this again; sorry for the long hiatus. I'm working on a patch to add PNP uevent support, modalias sysfs files for PNP, and file2alias.c changes to match, and I just want to make sure I'm understanding this correctly.

Before your file2alias.c changes[1], I think we generated this:

    alias pnp:dPNP0500* 8250_pnp

We relied on the udev shell hack to run "modprobe -a pnp:dPNP0500" based on the contents of /sys/bus/pnp/devices/00:05/id.

With your file2alias.c changes, we now generate this:

    alias acpi*:PNP0500:* 8250_pnp
    alias pnp:dPNP0500* 8250_pnp

On ACPI systems, this works fine because "acpi*:PNP0500:*" matches the ACPI-generated uevents like:

    MODALIAS=acpi:PNP0501:PNP0500:

We can load 8250_pnp without relying on the udev shell hack *on ACPI systems*.

I thought the object of your file2alias.c changes was to remove the need for the udev shell hack, but don't we still require it on non-ACPI systems because they won't emit the ACPI uevents?

Bjorn

[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=22454cb99fc39f2629ad06a7eccb3df312f8830e
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=5e4c6564c95ce127beeefe75e15cd11c93487436

#6 lore raw
Quoted 6 lines · Bjorn Helgaas
Quoted 5 lines · Kay Sievers
Quoted 3 lines · Bjorn Helgaas

Since PNP currently doesn't generate any uevents or modalias files, I expect that a non-ACPI system will be unable to autoload modules for ISAPNP or PNPBIOS devices. Right?

Quoted 7 lines
Quoted 2 lines

They do create events, but without modalias. The shell script hack, which udev runs, will make the event behave like it contained one.

I'm finally looking at this again; sorry for the long hiatus. I'm working on a patch to add PNP uevent support, modalias sysfs files for PNP, and file2alias.c changes to match, and I just want to make sure I'm understanding this correctly.

Sounds good, just in mind, that there are custom modprobe configs out there, that rely on the current pnp alias format, like:
alias pnp:dPNP0510 irtty-sir
alias pnp:dPNP0511 irtty-sir
alias pnp:dPNP0700 floppy
alias pnp:dPNP0303 atkbd
alias pnp:dPNP0f13 psmouse
...
We should make sure, that this still works, which wouldn't if we just do the acpi style aliases.

Quoted 12 lines

Before your file2alias.c changes[1], I think we generated this:

   alias pnp:dPNP0500* 8250_pnp

We relied on the udev shell hack to run "modprobe -a pnp:dPNP0500" based on the contents of /sys/bus/pnp/devices/00:05/id.

With your file2alias.c changes, we now generate this:

   alias acpi*:PNP0500:* 8250_pnp
   alias pnp:dPNP0500* 8250_pnp

On ACPI systems, this works fine because "acpi*:PNP0500:*" matches the ACPI-generated uevents like:

Quoted 8 lines
   MODALIAS=acpi:PNP0501:PNP0500:

We can load 8250_pnp without relying on the udev shell hack *on ACPI systems*.

I thought the object of your file2alias.c changes was to remove the need for the udev shell hack, but don't we still require it on non-ACPI systems because they won't emit the ACPI uevents?

Yes, the plan is to move that rule from the default udev rule set to the isapnp package.

Thanks,
Kay

#7 lore raw
Quoted 15 lines · Kay Sievers
Quoted 6 lines · Bjorn Helgaas
Quoted 5 lines · Kay Sievers
Quoted 3 lines · Bjorn Helgaas

Since PNP currently doesn't generate any uevents or modalias files, I expect that a non-ACPI system will be unable to autoload modules for ISAPNP or PNPBIOS devices. Right?

Quoted 7 lines
Quoted 2 lines

They do create events, but without modalias. The shell script hack, which udev runs, will make the event behave like it contained one.

I'm finally looking at this again; sorry for the long hiatus. I'm working on a patch to add PNP uevent support, modalias sysfs files for PNP, and file2alias.c changes to match, and I just want to make sure I'm understanding this correctly.

Quoted 10 lines

Sounds good, just in mind, that there are custom modprobe configs out there, that rely on the current pnp alias format, like:
alias pnp:dPNP0510 irtty-sir
alias pnp:dPNP0511 irtty-sir
alias pnp:dPNP0700 floppy
alias pnp:dPNP0303 atkbd
alias pnp:dPNP0f13 psmouse
...
We should make sure, that this still works, which wouldn't if we just do the acpi style aliases.

My thought is to make PNP emit uevents with modaliases like "MODALIAS=pnp:PNP0501:PNP0500:" and make file2alias generate aliases like "alias pnp*:PNP0500:* 8250_pnp".

Modprobe configs like "alias pnp:dPNP0510 irtty-sir" would still work but would continue to depend on the udev shell hack.

If we just move the udev shell hack to the isapnp package, those "alias pnp:dPNP0510 irtty-sir" configs would then depend on isapnp, which doesn't seem like quite what we want. We can certainly have PNP0510 ACPI devices that don't depend on isapnp.

All I want to do now is *enable* more conventional configs like "alias pnp*:PNP0510:* irtty-sir" to work without extra hacks. I don't have any plan for actually removing the hacks or doing any user-space transition.

Quoted 23 lines
Quoted 12 lines

Before your file2alias.c changes[1], I think we generated this:

   alias pnp:dPNP0500* 8250_pnp

We relied on the udev shell hack to run "modprobe -a pnp:dPNP0500" based on the contents of /sys/bus/pnp/devices/00:05/id.

With your file2alias.c changes, we now generate this:

   alias acpi*:PNP0500:* 8250_pnp
   alias pnp:dPNP0500* 8250_pnp

On ACPI systems, this works fine because "acpi*:PNP0500:*" matches the ACPI-generated uevents like:

Quoted 8 lines
   MODALIAS=acpi:PNP0501:PNP0500:

We can load 8250_pnp without relying on the udev shell hack *on ACPI systems*.

I thought the object of your file2alias.c changes was to remove the need for the udev shell hack, but don't we still require it on non-ACPI systems because they won't emit the ACPI uevents?

Yes, the plan is to move that rule from the default udev rule set to the isapnp package.

#8 lore raw
Quoted 27 lines · Bjorn Helgaas
Quoted 15 lines · Kay Sievers
Quoted 6 lines · Bjorn Helgaas
Quoted 5 lines · Kay Sievers
Quoted 3 lines · Bjorn Helgaas

Since PNP currently doesn't generate any uevents or modalias files, I expect that a non-ACPI system will be unable to autoload modules for ISAPNP or PNPBIOS devices. Right?

Quoted 7 lines
Quoted 2 lines

They do create events, but without modalias. The shell script hack, which udev runs, will make the event behave like it contained one.

I'm finally looking at this again; sorry for the long hiatus. I'm working on a patch to add PNP uevent support, modalias sysfs files for PNP, and file2alias.c changes to match, and I just want to make sure I'm understanding this correctly.

Quoted 10 lines

Sounds good, just in mind, that there are custom modprobe configs out there, that rely on the current pnp alias format, like:
alias pnp:dPNP0510 irtty-sir
alias pnp:dPNP0511 irtty-sir
alias pnp:dPNP0700 floppy
alias pnp:dPNP0303 atkbd
alias pnp:dPNP0f13 psmouse
...
We should make sure, that this still works, which wouldn't if we just do the acpi style aliases.

Quoted 3 lines

My thought is to make PNP emit uevents with modaliases like "MODALIAS=pnp:PNP0501:PNP0500:" and make file2alias generate aliases like "alias pnp*:PNP0500:* 8250_pnp".

Looks good, and it is how they should look like. The current pnp aliases are totally broken and useless for any usual modalias matching.

Quoted 2 lines

Modprobe configs like "alias pnp:dPNP0510 irtty-sir" would still work but would continue to depend on the udev shell hack.

The way the current shell hack is done, is that it gets disabled automatically at the moment pnp events carry $MODALIAS.

Quoted 2 lines

I don't have any plan for actually removing the hacks or doing any user-space transition.

Hmm, I guess there is no way around that. :)

Thanks,
Kay