Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Aug 2017 07:59:03 -0700
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-drivers@freebsd.org
Subject:   Re: Driver crash detaches entire PCI bus?
Message-ID:  <3743762.5XtXr8DZrt@ralph.baldwin.cx>
In-Reply-To: <CAFd4kYCNBpBDRZwcERfWA7qB30Jg3VAEUsKD5sU71HQyNjOLrQ@mail.gmail.com>
References:  <CAFd4kYCNBpBDRZwcERfWA7qB30Jg3VAEUsKD5sU71HQyNjOLrQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, August 03, 2017 09:52:54 PM Farhan Khan wrote:
> Hi all, I am trying to write the Realtek 8188e (pci) driver for FreeBSD. I
> am
> making slow incremental progress, and having the driver safely exit out (as
> opposed to a segfault). I noticed that when the device detaches, due to an
> error
> in the driver, the entire pci bus will also detach! For example, here is my
> kernel output:
> 
> rtwn0: rtwn_load_firmware: failed to upload firmware rtwn-rtl8188eefw
> (error 60)
> rtwn0: detached
> pci2: detached
> 
> The first line is where the code crashes: sys/dev/rtwn/if_rtwn_fw.c line 129
> https://github.com/khanzf/freebsd/blob/103c05369b1ced770a2cadc9468e0134c8d9421b/sys/dev/rtwn/if_rtwn_fw.c#L129
> 
> Why would this result in the entire pci2 bus detatching? Strangely enough,
> I did
> not have this problem a few months ago, then it suddenly began. This is
> significantly slowing down my workflow, and would be nice to have it
> resolved.
> Otherwise, I have to reboot to bring pci2 back up.

You should be able to 'devctl attach pci2' I think without having to reboot.

I would perhaps use dtrace to figure out why the PCI bus is detaching by just
doing something like 'dtrace -n 'fbt::pci_detach:entry { stack(); }' to get
a stack trace when pci_detach is called.  We might be able to figure out the
bug from there.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3743762.5XtXr8DZrt>