Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Feb 2014 18:00:57 -0800
From:      Adrian Chadd <adrian@freebsd.org>
To:        John Baldwin <jhb@freebsd.org>
Cc:        freebsd-current <freebsd-current@freebsd.org>, "freebsd-mobile@freebsd.org" <freebsd-mobile@freebsd.org>
Subject:   Re: signal 8 (floating point exception) upon resume
Message-ID:  <CAJ-Vmon-OpV17-5TOh=V7%2B93=%2BjMkP54qBWWvsSjZM4-FU0BVg@mail.gmail.com>
In-Reply-To: <CAJ-Vmom8fL45WAff9fWXP49WBf7mpKMK%2BHcACPtW4=sRQwF5iw@mail.gmail.com>
References:  <CAJ-Vmo=29BUP7JREe%2BK%2B8zOZNVt2LttjTB2byB0AA2jnCKnPSw@mail.gmail.com> <201402281608.30515.jhb@freebsd.org> <CAJ-Vmom8fL45WAff9fWXP49WBf7mpKMK%2BHcACPtW4=sRQwF5iw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 28 February 2014 15:35, Adrian Chadd <adrian@freebsd.org> wrote:
> ... how'd this ever work in the past then?
>

.. and I've submitted it as a PR:

kern/187152

Thanks,


-a


>
> -a
>
>
> On 28 February 2014 13:08, John Baldwin <jhb@freebsd.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmon-OpV17-5TOh=V7%2B93=%2BjMkP54qBWWvsSjZM4-FU0BVg>