Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jan 2021 04:23:31 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        myfreeweb <greg@unrelenting.technology>
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: add kernel_fpu_begin/kernel_fpu_end
Message-ID:  <X/%2BrI2QGxMOANgpL@kib.kiev.ua>
In-Reply-To: <171B7072-9BAE-46BB-82BA-4792AEBAD0EB@unrelenting.technology>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 14, 2021 at 01:36:27AM +0000, myfreeweb wrote:
> 
> 
> On January 13, 2021 8:58:58 PM UTC, John Baldwin <jhb@FreeBSD.org> wrote:
> >It doesn't store at all because threads aren't allowed to sleep in a critical
> >section, so the thread will never give up the CPU while in the FPU section.  If
> >threads can voluntarily sleep (cv_wait*, *sleep(), etc.) while using
> >kernel_fpu_begin(), then NOCTX won't work and we will need something else.
> 
> Hmm but with no storage at all, how would it work from a syscall?
> The manpage does mention a "usermode save area" – I was talking about that.
There is a storage for the user state, always.  When NOCTX is used, FPU state
is spilled into the _current_ save area, and then kernel lives to the promise
that the new state after fpu_enter(NOCTX) does not ever need to be saved.

> 
> Linux kernel_fpu_begin starts with preempt_disable, so definitely no condvars and the like. No idea about simple time sleeps. But amdgpu doesn't seem to do even that.

You should get enough assertions fired if something tries to context switch
while entered NOCTX region.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?X/%2BrI2QGxMOANgpL>