From owner-dev-commits-src-all@freebsd.org Wed Jan 13 11:42:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CC2B4D9932; Wed, 13 Jan 2021 11:42:26 +0000 (UTC) (envelope-from greg@unrelenting.technology) Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DG5CP356qz4Xxf; Wed, 13 Jan 2021 11:42:25 +0000 (UTC) (envelope-from greg@unrelenting.technology) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unrelenting.technology; s=default; t=1610538142; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J3m2mgrv7C7oQ52laIwJhP6ZVuT3ZJuYveyYX9ZRFlw=; b=dfjTkwOeFhRMTEw2rAOoktqPm++GZxO0I7gonQ7boFHNz+F4ZBKPbVzDN4Gip+VBkMuykf YUe0pvIQPOwLF2v0PYBIw3xEM7YzDV1jPIkiVBaYvlcfd8WPgBCEHP0Q7awSeVCiStxz1I dfZwrDviqm2mebPV2F+/8bOyhyUtyDc= From: myfreeweb To: Konstantin Belousov CC: Emmanuel Vadot , 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 In-Reply-To: <20210113110826.46fbc900b3c375e7215a8195@bidouilliste.com> References: <202101121143.10CBh02x095972@gitrepo.freebsd.org> <20210113110826.46fbc900b3c375e7215a8195@bidouilliste.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: greg@unrelenting.technology Date: Wed, 13 Jan 2021 11:42:22 GMT X-Rspamd-Queue-Id: 4DG5CP356qz4Xxf X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=unrelenting.technology header.s=default header.b=dfjTkwOe; dmarc=pass (policy=none) header.from=unrelenting.technology; spf=pass (mx1.freebsd.org: domain of greg@unrelenting.technology designates 94.23.1.103 as permitted sender) smtp.mailfrom=greg@unrelenting.technology X-Spamd-Result: default: False [-4.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[unrelenting.technology:s=default]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:94.23.1.103]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[unrelenting.technology:+]; DMARC_POLICY_ALLOW(-0.50)[unrelenting.technology,none]; RCVD_IN_DNSWL_NONE(0.00)[94.23.1.103:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RWL_MAILSPIKE_VERYGOOD(0.00)[94.23.1.103:from]; ASN(0.00)[asn:16276, ipnet:94.23.0.0/16, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jan 2021 11:42:26 -0000 On January 13, 2021 10:08:26 AM UTC, Emmanuel Vadot wrote: >On Tue, 12 Jan 2021 15:16:55 +0200 >Konstantin Belousov 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 >> > AuthorDate: 2021-01-12 11:02:38 +0000 >> > Commit: Emmanuel Vadot >> > 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