From nobody Sat Jun 26 05:09:30 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 79CCF5D6A54 for ; Sat, 26 Jun 2021 05:09:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) (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 4GBhkZ2n0Mz3FHJ for ; Sat, 26 Jun 2021 05:09:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82b.google.com with SMTP id d5so9204041qtd.5 for ; Fri, 25 Jun 2021 22:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YJaG79+bsLvasRKgirBjvG1q1DHNDhao9mX5sNY/xTg=; b=1wJqBIwWIsep5ye19UHPrhMAcqBfqNyzjIP3rxY9n8aVyXA10V4+7w0ZSgnVImPTGt NSETVWeGSlPBJXKWhr62JiEXVzlfVEjPRG6iB47nha4RwzbGEZJl16oOX96XJZrhCvaf 3f4t0lI6hinOtBjSV+YNFpigFH2JgHR/lqL9aQ+H7uxtweeNbry9+UN3xEh5rxT77BDU 6I6M1A1b1HkFh/NRl1VxDkwqSm8H1FDFAM6IpxCMKhIMPlGnDKelZ51ZaA/frbLhUw0s TFeuerXkS3c4hsJkgh8MXEldz3+5pO2QCBnEer746dOb7EWrybmTw1PqH66tN4tKXfkK CTgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YJaG79+bsLvasRKgirBjvG1q1DHNDhao9mX5sNY/xTg=; b=sl6PHAukTmHxVHY1c6yFUqXUoNA/L9yumh9wLlivohjqRvGOOWH61ou6Tg0v7o5+KB 0zvVVEajLnHi9v8yyDI2I835UJK/GHBSiIImal1V+wdk/KvWzyNMbconOd+fqj289KUT iPOUH9yKMzFl8MfeUyAKfhBxcet4/eLvT2hlwudag5v43TJ94TwBWKmEE4+dBMGTRJ0h HTrXMv683lTfr9H2rvPQTMb0GYrTvRVeuQL2zlNPylCGy3H3WIwRh9tCPkrGe6R2W/mq +V6Wc5Qfv6B+Nq2yjWsnTOJzBJ5ngl4TtAFbWckYHnwX68s/egeK87y1xMKldlWt4+zz +Tqg== X-Gm-Message-State: AOAM5333/QKGCXCFG9TQU/6bhEjNBI9FwbbUhN3m9W3ZG/cOXZf45a99 8GDxVgSypzBDPjANQ2FK8syqqc0/LIg2ykwLnM1l7Q== X-Google-Smtp-Source: ABdhPJyJxgnFQ92pGq7sRcnpvurW2e9aeS1sqb1eAK+ELp+2xVbAVPLIHEbBeQ3665neflaZCAwUBsuuDbltFHnMQ7w= X-Received: by 2002:a05:622a:164d:: with SMTP id y13mr12708206qtj.244.1624684181186; Fri, 25 Jun 2021 22:09:41 -0700 (PDT) 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 References: <003201d76a47$dae98bc0$90bca340$@gmail.com> In-Reply-To: <003201d76a47$dae98bc0$90bca340$@gmail.com> From: Warner Losh Date: Fri, 25 Jun 2021 23:09:30 -0600 Message-ID: Subject: Re: PCI probing in the kernel To: saimabaig11@gmail.com Cc: FreeBSD Hackers Content-Type: multipart/alternative; boundary="0000000000007e000305c5a443e4" X-Rspamd-Queue-Id: 4GBhkZ2n0Mz3FHJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: Y --0000000000007e000305c5a443e4 Content-Type: text/plain; charset="UTF-8" On Fri, Jun 25, 2021 at 10:59 PM 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: 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 = 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? > 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. Warner --0000000000007e000305c5a443e4--