Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jun 2021 10:44:58 +0530
From:      <saimabaig11@gmail.com>
To:        "'Warner Losh'" <imp@bsdimp.com>
Cc:        "'FreeBSD Hackers'" <freebsd-hackers@freebsd.org>
Subject:   RE: PCI probing in the kernel
Message-ID:  <004401d76a4a$393dbaf0$abb930d0$@gmail.com>
In-Reply-To: <CANCZdfpKHU2x6gDbcLGTeH7JESyy8OdGD-XZPAb81Mn8vPoh9g@mail.gmail.com>
References:  <003201d76a47$dae98bc0$90bca340$@gmail.com> <CANCZdfpKHU2x6gDbcLGTeH7JESyy8OdGD-XZPAb81Mn8vPoh9g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
It specifically says *em* probing and then it calls the *em_register* =
function repeatedly which is the registration routine that the em driver =
defines as part of its initialization. This is whats confusing me  as to =
why is it repeatedly calling these functions for a specific module =
repeatedly

=20

From: Warner Losh <imp@bsdimp.com>=20
Sent: Saturday, June 26, 2021 10:40 AM
To: saimabaig11@gmail.com
Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject: Re: PCI probing in the kernel

=20

=20

=20

On Fri, Jun 25, 2021 at 10:59 PM <saimabaig11@gmail.com =
<mailto:saimabaig11@gmail.com> > wrote:

My question relates to how does the kernel go about its business of
discovering PCI devices (after boot time) . I am loading the e1000(em)
driver by kldloading the `if_em` module. The kernel seems to be calling =
the
probe routine multiple times. So the log below includes messages coming =
from
the kernel and also includes my own debug logs.



```

Jun 25 11:16:45 FreeBSD12 kernel: em probing

Jun 25 11:16:45 FreeBSD12 syslogd: last message repeated 5 times

Jun 25 11:16:45 FreeBSD12 kernel: em0: +++ Calling em_register

Jun 25 11:16:45 FreeBSD12 kernel: em probing

Jun 25 11:16:45 FreeBSD12 syslogd: last message repeated 5 times

Jun 25 11:16:45 FreeBSD12 kernel: em0: +++ Calling em_register

Jun 25 11:16:45 FreeBSD12 kernel: em probing

Jun 25 11:16:45 FreeBSD12 kernel: em0: +++ Calling em_register

Jun 25 11:16:45 FreeBSD12 kernel: em0: <Intel(R) PRO/1000 Network
Connection> port 0x2000-0x203f mem
0xfd5c0000-0xfd5dffff,0xfdff0000-0xfdffffff irq 19 at device 1.0 on pci2

Jun 25 11:16:45 FreeBSD12 kernel: em attaching

Jun 25 11:16:45 FreeBSD12 kernel: em0: +++ Calling em_register

Jun 25 11:17:34 FreeBSD12 kernel: em0: Using 2048 TX descriptors and =
2048 RX
descriptors

Jun 25 11:17:35 FreeBSD12 kernel: em probing

Jun 25 11:17:35 FreeBSD12 syslogd: last message repeated 5 times

Jun 25 11:17:35 FreeBSD12 kernel: em1: +++ Calling em_register

Jun 25 11:17:35 FreeBSD12 kernel: em probing

Jun 25 11:17:36 FreeBSD12 kernel: Base =3D 5ee7e000, Length =3D 8000

```

It seems that the `probe->register` sequence seems to be getting =
repeated
multiple times until the adapter is identified properly and its =
resources
allocated. Isn't multiple registration a cause of concern? Or may =
something
is wrong with the way I think. May be I am not getting it right? Could
someone elaborate?

=20

When you load a driver, we call probe on all the devices on the bus that =
don't

yet have drivers. I believe you are seeing this. The probe routine tries =
a bunch

of different devices until finding the NIC that doesn't have a driver. =
It's completely

normal and ordinary.

=20

Warner





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?004401d76a4a$393dbaf0$abb930d0$>