From owner-freebsd-arm@freebsd.org Sun Sep 27 18:29:50 2015 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 A694CA0AE92 for ; Sun, 27 Sep 2015 18:29:50 +0000 (UTC) (envelope-from lists.br@gmail.com) Received: from mail-yk0-x236.google.com (mail-yk0-x236.google.com [IPv6:2607:f8b0:4002:c07::236]) (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 6AE4936F for ; Sun, 27 Sep 2015 18:29:50 +0000 (UTC) (envelope-from lists.br@gmail.com) Received: by ykft14 with SMTP id t14so155941326ykf.0 for ; Sun, 27 Sep 2015 11:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=w1hP6RE2XXR3Fe4WEyoiIFOMW4OZBWUT3eqfAFA4/ec=; b=AnEWRhmqqpu2neM5jSWwBWmDfURd9UpA11y7ryAcPpNHyAstPcd/eaMIuawtMPgjmO QqJ2TjMnf3da/PDV39bSYOIkK8j+ohPaOXq/BEQDFmCMBC19+5BBkK/3St8Cll4by9e6 SFoYxuUipJj+huLUldOubjvm9fgXrXdh+o4Q6wvvjDDu+W4kFvRuPNW2SsAo8G8xrq1+ OfoDtXsI5aQmCicGsHhQpOuQhmbem3US3SfAq2Rv+haZDIrxzvF5JCrJHYb3pLD5kTNv 8+YoM6UmSdyl1pzWNAmBDQUc3Kq1HIGrQxKtCyx7yXM2ecMFiDk5XtQbRUfheGd/qF8L SllQ== MIME-Version: 1.0 X-Received: by 10.13.230.71 with SMTP id p68mr13460783ywe.132.1443378589688; Sun, 27 Sep 2015 11:29:49 -0700 (PDT) Received: by 10.129.43.70 with HTTP; Sun, 27 Sep 2015 11:29:49 -0700 (PDT) In-Reply-To: <5607C63D.2010203@kronometrix.org> References: <5607C63D.2010203@kronometrix.org> Date: Sun, 27 Sep 2015 15:29:49 -0300 Message-ID: Subject: Re: RBPI2 ds1307 rtc kernel panic From: Luiz Otavio O Souza To: sparvu@kronometrix.org Cc: "freebsd-arm@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 18:29:50 -0000 On 27 September 2015 at 07:34, Stefan Parvu wrote: > > Im seeing kernel panics after I have compiled support for DS1307 RTC > device on RBPI2 hardware: > > panic: sleepq_add: td 0xc395b000 to sleep on wchan 0xc39fa380 with > sleeping prohibited > > The system here: > > iichb0: mem 0x205000-0x20501f irq 61 on > simplebus0 > iicbus0: on iichb0 > iic0: on iicbus0 > iichb1: mem 0x804000-0x80401f irq 61 on > simplebus0 > iicbus1: on iichb1 > iic1: on iicbus1 > ds13070: at addr 0xd0 on iicbus1 > > > FreeBSD rpi2 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r288098: Thu Aug 20 > 04:00:38 UTC 2015 root@rpi2:/usr/obj/usr/src/sys/KPI2 arm > > > I have compiled the kernel by Vadim's procedure [1] but modified for > RBPI2: bcm2836.dtsi: https://github.com/vzaigrin/ds1307/issues/1 > > Anyone any ideas why the crash ? > Many thanks > > [1] > https://vzaigrin.wordpress.com/2015/08/04/real-time-clock-on-raspberry-pi-with-freebsd-11/ > > -- > Stefan Parvu The crash happens when you enable ntpd with an i2c RTC, this is a know issue. There are two workarounds: 1) sysctl machdep.rtc_save_period=0 2) use gpioiic(4) instead of the hardware i2c controller. gpioiic doesn't sleeps and this will prevent the crash. The setup of gpioiic requires a few more steps, so usually the option 1 is preferred. The crash happens because ntpd tries to update the RTC from a callout and callout functions should not sleep (which happens with most of i2c controllers we support on ARM). Also, I committed the change that includes #address-cells and #size-cells to RPi2 DTS file (bcm2836.dtsi). Thanks Jukka for noticing this. Luiz