From owner-freebsd-current@freebsd.org Mon Jan 1 16:33:29 2018 Return-Path: Delivered-To: freebsd-current@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 3E2DEEB18DF for ; Mon, 1 Jan 2018 16:33:29 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 212C072D24 for ; Mon, 1 Jan 2018 16:33:28 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 73ed8a16-ef11-11e7-8486-0934409070aa X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 73ed8a16-ef11-11e7-8486-0934409070aa; Mon, 01 Jan 2018 16:33:11 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w01GXN8u010569; Mon, 1 Jan 2018 09:33:24 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1514824403.12000.37.camel@freebsd.org> Subject: Re: panic: invalid bcd 194 From: Ian Lepore To: Matthias Apitz , Kurt Jaeger Cc: freebsd-current@freebsd.org Date: Mon, 01 Jan 2018 09:33:23 -0700 In-Reply-To: <20180101091210.GA2591@c720-r314251> References: <20171230210711.GA75976@c720-r314251> <20171230211154.GT1684@kib.kiev.ua> <20171230214819.GA2191@c720-r314251> <20171231083624.GA2175@c720-r314251> <1514740790.12000.20.camel@freebsd.org> <20180101085425.GA2301@c720-r314251> <20180101085723.GM2827@home.opsec.eu> <20180101091210.GA2591@c720-r314251> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jan 2018 16:33:29 -0000 On Mon, 2018-01-01 at 10:12 +0100, Matthias Apitz wrote: > El día lunes, enero 01, 2018 a las 09:57:23a. m. +0100, Kurt Jaeger escribió: > > > > > Hi! > > > > > > > > For the moment we solved the issue by booting some older r28nnnn > > > memstick, writing a correct date with ntpdate into the RTC and rebooted > > > without poweroff. It seems that the RTC survives even some short > > > powercyle. > > > > > > The CMOS battery is soldered on the motherboard of the Acer C720, i.e. > > > no chance to be replaced. > > > > > > The issue must be fixed in FreeBSD, i.e. it should boot even with a > > > broken RTC. Should I file a PR for this? > > Yes, please file a PR. > done. > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224813 > FYI, I'm working on this, but I discovered yesterday afternoon that Eric van Gyzen already added code in r314936 to the atrtc driver to validate the data from the hardware before calling bcd2bin() .  The code looks correct to me, so why is this error still happening? I suspected a clang codegen bug, and the generated code does look a bit suspicious to me (things like ANDing with 0x0e where the C code uses 0x0f), but my x86 asm skills are 25 years out of date.  It's also very hard asm code to follow, because inlined functions that call other inlined functions are involved. I'm on the path of adding some new common routines that all RTC drivers can use to validate the BCD coming from the hardware without panicking.  But if I switch the atrtc code to use the new routines, that may amount to sweeping a clang bug under the rug. -- Ian