Bug 19162

Summary: acpi sysfs creates useless module aliases
Product: ACPI Reporter: Kay Sievers (kay)
Component: OtherAssignee: acpi_other
Status: CLOSED CODE_FIX    
Severity: normal CC: acpi-bugzilla, lenb, trenn
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: acpi-bugzilla@lists.sourceforge.net Subsystem:
Regression: No Bisected commit-id:

Description Kay Sievers 2010-09-27 14:11:58 UTC
This shows the list of exported module aliases from ACPI:
  grep . /sys/bus/acpi/devices/*/modalias

More than half of it are just 'acpi:device:' which looks rather useless to export, and these values without meaning should better be suppressed.

These aliases cause ~70 needless calls to:
  /sbin/modprobe $MODALIAS
on every bootup.

We could filter that in userland, but prefer the fix at the ACPI sysfs to not to export information without information. :)
Comment 1 Len Brown 2010-09-30 02:13:22 UTC
wow, okay, there are a bunch of these things.
apparently we create them for every single acpi device.
what are they used for? do we need any of them?

/sys/bus/acpi/devices/device:00/modalias:acpi:device:
/sys/bus/acpi/devices/device:01/modalias:acpi:device:
/sys/bus/acpi/devices/device:02/modalias:acpi:device:
/sys/bus/acpi/devices/device:03/modalias:acpi:device:
/sys/bus/acpi/devices/device:04/modalias:acpi:device:
/sys/bus/acpi/devices/device:05/modalias:acpi:device:
/sys/bus/acpi/devices/device:06/modalias:acpi:device:
/sys/bus/acpi/devices/device:07/modalias:acpi:device:
/sys/bus/acpi/devices/device:08/modalias:acpi:device:
/sys/bus/acpi/devices/device:09/modalias:acpi:device:
/sys/bus/acpi/devices/device:0a/modalias:acpi:device:
/sys/bus/acpi/devices/device:0b/modalias:acpi:device:
/sys/bus/acpi/devices/device:0c/modalias:acpi:device:
/sys/bus/acpi/devices/device:0d/modalias:acpi:device:
/sys/bus/acpi/devices/device:0e/modalias:acpi:device:
/sys/bus/acpi/devices/device:0f/modalias:acpi:device:
/sys/bus/acpi/devices/device:10/modalias:acpi:device:
/sys/bus/acpi/devices/device:11/modalias:acpi:device:
/sys/bus/acpi/devices/device:12/modalias:acpi:device:
/sys/bus/acpi/devices/device:13/modalias:acpi:device:
/sys/bus/acpi/devices/device:14/modalias:acpi:device:
/sys/bus/acpi/devices/device:15/modalias:acpi:device:
/sys/bus/acpi/devices/device:16/modalias:acpi:device:
/sys/bus/acpi/devices/device:17/modalias:acpi:device:
/sys/bus/acpi/devices/device:18/modalias:acpi:device:
/sys/bus/acpi/devices/device:19/modalias:acpi:device:
/sys/bus/acpi/devices/device:1a/modalias:acpi:device:
/sys/bus/acpi/devices/device:1b/modalias:acpi:device:
/sys/bus/acpi/devices/device:1c/modalias:acpi:device:
/sys/bus/acpi/devices/device:1d/modalias:acpi:device:
/sys/bus/acpi/devices/device:1e/modalias:acpi:device:
/sys/bus/acpi/devices/device:1f/modalias:acpi:device:
/sys/bus/acpi/devices/device:20/modalias:acpi:device:
/sys/bus/acpi/devices/device:21/modalias:acpi:device:
/sys/bus/acpi/devices/device:22/modalias:acpi:device:
/sys/bus/acpi/devices/device:23/modalias:acpi:device:
/sys/bus/acpi/devices/device:24/modalias:acpi:device:
/sys/bus/acpi/devices/device:25/modalias:acpi:device:
/sys/bus/acpi/devices/device:26/modalias:acpi:device:
/sys/bus/acpi/devices/device:27/modalias:acpi:device:
/sys/bus/acpi/devices/LNXCPU:00/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:01/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:02/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:03/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:04/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:05/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:06/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:07/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:08/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:09/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:0a/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:0b/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:0c/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:0d/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:0e/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXCPU:0f/modalias:acpi:LNXCPU:
/sys/bus/acpi/devices/LNXPWRBN:00/modalias:acpi:LNXPWRBN:
/sys/bus/acpi/devices/LNXSYBUS:00/modalias:acpi:LNXSYBUS:
/sys/bus/acpi/devices/LNXSYSTM:00/modalias:acpi:LNXSYSTM:
/sys/bus/acpi/devices/LNXTHERM:00/modalias:acpi:LNXTHERM:
/sys/bus/acpi/devices/PNP0000:00/modalias:acpi:PNP0000:
/sys/bus/acpi/devices/PNP0003:00/modalias:acpi:PNP0003:
/sys/bus/acpi/devices/PNP0100:00/modalias:acpi:PNP0100:
/sys/bus/acpi/devices/PNP0103:00/modalias:acpi:PNP0103:
/sys/bus/acpi/devices/PNP0200:00/modalias:acpi:PNP0200:
/sys/bus/acpi/devices/PNP0800:00/modalias:acpi:PNP0800:
/sys/bus/acpi/devices/PNP0A08:00/modalias:acpi:PNP0A08:PNP0A03:
/sys/bus/acpi/devices/PNP0B00:00/modalias:acpi:PNP0B00:
/sys/bus/acpi/devices/PNP0C02:00/modalias:acpi:PNP0C02:
/sys/bus/acpi/devices/PNP0C02:01/modalias:acpi:PNP0C02:
/sys/bus/acpi/devices/PNP0C04:00/modalias:acpi:PNP0C04:
/sys/bus/acpi/devices/PNP0C0E:00/modalias:acpi:PNP0C0E:
/sys/bus/acpi/devices/PNP0C0F:00/modalias:acpi:PNP0C0F:
/sys/bus/acpi/devices/PNP0C0F:01/modalias:acpi:PNP0C0F:
/sys/bus/acpi/devices/PNP0C0F:02/modalias:acpi:PNP0C0F:
/sys/bus/acpi/devices/PNP0C0F:03/modalias:acpi:PNP0C0F:
/sys/bus/acpi/devices/PNP0C0F:04/modalias:acpi:PNP0C0F:
/sys/bus/acpi/devices/PNP0C0F:05/modalias:acpi:PNP0C0F:
/sys/bus/acpi/devices/PNP0C0F:06/modalias:acpi:PNP0C0F:
/sys/bus/acpi/devices/PNP0C0F:07/modalias:acpi:PNP0C0F:
/sys/bus/acpi/devices/pnp0c14:00/modalias:acpi:pnp0c14:
Comment 2 Kay Sievers 2010-09-30 08:19:06 UTC
> --- Comment #1 from Len Brown <lenb@kernel.org>  2010-09-30 02:13:22 ---
> wow, okay, there are a bunch of these things.
> apparently we create them for every single acpi device.
> what are they used for? do we need any of them?

The 'modalias' is a hint for the system to search a matching kernel
module. The installed kernel modules may carry device matches, which
are extracted by 'depmod' and all put into the file:
  /lib/modules/$(uname -r)/modules.alias

When a device appears on the system, or during coldplug at bootup, for
all devices with a 'modalias', 'modprobe' is called with this alias.
Modprobe matches the given alias with all the glob matches in the
modules.alias file. All matching modules are then auto-loaded depending
on the specific devices on the actual system.

> /sys/bus/acpi/devices/device:00/modalias:acpi:device:

These don't export any information, and there will be no kernel module
ever, which has the alias: "acpi:device". I think we can just suppress them
from showing up as a 'modalias'

> /sys/bus/acpi/devices/LNXCPU:00/modalias:acpi:LNXCPU:
> /sys/bus/acpi/devices/LNXPWRBN:00/modalias:acpi:LNXPWRBN:
> /sys/bus/acpi/devices/LNXSYBUS:00/modalias:acpi:LNXSYBUS:
> /sys/bus/acpi/devices/LNXSYSTM:00/modalias:acpi:LNXSYSTM:
> /sys/bus/acpi/devices/LNXTHERM:00/modalias:acpi:LNXTHERM:
> /sys/bus/acpi/devices/PNP0800:00/modalias:acpi:PNP0800:
> /sys/bus/acpi/devices/PNP0A08:00/modalias:acpi:PNP0A08:PNP0A03:

These carry some sort of identifier, and they should all be there, because
there could be matches from drivers. Here are a few matches inside the
kernel modules, which need the ACPI modalias:
  $ grep acpi /lib/modules/$(uname -r)/modules.alias
  alias acpi*:ACPI0003:* ac
  alias acpi*:PNP0C0A:* battery
  alias acpi*:ACPI0005:* sbshc
  alias acpi*:ACPI0001:* sbshc
  alias acpi*:ACPI0002:* sbs
  alias acpi*:IFX0102:* tpm_infineon
  alias acpi*:IFX0101:* tpm_infineon
  alias acpi*:PNP0700:* floppy
  alias dmi:bvnIBM:bvrI[MU]ET??WW* thinkpad_acpi
  alias tpacpi thinkpad_acpi
  alias acpi*:IBM0068:* thinkpad_acpi
  alias acpi*:PNP0401:* parport_pc
Comment 3 Thomas Renninger 2010-10-01 05:20:13 UTC
The problem is that there are a lot PCI devices which are defined/assigned via _ADR to their PCI bus:slot.func.
I am not sure they should get exposed via ACPI at this place, better would be if acpi attributes show up in a pci specific sysfs device tree.
IMO it's not worth to at some time link from PCI dev dir to ACPI dev dir and vice versa.

There also seem to be some orphaned ACPI objects without _ADR and HID/CID, but they seem to have a _STA func which tells the device is working/active.

I'll send out 2 patches to the list.
I could not resist to try/do some further cleanups, maybe I should not have started with the trying to get the HID stuff const...

Next cleanup step could be to not call:
acpi_device_register(..)
if the device has no HID/CID, there won't bind a ACPI driver to this object anyway.
But...:
   - I got a NULL pointer in acpi_add_single_object(..)
   - some stuff still needed for other devices needs to go up one func there:
     wakeup list, etc.
   - Whatabout objects that exported a _EJX via sysfs files
Comment 4 Len Brown 2010-10-01 20:35:44 UTC
patch to test is in acpi-test tree

https://patchwork.kernel.org/patch/223102/
Comment 5 Len Brown 2010-11-02 02:53:17 UTC
shipped in linux-2.6.37-rc1

closed

commit 620e112cfe1c9281c176de8ad1a7691c4eb4950d
Author: Thomas Renninger <trenn@suse.de>
Date:   Fri Oct 1 10:54:00 2010 +0200

    ACPI/PNP: A HID value of an object never changes -> make it const