Date: Thu, 22 Apr 2021 14:22:27 +0300 From: Greg V <greg@unrelenting.technology> To: Konstantin Belousov <kostikbel@gmail.com> Cc: John Baldwin <jhb@freebsd.org>, 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: =?UTF-8?Q?add=0D=0A?= kernel_fpu_begin/kernel_fpu_end Message-ID: <F9QYRQ.VOU4KGD1FDGP2@unrelenting.technology> In-Reply-To: <YIFNm8S3oFFrJNTM@kib.kiev.ua> References: <202101121143.10CBh02x095972@gitrepo.freebsd.org> <X/2hR9Hi3Jhf5ZNs@kib.kiev.ua> <20210113110826.46fbc900b3c375e7215a8195@bidouilliste.com> <A7AF80F3-3E01-44DD-B1FF-49BAEFCF4C4A@unrelenting.technology> <ce860007-4c19-8fb2-05b9-9b9e1bcc0723@FreeBSD.org> <171B7072-9BAE-46BB-82BA-4792AEBAD0EB@unrelenting.technology> <X/%2BrI2QGxMOANgpL@kib.kiev.ua> <YIFNm8S3oFFrJNTM@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 22, 2021 at 13:19, Konstantin Belousov=20 <kostikbel@gmail.com> wrote: > On Thu, Jan 14, 2021 at 04:23:31AM +0200, Konstantin Belousov wrote: >> On Thu, Jan 14, 2021 at 01:36:27AM +0000, myfreeweb wrote: >> > >> > >> > On January 13, 2021 8:58:58 PM UTC, John Baldwin=20 >> <jhb@FreeBSD.org> wrote: >> > >It doesn't store at all because threads aren't allowed to sleep=20 >> in a critical >> > >section, so the thread will never give up the CPU while in the=20 >> FPU section. If >> > >threads can voluntarily sleep (cv_wait*, *sleep(), etc.) while=20 >> using >> > >kernel_fpu_begin(), then NOCTX won't work and we will need=20 >> something else. >> > >> > Hmm but with no storage at all, how would it work from a syscall? >> > The manpage does mention a "usermode save area" =96 I was talking=20 >> about that. >> There is a storage for the user state, always. When NOCTX is used,=20 >> FPU state >> is spilled into the _current_ save area, and then kernel lives to=20 >> the promise >> that the new state after fpu_enter(NOCTX) does not ever need to be=20 >> saved. >>=20 >> > >> > Linux kernel_fpu_begin starts with preempt_disable, so definitely=20 >> no condvars and the like. No idea about simple time sleeps. But=20 >> amdgpu doesn't seem to do even that. >>=20 >> You should get enough assertions fired if something tries to=20 >> context switch >> while entered NOCTX region. >=20 > So this went dead in the mail, and kernel still contains that awful=20 > code > that corrupts both userspace and kernel FPU contexts. >=20 > I suggest to remove this file at all, since things are not being=20 > sorted. Okay, let's try NOCTX: https://reviews.freebsd.org/D29921 I don't understand how using a full fpu_kern_ctx can *corrupt* anything=20 though? It should only be extra overhead?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F9QYRQ.VOU4KGD1FDGP2>