From owner-freebsd-current@FreeBSD.ORG Fri Feb 28 21:32:51 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 292AC1FD; Fri, 28 Feb 2014 21:32:51 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F124B1A9D; Fri, 28 Feb 2014 21:32:50 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 08674B922; Fri, 28 Feb 2014 16:32:50 -0500 (EST) From: John Baldwin To: freebsd-mobile@freebsd.org Subject: Re: signal 8 (floating point exception) upon resume Date: Fri, 28 Feb 2014 16:08:30 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20130906; KDE/4.5.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201402281608.30515.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 28 Feb 2014 16:32:50 -0500 (EST) Cc: Adrian Chadd , freebsd-current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 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: Fri, 28 Feb 2014 21:32:51 -0000 On Friday, February 28, 2014 1:15:45 pm Adrian Chadd wrote: > Hi, > > On my i386 -HEAD laptops (running -HEAD as of last night, but it's > been a problem for a while) I occasionally hit a point where I get an > FPE on _all_ processes upon resume. > > I can still do a clean shutdown through the power-button method, but I > can't do anything else. > > Has anyone seen this before? Does anyone have an inkling of an idea > why I'd be getting FPE's for things like ps and sh? I'm guessing fpcurthread is stale. We should probably be flushing the FPU state on suspend and starting off without any FPU state on resume. Ah, see this bit here in x86/acpica/acpi_wakeup.c: int acpi_sleep_machdep(struct acpi_softc *sc, int state) { ... if (savectx(susppcbs[0])) { #ifdef __amd64__ ctx_fpusave(susppcbs[0]->pcb_fpususpend); #endif ... } Looks like you need to implement ctx_fpusave() for i386. kib@ did it as part of the AVX work, but I wonder if you can just steal the amd64 ctx_fpusave() and have it call npxsave() instead of fpxsave()? Not sure if you'd need it to be in asm as it is on amd64 or if you can do this in C. -- John Baldwin