/srv/irclogs.ubuntu.com/2017/05/10/#ubuntu-kernel.txt

xnoxapw, how does linux kernel platform device enumeration happen using ACPI?10:25
xnoxhttps://www.kernel.org/doc/Documentation/acpi/enumeration.txt10:25
apwxnox, magic ?  what are you asking ?10:25
xnoxi mean, is it done in order / serially, or in parallel|randomly.10:25
apwacpi things are found on buses which support things with ids10:25
xnoxin the code for hns_enet.c there is MODULE_DEVICE_TABLE (acpi, match) and that's it really and a probe.10:26
apwit is done in bus discovery order10:26
xnoxusually, yes. but this is without a bus, as far as I understand.10:26
xnoxbecause it is a platform device that is simply defined in ACPI because they can.10:26
apwit is being done against the dtb isn't it in that driver ?10:26
apwoh hmm, no it has both so who knows which i used10:27
xnoxhm. i think it does both.10:27
apwit _does_ both but which was used on this platform10:27
apwHISI00C? appears in your ids i believe yes ?10:28
xnoxgood question. /me is n00b; yes, and I see ACPI paths in the sysfs.10:28
apwxnox, ok acpi is your bus in the kernels mid10:33
apwnmind10:33
xnoxok. so is there such a thing as the ACPI "bus" "id" aka order? =)10:34
* xnox feels like these abstractions make no sense at all10:34
apwthat is because you are a userspace engineer :)10:35
apwi think you caring which order i probe them is stupid10:35
xnoxwell, that is because the probe in my device driver allocates devno for the driver, and that is what is exposed in sysfs, and i am pondering to use that for stable device names10:35
apwthe devices have unique identifiers so you can tell them apart10:36
apwand yet you refuse to use them10:36
xnoxbecause vendor came back and said that ae-handle and ae-pidx-in-ae or whatever it was, together do identify unique ports10:36
xnoxbut do not have any correspondence with the physical board layout.10:36
xnoxthe physical board layout corresponds to the ACPI order of those devices.10:37
apwwhich likely means it is in the order they are in the acpi tables, whcih come from teh firmware10:37
xnoxand i do want enh2p0 enh2p1 be the first and second ethernet ports. rather than enh2p4, enh2p3 be the first/second ports.10:37
xnoxcorrect, and if kernel loads the acpi table, does a match, and then fires to create handles in parallel, my devno's will no longer be in acpi order =/ or so i am imagining things.10:38
apwso are they in reverse order or something10:38
xnoxlet me share the bug with you, one second.10:38
apwxnox, you already did10:39
xnoxthere are more comments from the vendor about hte acpi10:39
xnoxhttps://bugs.launchpad.net/pearl/+bug/168165110:39
ubot5Error: ubuntu bug 1681651 not found10:39
xnoxfirmware node path....10:40
apware you now able to find the Device (...) bit when you are probed ?10:42
* xnox is afraid that i will get this wrong, and then my stable device names will be unstable.10:42
apwxnox, which series kernel are we using again ?10:43
apwxnox, i want to talk line numbers at you10:43
xnox4.410:44
xnoxno10:44
xnox4.1010:44
xnoxwait no.10:45
xnoxthe yakkety hwe kernel10:45
xnoxin xenial.10:45
* apw stops talking to you10:45
xnoxi have a branch of that checkout.10:45
apwok at line 1914 of hns_enet.c ... is where it is handling a probe10:45
apwnote that there we have a dev->fwnode which is an acpi thing10:45
xnoxyeap.10:47
apwyou look to be able to call acpi_device_data_of_node() on that, and that has a name element which i think is the string in the Device() stanza in the table10:50
apwbut is that not available in the acpi information ?10:50
apwalready exposed in sysfs ?10:50
xnox.... to be continued. The truth is out there.10:54
xnoxi am suspecting that yes, it is all exposed in /sys/bus/acpi/devices10:55
apwxnox, probabally as a part of the path10:56
xnoxyeah, or symlink targets or some such. but need to login to confirm =/10:56
apwas in in cat /sys/bus/acpi/devices/PNP0C14\:02/path10:57
xnoxls -latr view of /sys/bus/acpi/ is nice too.10:57
xnoxubuntu@ubuntu:~$ cat /sys/class/net/*/device/firmware_node/path10:58
xnox\_SB_.ETH410:58
xnox\_SB_.ETH510:58
xnox\_SB_.ETH010:58
xnox\_SB_.ETH110:58
apwthat10:58
xnoxhorum, so we do have that. "firmware_node" =)10:58
apwthere you go, that matches where i would expect it to be in the kernel data structures too10:58
apwand that is telling youu which acpi table it came from, and which object within it10:59
apwthat is what they call them, and likley what we should call them10:59
xnoxright. and somehow my wish is to translate 4 -> 0; 5 -> 1; 0 -> 2; 1 -> 3.10:59
xnoxtrue.10:59
xnox(what you say)10:59
xnoxand people will have to learn that they are 450110:59
apwthey may wish to not call them that, and change teh ACPI tables10:59
xnoxi think acpi tables are fixed.11:00
xnoxbut i can ask.11:00
apwright, but they have picked these rather random names for a reason, what is that reason11:01
* apw wonders how the bios affected names work, ...11:02
apwi think it is difficult to do anything other than use the names as they are, as as that says that dump is for a specific board 11:03
apwanother board will have different layouts of connectors11:03
apwand looking at that, the ports are in order of attachement to the internal device11:04
apwas in eth0 is port 011:04
apwit really has 6 ports per device11:04
xnoxack.11:41
xnoxapw, what about this stuff:11:41
xnox0./devices/LNXSYSTM:00/LNXSYBUS:00/HISI00C2:0211:41
xnox0./devices/LNXSYSTM:00/LNXSYBUS:00/HISI00C2:0011:41
xnox0./devices/LNXSYSTM:00/LNXSYBUS:00/HISI00C2:0311:41
xnox0./devices/LNXSYSTM:00/LNXSYBUS:00/HISI00C2:0111:41
xnoxis this platform bus, and is there any guidance as to how things are named on LNXSYBUS? =)11:41
apwi don't think you can rely on it, as that is in the order the current kernel decides11:42
xnoxhttp://paste.ubuntu.com/24548405/11:42
xnoxright, and kernel is free to change that.11:42
apwthey are _likley_ to be in the order of the ACPI table11:42
xnoxand current driver does HISI00C2 and HISI00C1, and my guess is that one cannot have two HISI00C2 things defined in the acpi table....11:43
apwyou can and they do11:43
apwlook at ETH6 in the table11:43
xnoxi see.11:45
apwbut the order of teh HISI00C2:nn is in the order of teh acpi table11:46
apwif that order has meaning, and it may in thie case and not otheres11:46
xnoxbut the ETH* names are unique, and have one-to-one mapping with ae-handle + port-idx-in-ae11:46
xnoxi wish networking was actual files in /dev/ such that i would be able to have symlinks to name the same thing in multiple ways, just like we do for hard drivers.11:47
xnoxand then create symlinks by-acpi-name, by-acpi-order, by-ae-hand-port-idx-in-ae11:48
xnoxet.c11:48
xnoxok. here comes a patch.11:49
apwxnox, but none of the fact they are 1:1 mappings tels you the intent of the table writer, they may have chosen the numbers randomly because "noone uses those"11:51
apwxnox, and just because teh writer of this table did one thing, the writer of the next may have done another11:51
apwxnox, which is why i don't think you can generically map them for any other table than this one11:52
xnox..... it will be annoying if they randomly change those names.11:52
xnoxdoes the  driver make up the HISI00C2:01 name?11:53
xnoxi thought it did. In that case if driver breaks ordering, i can blame them =)11:53
apwthat is acpi i believe, it is the first one of those it found and allocated11:54
apwwhich i believe means they are in table order, assuming we do not ever11:54
xnoxparallelise that11:54
apwchange to doing that in another order or parallel or ...11:54
apwyou have no information which is reliable full stop11:55
apweither you believe the table or you don't11:55
xnoxor acpi should export order in sysfs somehow, which is bonkers.11:55
xnoxright, so. i will go with using 4501 names11:55
apwbut the table order is just as likely to change as the names in teh Device(NNN) stanza11:55
apwin the sense they could change it.11:56
xnoxi care that (a) systems with the same firmware (b) across reboots (c) get the same names11:56
apwso you have to pick one, either you enumerate them in order they appear in the table, or by the names they use in the table11:56
xnoxack.11:56
apwand if they randomly change those they will piss off their users11:56
xnoxif there is different SKU, i don't chagne.11:56
xnoxif there is different SKU, i don't care.11:56
apwbut the same firmware does not mean the same device for all time11:57
apwas they can change that table and reboot, so ... you have to hope11:57
xnoxand if kernel parallelises ACPI probing, it better give order hints when it calls and/or executes probes; or i will complain to the vendor to expose the acpi table order as a sysfs attribute.11:57
apwthey will not change whichever key you chose11:57
xnoxapw, digging into code. Udev already does ID_PATH and ID_PATH_TAG which are12:32
xnoxE: ID_PATH=platform-HISI00C2:0012:32
xnoxE: ID_PATH_TAG=platform-HISI00C2_0012:32
xnoxbut these are not set as ID_NET_NAME_PATH12:32
xnoxi wonder if I can somehow enumerate _all_ platform nics, and have a table in udev to shortify the HISI00C things.12:33
=== dasjoe_ is now known as dasjoe
=== klebers_ is now known as klebers
xnoxapw, in the /devices/LNXSYSTM:00/LNXSYBUS:00/HISI00C2:01 what does the :01 mean? acpi probe order number, or the hns-net driver sequence number? cause hns-net driver handlees both HISI00C1 and HISI00C215:21
xnoxand i am wondering if i will get:15:21
xnoxHISI00C1:015:21
xnoxHISI00C2:015:21
xnoxor if i will get15:21
xnoxHISI00C1:015:22
xnoxHISI00C2:115:22
xnoxetc.15:22
xnoxcause in former case my names will get uglier: enahc1d015:23
apwxnox, do you have a dmesg ?  or can i get on that box ...15:27
xnoxapw, cause i want to name all of these using this scheme http://paste.ubuntu.com/24549370/15:33
xnox<en> <a> <short vendor> <short product> <probe number> 15:34
xnoxenahc2015:34
xnoxenahc2115:34
xnoxenahc2215:34
xnoxenahc2315:34
xnoxfor our case.15:35
apwxnox, from what i can see we are using instance numbers within that HISI00C2 bus_id15:36
apwwhich means you will get HISI00C2:0 and HISI00C1:015:36
xnoxack.15:36
xnoxso i should use "instance" variable name as well. if that makes sense.15:37
xnox=( if system is booted without ACPI and with device tree, my interface names will not work anymore.15:39
xnoxi wish i could generate the same names for these, irrespective if it was booted with devicetree or the ACPI15:39
xnox...15:41
xnoxi am wondering if i am in fact on the platform bus:15:41
xnox/sys/bus/platform/devices/HISI00C215:41
apwthere is the concept of companion devices in acpi so you may be on both15:42
apwon acpi and on whereever you are actuall15:42
xnoxright. i wonder what syspath udev will return me, and i will go from there.15:43
apwxnox, variously all of them probabally15:59
=== ejat_ is now known as ejat
=== cachio is now known as cachio_afk
=== cachio_afk is now known as cachio
=== henrix_ is now known as henrix

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!