4 ms·
> > Out of curiosity, how did you come up with this solution? > The author, dkozel, never came back to answer. I imagine they typed the solution on a 40% keybo
by cryptonector 4y ago
> > Out of curiosity, how did you come up with this solution?
> The author, dkozel, never came back to answer. I imagine they typed the solution on a 40% keyboard featuring unmarked keys and then rolled into the sunset on a Segway for which they had compiled the kernel themselves. Completely oblivious of their awesomeness and of how many people would later find solace in their prose.
Here's how I would have started to find the answer:
1. Open https://lxr.linux.no/, search for
"No bus number available for hot-added bridge"
2. Open the three files it finds.
3. ^F that same string in each file, then notice
that
https://lxr.linux.no/#linux+v6.0.9/drivers/pci/probe.c#L3336
is it.
4. Chase down `dev->bus->busn_ref->end`.
Er, well, this step is hard because `end` is
so generic.
5. git clone linux and use cscope to index it.
6. Search for assignments to `end`, filtering with
egrep for bus and pci.
7. Weed through it all until I find
https://lxr.linux.no/#linux+v6.0.9/drivers/pci/probe.c#L2964
8. Search for assignments to `pci_hotplug_bus_size`, find
https://lxr.linux.no/#linux+v6.0.9/drivers/pci/pci.c#L6882
9. Search for `pci_hotplug_bus_size` and also find
https://lxr.linux.no/#linux+v6.0.9/Documentation/admin-guide/kernel-parameters.txt#L4267
which says:
hpbussize=nn The minimum amount of additional bus numbers
reserved for buses below a hotplug bridge.
Default is 1.
But @dkozel probably just knew the answer.
I do find it hard to believe that the default for this setting is 1 though!
- mmastrac 4y agoDoes this just mean that they added 51 additional bus numbers? I am curious if the kernel could just bump this number up, especially if Thunderbolt is getting more popular.
- deleted 4y ago[deleted]
- julianeon 4y agoI doubt you need the work but, man, you'd make a dream Integration engineer. Like on a scale of 1 to 1,000 you sound like a perfect 1000.
- cryptonector 4y agoI mean, this is... basic stuff. Well, ok, one has to learn to navigate enormous codebases, but then when one has, this sort of thing is easy. I'm not a genius! And this skill can be taught and learned, and nothing helps like actually doing it. There was a time when I had no clue, you know. Your mention of integration does bring back some memories of a bank I worked at where we had source code to proprietary operating systems, and it was sooo useful to a) debug things, b) find undocumented things and ways to work around bugs and limiations, and I was pretty much the only one using that source code. At the time I didn't really understand that (b) is risky, but I managed not to get burned. That was how I started learning how to navigate huge codebases.
- Arnavion 4y agohttps://sourcegraph.com/github.com/torvalds/linux https://sourcegraph.com/github.com/torvalds/linux is a more featured search engine with limited go-to-definition functionality, and removes the need to clone locally and search in many cases. Can be used with any GitHub repo. Just make sure to first enable "case sensitivity" and "structural search" using the buttons in the right of the search textbox so that the search is exact (which is a task that GitHub's own search fails at).
- judahmeek 4y agoThanks for this!
- cryptonector 4y agoAh yes, I tend to forget. What happens is that as soon as I'm looking for "assignments to..." I just reach for cscope (well, where the language is supported by cscope).