How are modules assigned? And how would you troubleshoot modules?

Recently I had a problem with my wifi adapter, where the solution was to blacklist ideapad_laptop in the file /etc/modprobe.d/blacklist.conf.

That got me wondering how the modules are assigned. My laptop is not an Ideapad, and the wifi adapter is a Realtek Semiconductor Co., Ltd. RTL8111/8168/8411. How would I ever have guessed that? Beyond that, lets say I do lsmod and get my list of drivers (modules).

...
coretemp               16384  0
joydev                 24576  0
kvm_intel             204800  0
snd_seq_midi           16384  0
snd_seq_midi_event     16384  1 snd_seq_midi
snd_rawmidi            32768  1 snd_seq_midi
kvm                   593920  1 kvm_intel
bnep                   20480  2
hid_multitouch         20480  0
8250_dw                16384  0
irqbypass              16384  1 kvm
snd_seq                65536  2 snd_seq_midi_event,snd_seq_midi
crct10dif_pclmul       16384  0
crc32_pclmul           16384  0
snd_seq_device         16384  3 snd_seq,snd_rawmidi,snd_seq_midi
ghash_clmulni_intel    16384  0
intel_wmi_thunderbolt    16384  0
wmi_bmof               16384  0
arc4                   16384  2
snd_timer              32768  2 snd_seq,snd_pcm
pcbc                   16384  0
uvcvideo               86016  0
...

A friend of mine has an HP laptop, with the same Realtek wireless adapter as I have, and his wifi is also not working. could he blacklist ideapad_lenovo and get the same result? I would guess not.

How would someone find a kernel module that is causing problems?


I think it should work fine.

My understanding is that the hardware has some identifiers (like the model name), and the kernel mainains a lookup database to find potential modules. This will inevitably result in several relatively compatible modules, and the kernel goes with the first one (until it fails), then tries the next one, etc.

Blacklisting tells it to skip specific modules. But you shouldn't need to do this unless there is a reason you don't want to use it (examples: issues, performance. etc.)

So yes, it should work fine.