From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D094CA1005 for ; Mon, 1 Sep 2025 10:41:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B588B10E41B; Mon, 1 Sep 2025 10:41:19 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="WnzzFHsC"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D95F10E41B; Mon, 1 Sep 2025 10:41:18 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 2C83041A91; Mon, 1 Sep 2025 10:41:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E5BFC4CEF0; Mon, 1 Sep 2025 10:41:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756723278; bh=yFIa/AwwszfMyv5NWD+c3BguAhI507kItLPHy2Owv/k=; h=Date:Subject:Cc:To:From:References:In-Reply-To:From; b=WnzzFHsC9cyub01CpDw7RUegQBEBQ72gB/21sGdXg2S5g0Zi8iDiYI9D4e/B6yDhm VvsUQ9RWKRMux5EcXAcZyfEIoqWTBo8eplc6ResOD9Dye+IwTjL308GuEsn1IPXDYf RyKX5Ut0m8xgqhZWCXwrlSeTQZY1FWojApNvcFmq+cJ5DxiYkTT3XP3YSrRcSTPE0n bNm2yLnZTipBiaCO+rsKYHJ8c2l7JziyJN82pmTICrWJXUPQqp7WFC2ID8HfIvWNbs c0Qb7v8zOafynNuYPgqUcKXSezzqh8PqYitga2fjPUsMnR9iNFcr4/AGullHVs6+E/ NE1oF86re3zLw== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 01 Sep 2025 12:41:15 +0200 Message-Id: Subject: Re: [PATCH] gpu: nova-core: take advantage of pci::Device::unbind() Cc: , , "Nouveau" To: "Alexandre Courbot" From: "Danilo Krummrich" References: <20250830133255.62380-1-dakr@kernel.org> In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Sun Aug 31, 2025 at 3:50 PM CEST, Alexandre Courbot wrote: >> + pub(crate) fn unbind(&self, pdev: &pci::Device) { >> + // Unregister the sysmem flush page before we release it. >> + kernel::warn_on!(self.bar.access(pdev.as_ref()).map_or(true, |b= ar| { >> + self.sysmem_flush.unregister(bar); >> + >> + false >> + })); >> + } > > Maybe I'm overtly cautious, but this method can be called from a large > part of the driver, leaving the Gpu device in a half-unbound state. The > `PinnedDrop` approach had the benefit of not allowing this. > > One way to solve the problem would be to make this method `pub(in > crate::driver)`, so other modules cannot call it. pub(in crate::driver) doesn't work, since hierarchically it's a sibling. :( However, I can add a doc-comment to make it a bit more obvious.