From owner-freebsd-hackers@freebsd.org Sun Dec 4 19:53:23 2016 Return-Path: Delivered-To: freebsd-hackers@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 CA4AAC67C2F for ; Sun, 4 Dec 2016 19:53:23 +0000 (UTC) (envelope-from embaudarm@gmail.com) Received: from mail-qk0-x22a.google.com (mail-qk0-x22a.google.com [IPv6:2607:f8b0:400d:c09::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 852BC16EB for ; Sun, 4 Dec 2016 19:53:23 +0000 (UTC) (envelope-from embaudarm@gmail.com) Received: by mail-qk0-x22a.google.com with SMTP id x190so327715129qkb.0 for ; Sun, 04 Dec 2016 11:53:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=80nEEhl/bMk9Xp6uUDfSXn9YyJaOgkD0vkFVRV/FVFo=; b=XttLWLFdSoKLZifrZk48aZSkYflG69RF1CuBDkeSGD++z1iH76QqQO9CLJsdew95/C CENEHAdKnJ+8ZvTETYyqMrc4C26tS6sf2AgdigTWhFNNlC9Kxvn84FjkzQoBshTWq3Sb yRXlVHdC1oS087jTxzaqvbQifzJtLS3sKVME8PCHsW4LuniiIcxIg3cWDYwxz3chjYPF /FtYldCucwzudxRBb0M3rK9OwYtgFZTos5ihKg1DZuE/BY17ZOIRJkzW8y6j2FZVYlj3 n/a++D5el9yu6uah+nHbcw6W4Pun8EbeJt/nqAsjENCvKU6GxLr2ioI8SOWwuRwVGjoX J/JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=80nEEhl/bMk9Xp6uUDfSXn9YyJaOgkD0vkFVRV/FVFo=; b=ieUtAxQkUYyiBqSEbDu+OfvFRcsa+3IwVnJEzZLYs+5dRAh4FTrtMq7FYHVuE1w/Kg Ct4GY/f8Gel8VQQJ/c4XAGQ5tHvui1yDxoCo0+z7Ge9smNR4jBI9RFLjH6rlu+rZHMnH q9ZNxpv2beCp0MB6NxliGWVRBpkYqzSv3jSMxM8HOtJsZj8ERJ3FQy9Pz9Jtr3bJesKO 4X5aeyJ/bg7P9a7et7gSJY2hGaYrpwBaisn934q6kDZgw0SiPDEnF5wMn9A6eo2hcfrn UZjkPNQuhpJ36WlRnktB/NAeoicLbJuyZ4SqOqNFDj3gBIzqAV/8Opyq28hBQvVj1sco ireg== X-Gm-Message-State: AKaTC01VDwI3ouJNUja7RTKzRo9Q0kIPy5fSYlyCbIv3G3toNZRPW3LJPzHnlxJZEowGCiki+qMnobH4m1yp8w== X-Received: by 10.55.163.134 with SMTP id m128mr53074034qke.180.1480881202534; Sun, 04 Dec 2016 11:53:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.54.225 with HTTP; Sun, 4 Dec 2016 11:52:42 -0800 (PST) In-Reply-To: <85666618-B6A5-4577-86B9-914DEDE84ACD@bluezbox.com> References: <85666618-B6A5-4577-86B9-914DEDE84ACD@bluezbox.com> From: Lee D Date: Sun, 4 Dec 2016 14:52:42 -0500 Message-ID: Subject: Re: Please help me understand "Translation Fault" in custom device drivers, and how to debug To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2016 19:53:23 -0000 On Sun, Dec 4, 2016 at 2:13 PM, Oleksandr Tymoshenko wrote: > > > On Dec 4, 2016, at 10:32 AM, Lee D wrote: > > > > Hello, > > > > I need help understanding what a translation fault is, and how to debug > > it. I have googled like crazy but can't seem to find any detailed > > information. > > > > I am working on an embedded system using an ARM processor, and > consequently > > am writing a bunch of device device drivers for my custom hardware. > > > > I am having a problem with occasional crashes when kldload'ing my modul= es > > in a boot script. I get various errors, including "Translation Fault" > (L1 > > or L2), "Alignment Fault", "vm_fault", and "undefined instruction in > > kernel". My code works 95% of the time though. > > > > I never see any crashes while running, so I don't think this is a flaky > > hardware problem. > > > > Any suggestions on what kernel debugger commands to enter to gather > > information would also be helpful. Here are the commands I am currentl= y > > recording the output of when I get a crash: > > > > db> bt > > db> ps > > db> show intr > > db> show proc 618 > > db> show allpcpu > > db> show allrman > > db> show intrcnt > > db> show proc > > db> show procvm > > > > For a single concrete example, here is a backtrace of a device driver > that > > failed with a translation fault on kldload. This BT is unique in that = it > > actually seems to contain useful information. Most of the backtraces > just > > show some abort/exeception related calls and then say "Unable to unwind > > into user space" (paraphrased), leaving me no info about where my crash > > happened. > > > > FreeBSD 10.3 > > Hi Lee, > > Random crashes during kldload sounds like missing or incomplete icache > sync to me. You can take a look at icache-realted fixes in HEAD=E2=80=99s= sys/arm > and try to backport them to 10.3. Oleksandr, Thanks, I will take a look. Maybe moving to 11.0 is the best thing to do. But I'm only seeing crashes in a couple my modules, not all of them and not anything I didn't write. And (seemingly) only when they are started from a script in /etc/rc,d/ at boot time. Clearly I've messed something up. Lee