Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Aug 2016 21:44:01 +0200
From:      =?UTF-8?Q?Manuel_St=c3=bchn?= <freebsdnewbie@freenet.de>
To:        Arne Ehrlich <inbox@groknet.de>, freebsd-arm@freebsd.org
Subject:   Re: Beaglebone Black PRU driver crash.
Message-ID:  <e83a2b93-2847-29b2-7da3-ba0c64f23279@freenet.de>
In-Reply-To: <CAG5wTg_ofvVh4qhY=Cn=9MVcN6=xCWxYQVKzp0=D1a7ZkS7Udg@mail.gmail.com>
References:  <CAG5wTg_ofvVh4qhY=Cn=9MVcN6=xCWxYQVKzp0=D1a7ZkS7Udg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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: <TI Programmable Realtime Unit Subsystem> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e83a2b93-2847-29b2-7da3-ba0c64f23279>