From nobody Fri Jan 31 20:02:36 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Yl6JD5l8tz5mygw; Fri, 31 Jan 2025 20:02:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yl6JD06KXz3NqJ; Fri, 31 Jan 2025 20:02:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 50VK2aFh086304; Fri, 31 Jan 2025 22:02:39 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 50VK2aFh086304 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 50VK2aIV086302; Fri, 31 Jan 2025 22:02:36 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 31 Jan 2025 22:02:36 +0200 From: Konstantin Belousov To: =?utf-8?Q?Jean-S=C3=A9bastienP=C3=A9dron?= Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: e5764cf07588 - main - linuxkpi: Don't destroy the mutex in `xa_destroy()` Message-ID: References: <202501311603.50VG3RTR039058@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202501311603.50VG3RTR039058@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Queue-Id: 4Yl6JD06KXz3NqJ X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Fri, Jan 31, 2025 at 04:03:27PM +0000, Jean-SébastienPédron wrote: > The branch main has been updated by dumbbell: > > URL: https://cgit.FreeBSD.org/src/commit/?id=e5764cf0758855e2d5a9ebab6d6addc6eaccd56e > > commit e5764cf0758855e2d5a9ebab6d6addc6eaccd56e > Author: Jean-Sébastien Pédron > AuthorDate: 2025-01-21 22:54:51 +0000 > Commit: Jean-Sébastien Pédron > CommitDate: 2025-01-31 16:00:50 +0000 > > linuxkpi: Don't destroy the mutex in `xa_destroy()` > > [Why] > The mutex initialized in `xa_init_flags()` is not destroyed here on > purpose. The reason is that on Linux, the xarray remains usable after a > call to `xa_destroy()`. For instance the i915 DRM driver relies on that > during the initialixation of its GuC. Basically, `xa_destroy()` "resets" > the structure to zero but doesn't really destroy it. > > Reviewed by: manu > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D48762 > --- > sys/compat/linuxkpi/common/src/linux_xarray.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/sys/compat/linuxkpi/common/src/linux_xarray.c b/sys/compat/linuxkpi/common/src/linux_xarray.c > index 54c536042392..3f07f6d7c59f 100644 > --- a/sys/compat/linuxkpi/common/src/linux_xarray.c > +++ b/sys/compat/linuxkpi/common/src/linux_xarray.c > @@ -362,9 +362,19 @@ xa_destroy(struct xarray *xa) > struct radix_tree_iter iter; > void **ppslot; > > + xa_lock(xa); > radix_tree_for_each_slot(ppslot, &xa->xa_head, &iter, 0) > radix_tree_iter_delete(&xa->xa_head, &iter, ppslot); > - mtx_destroy(&xa->xa_lock); > + xa_unlock(xa); > + > + /* > + * The mutex initialized in `xa_init_flags()` is not destroyed here on > + * purpose. The reason is that on Linux, the xarray remains usable > + * after a call to `xa_destroy()`. For instance the i915 DRM driver > + * relies on that during the initialixation of its GuC. Basically, > + * `xa_destroy()` "resets" the structure to zero but doesn't really > + * destroy it. > + */ > } > > /* Was this tested with WITNESS and unloading a module that created xarray? I suspect this situation should result in panic/page fault.