From nobody Sat Jun 26 04:58:05 2021 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0FF295D41F0 for ; Sat, 26 Jun 2021 04:58:11 +0000 (UTC) (envelope-from saimabaig11@gmail.com) Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GBhTF61j9z4vPG for ; Sat, 26 Jun 2021 04:58:09 +0000 (UTC) (envelope-from saimabaig11@gmail.com) Received: by mail-pg1-x52b.google.com with SMTP id h4so9980168pgp.5 for ; Fri, 25 Jun 2021 21:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding:thread-index:content-language; bh=EKpW0AtL7FsNpXmvxzfRJ00U9qAdMCuVhJvZfp9aItQ=; b=bB3+Zxw4KjYiYqaCEVX8dp/a7G6LkZSZK9qia+ydkb2BnF0ZPx+z+pwascMNE5DIlX g2uGxAJbZ8pnDv6FeGECgwUiXu/RMm2P1VernzZnz/gT9e746rghBH1sGpqf36nOsDze 6TrHQqja4p+GsdV0a9muS9VSr+Pin/ib4aWmwpIgDwDi9D/4xFnESPsfsMy4dSf/i4ad RjtaNhfPrgc84Npyy80id8pGtTurDOzq/c9Y+53CTfdVc+1ckpOfIptxyhMnRFmmaEoM BFH9o7Qi4dYZOO+yALGR7uKGJkRP+/La+7Djzf56ErRVn+DWWZ59DN3SAMVLL9KfKmxC KzkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding:thread-index:content-language; bh=EKpW0AtL7FsNpXmvxzfRJ00U9qAdMCuVhJvZfp9aItQ=; b=SdAXOAP7XExGUgzZ7yLOK8ftorPF3vgdsnK3aWOQ/2FjyTvHAk3b2i9cqP6vD9gi8J STpwwwKOAyBfcs0BCatQe5S/c9uIjYqAze3R+FhxrwpOpvw37zF5OTxB2USPNBhiXdL2 McHhljwQnHB7mnz7Mvnq7Xr41qpq44DVz70nkzsYLmKhcKwqpfAFhtghK9lLZpdfQ6iW pmDrXG6a8YlxQzEH1lvu9inXTC+c2UrFuZfRoKywR0k7su3bFwk8rCe2r5foNwvTbAgT oKbitLLH9xf4OQr2gsqhpsCZXX8ThaDSyghpNvRwTi7TgQTUC8NzkfcTa7KcLP0FU77v nLrA== X-Gm-Message-State: AOAM533Ykulv/3G9DkwAov3EbT+3CCixCid3Smw4xhPwHJRTzv8oMeuR oFAEVfK/mH1B3X7RwnUNbBTyR+3ofugUrA== X-Google-Smtp-Source: ABdhPJxtt9+d39PdZ9VNsOOMH3udvX7ONbmfK4CtfbDrOBlcEfpmvC+9cAuBzsR8WP9BHYNX8qOlNA== X-Received: by 2002:a63:1c53:: with SMTP id c19mr12555708pgm.332.1624683487817; Fri, 25 Jun 2021 21:58:07 -0700 (PDT) Received: from ABDESKTOP ([103.208.71.171]) by smtp.gmail.com with ESMTPSA id q21sm12295786pjg.43.2021.06.25.21.58.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jun 2021 21:58:07 -0700 (PDT) From: To: Subject: PCI probing in the kernel Date: Sat, 26 Jun 2021 10:28:05 +0530 Message-ID: <003201d76a47$dae98bc0$90bca340$@gmail.com> List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AddqR9l0VrAdZEv4SrGAxQEyaKbqNQ== Content-Language: en-us X-Rspamd-Queue-Id: 4GBhTF61j9z4vPG X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=bB3+Zxw4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of saimabaig11@gmail.com designates 2607:f8b0:4864:20::52b as permitted sender) smtp.mailfrom=saimabaig11@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RECEIVED_SPAMHAUS_PBL(0.00)[103.208.71.171:received]; FROM_EQ_ENVFROM(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::52b:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; MIME_TRACE(0.00)[0:+]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::52b:from:127.0.2.255]; FROM_NO_DN(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::52b:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers] X-ThisMailContainsUnwantedMimeParts: N 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: 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 = 5ee7e000, Length = 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?