From owner-freebsd-mobile@FreeBSD.ORG Fri Feb 28 23:35:15 2014 Return-Path: Delivered-To: freebsd-mobile@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 6FCAABCD; Fri, 28 Feb 2014 23:35:15 +0000 (UTC) Received: from mail-qc0-x22c.google.com (mail-qc0-x22c.google.com [IPv6:2607:f8b0:400d:c01::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0873E15DA; Fri, 28 Feb 2014 23:35:14 +0000 (UTC) Received: by mail-qc0-f172.google.com with SMTP id i8so1592159qcq.3 for ; Fri, 28 Feb 2014 15:35:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=GCqChJJcd0na7bGTp6ad6O8+6H8c+k/Y8ynAfjZaWOg=; b=h5BSDnmSB65sL3pGolF1eJoNhTCIeHXzFFcYbKTqJN86G8i47eL+wwnxmjiYMY5XEX sSfdOGaU0RgaRtSPTTAJtuxrvgBS6GNeSeU31RUomVzHrU3UTdTI7fLkRNSysfxH8Tat rKLGfP51kIqLibEZZJd2dhr2aIotyD+0QbTc25tFKIsz9SG3O6Rd3MHzQ3hS+9AlYIeo sla9N/KU6bEUO4tNJ8Cti8qirzI3igPbzX6iVh7COpTkoboew9lzjL+Np/3LyDSSdlnN 6t092pIvf+cbURs+YrRQB+rbbvzmYYKgW8HFJlwFnac1JQFnC0rZL+f5PvESt+M73dYS bYZA== MIME-Version: 1.0 X-Received: by 10.224.60.134 with SMTP id p6mr7530031qah.98.1393630514225; Fri, 28 Feb 2014 15:35:14 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.16.10 with HTTP; Fri, 28 Feb 2014 15:35:14 -0800 (PST) In-Reply-To: <201402281608.30515.jhb@freebsd.org> References: <201402281608.30515.jhb@freebsd.org> Date: Fri, 28 Feb 2014 15:35:14 -0800 X-Google-Sender-Auth: 938haiEQYUlCEqOSfTYczQjeIoE Message-ID: Subject: Re: signal 8 (floating point exception) upon resume From: Adrian Chadd To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-current , "freebsd-mobile@freebsd.org" X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Feb 2014 23:35:15 -0000 ... how'd this ever work in the past then? -a On 28 February 2014 13:08, John Baldwin wrote: > 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