Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jan 2021 11:42:22 GMT
From:      myfreeweb <greg@unrelenting.technology>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Emmanuel Vadot <manu@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 11d62b6f31ab - main - linuxkpi: add kernel_fpu_begin/kernel_fpu_end
Message-ID:  <A7AF80F3-3E01-44DD-B1FF-49BAEFCF4C4A@unrelenting.technology>
In-Reply-To: <20210113110826.46fbc900b3c375e7215a8195@bidouilliste.com>
References:  <202101121143.10CBh02x095972@gitrepo.freebsd.org> <X/2hR9Hi3Jhf5ZNs@kib.kiev.ua> <20210113110826.46fbc900b3c375e7215a8195@bidouilliste.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On January 13, 2021 10:08:26 AM UTC, Emmanuel Vadot <manu@bidouilliste=2Ec=
om> wrote:
>On Tue, 12 Jan 2021 15:16:55 +0200
>Konstantin Belousov <kostikbel@gmail=2Ecom> wrote:
>
>> On Tue, Jan 12, 2021 at 11:43:00AM +0000, Emmanuel Vadot wrote:
>> > The branch main has been updated by manu:
>> >=20
>> > URL: https://cgit=2EFreeBSD=2Eorg/src/commit/?id=3D11d62b6f31ab4e99df=
6d0c6c23406b57eaa37f41
>> >=20
>> > commit 11d62b6f31ab4e99df6d0c6c23406b57eaa37f41
>> > Author:     Emmanuel Vadot <manu@FreeBSD=2Eorg>
>> > AuthorDate: 2021-01-12 11:02:38 +0000
>> > Commit:     Emmanuel Vadot <manu@FreeBSD=2Eorg>
>> > CommitDate: 2021-01-12 11:31:00 +0000
>> >=20
>> >     linuxkpi: add kernel_fpu_begin/kernel_fpu_end
>> >    =20
>> >     With newer AMD GPUs (>=3DNavi,Renoir) there is FPU context usage =
in the
>> >     amdgpu driver=2E
>> >     The `kernel_fpu_begin/end` implementations in drm did not even al=
low nested
>> >     begin-end blocks=2E
>>=20
>> Does Linux allow more then one thread to execute kernel_fpu_begin ?
>
> I actually have no idea, adding Greg to cc=2E

Looks like they save the context into the current thread state, so yes? (d=
rm doesn't need that)

Also they seem to do something FPU_KERN_NOCTX like (??) because they disab=
le preemption inside these blocks=2E
(Where does our NOCTX actually store the state?)

Apparently the API shouldn't actually support nesting these sections, beca=
use kernel_fpu_end unconditionally enables preemption=2E But that nesting w=
ould not just panic like it did on our old impl=2E (Indeed in newest linux =
versions there's a WARN on nesting =E2=80=93 only a warning though, not a p=
anic!)
And amdgpu relies on that not panicking=2E

Looks like amdgpu will narrow the FPU sections down now, they are struggli=
ng with FPU stuff upstream too:
https://www=2Espinics=2Enet/lists/kernel/msg3793776=2Ehtml



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A7AF80F3-3E01-44DD-B1FF-49BAEFCF4C4A>