Received: by mail.netbsd.org (Postfix, from userid 605) id AC32B84EEE; Tue, 15 Feb 2022 18:14:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 102E184EDC for ; Tue, 15 Feb 2022 18:14:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id wDgqtbT20g4s for ; Tue, 15 Feb 2022 18:14:18 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 5DC1284D4E for ; Tue, 15 Feb 2022 18:14:18 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 54636FB24; Tue, 15 Feb 2022 18:14:18 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Tue, 15 Feb 2022 18:14:18 +0000 From: "Taylor R Campbell" Subject: CVS commit: src/sys/external/bsd/drm2/dist/drm/i915 To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20220215181418.54636FB24@cvs.NetBSD.org> Sender: source-changes-owner@NetBSD.org List-Id: Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "Taylor R Campbell" Mail-Followup-To: source-changes-d@NetBSD.org List-Unsubscribe: Module Name: src Committed By: riastradh Date: Tue Feb 15 18:14:18 UTC 2022 Modified Files: src/sys/external/bsd/drm2/dist/drm/i915: i915_active.c Log Message: Revert "i915: Defer final wakeup on active until after retirement." This reverts i915_active.c 1.11. ref->retire might free the object, so touching it is not allowed -- that would use-after-free. Linux uses the object only for its address with wake_up_var. The reason I made this change was that I guessed i915_active_wait has to wait until after ref->retire finishes -- after all, Linux seems to defer the wakeup until then. However, even the Linux code doesn't guarantee this, because i915_active_wait could be called _during_ ref->retire, and would witness ref->count == 0, and would not wait until it has completed in that case. So maybe my guess was wrong, and it is OK for i915_active_wait to return while ref->retire is still in flight -- I don't see any logic that obviously requires it to wait for ref->retire, in any case. Or maybe something does rely on i915_active_wait to wait for ref->retire to finish, in which case we need a different mechanism for i915_active_release itself to wait until i915_active_retire has woken up, without dereferencing ref since it might be dead after ref->retire. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.