From owner-freebsd-arm@freebsd.org Tue Aug 23 19:47:19 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0043DBC401B for ; Tue, 23 Aug 2016 19:47:19 +0000 (UTC) (envelope-from freebsdnewbie@freenet.de) Received: from mout2.freenet.de (mout2.freenet.de [IPv6:2001:748:100:40::2:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.freenet.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B8B801CC9 for ; Tue, 23 Aug 2016 19:47:18 +0000 (UTC) (envelope-from freebsdnewbie@freenet.de) Received: from [195.4.92.142] (helo=mjail2.freenet.de) by mout2.freenet.de with esmtpa (ID freebsdnewbie@freenet.de) (port 25) (Exim 4.85 #1) id 1bcHfH-0002QX-Ub; Tue, 23 Aug 2016 21:47:15 +0200 Received: from localhost ([::1]:46177 helo=mjail2.freenet.de) by mjail2.freenet.de with esmtpa (ID freebsdnewbie@freenet.de) (Exim 4.85 #1) id 1bcHfH-0005Dr-QV; Tue, 23 Aug 2016 21:47:15 +0200 Received: from mx4.freenet.de ([195.4.92.14]:50859) by mjail2.freenet.de with esmtpa (ID freebsdnewbie@freenet.de) (Exim 4.85 #1) id 1bcHcA-0002H4-5C; Tue, 23 Aug 2016 21:44:02 +0200 Received: from p5ddd6e18.dip0.t-ipconnect.de ([93.221.110.24]:49432 helo=[192.168.178.88]) by mx4.freenet.de with esmtpsa (ID freebsdnewbie@freenet.de) (TLSv1.2:DHE-RSA-AES128-SHA:128) (port 587) (Exim 4.85 #1) id 1bcHcA-0001zG-0P; Tue, 23 Aug 2016 21:44:02 +0200 Subject: Re: Beaglebone Black PRU driver crash. To: Arne Ehrlich , freebsd-arm@freebsd.org References: From: =?UTF-8?Q?Manuel_St=c3=bchn?= Message-ID: Date: Tue, 23 Aug 2016 21:44:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------20DB9122744A6A3E68BB2D5B" X-Originated-At: 93.221.110.24!49432 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 19:47:19 -0000 This is a multi-part message in MIME format. --------------20DB9122744A6A3E68BB2D5B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit > Hello Everyone, > > I’m currently working on an embedded project using the BBB as a base > platform, and i want do decide if ill go with Linux or freebsd. > After not having much success talking to the BBB PRU using Linux, > ich wanted to give FreeBSD a try and the PRU gets detected (^-^) > sadly the driver panics upon use, and i have no idea how > to debug this. > > i use devel/pructl to load a file and waiting for an PRU interrupt > ( pructl -w ) the binary loaded does not matter, you may use some null > bytes. > to reproduce. > > > FreeBSD beaglebone 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r303880: Tue Aug 9 > 23:54:55 UTC 2016 > root@releng1.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/BEAGLEBONE > arm > > > the pru is detected on boot: > ti_pruss0: mem > 0x4a300000-0x4a37ffff on simplebus0 > > > (kgdb) bt > #0 0xc066c340 in savectx () > #1 0xc03a3038 in doadump () > #2 0xc0245aac in db_dump () > #3 0xc0245854 in db_command () > #4 0xc02455d4 in db_command_loop () > #5 0xc0248894 in db_trap () > #6 0xc03e0a80 in kdb_trap () > #7 0xc066df40 in undefinedinstruction () > #8 0xc06548d4 in exception_exit () > #9 0xc03e0334 in kdb_enter () > #10 0xc03a3264 in vpanic () > #11 0xc03a32b8 in panic () > #12 0xc038acb0 in __mtx_assert () > #13 0xc0363a68 in knlist_add () > #14 0xc0686ec0 in ti_pruss_kqfilter () > #15 0xc02ccf1c in devfs_kqfilter_f () > #16 0xc0361a94 in kqueue_register () > #17 0xc03625dc in kqueue_kevent () > #18 0xc03624c4 in kern_kevent_fp () > #19 0xc03623b4 in kern_kevent () > #20 0xc03621e8 in sys_kevent () > #21 0xc066cbfc in swi_handler () > #22 0xc0654864 in swi_exit () > > sadly i don't have the symbols for this build to dig deeper. > > any ideas what might be the problem? > anyone using the PRU with FreeBDS? > > Greetings, > any help or insights woud be greatly appreciated ;-) > > Arne Hi Arne, the PRU-driver did work for me some time ago. Because I'd been using a CURRENT without options INVARIANTS/WITNESS, mtx_assert() did not cause a panic. Please try the (untested) patch attached. Manuel --------------20DB9122744A6A3E68BB2D5B Content-Type: text/x-patch; name="ti_pruss.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ti_pruss.c.diff" diff --git a/sys/arm/ti/ti_pruss.c b/sys/arm/ti/ti_pruss.c index 94cea60..97f3977 100644 --- a/sys/arm/ti/ti_pruss.c +++ b/sys/arm/ti/ti_pruss.c @@ -310,7 +310,9 @@ ti_pruss_kqfilter(struct cdev *cdev, struct knote *kn) case EVFILT_READ: kn->kn_hook = sc; kn->kn_fop = &ti_pruss_kq_read; + mtx_lock( &sc->sc_mtx ); knlist_add(&sc->sc_selinfo.si_note, kn, 1); + mtx_unlock( &sc->sc_mtx ); break; default: return (EINVAL); --------------20DB9122744A6A3E68BB2D5B--