From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 009A2606A32F for ; Sat, 5 Dec 2026 06:58:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=UQ/9BjZw Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5AB1610E490; Sat, 5 Dec 2026 06:58:32 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id EBBC110E490 for ; Sat, 5 Dec 2026 06:58:25 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id D4A3A415CA; Sat, 5 Dec 2026 06:58:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9AC61F00936; Sat, 5 Dec 2026 06:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796453905; bh=Us3oKOoXcbxvv9QMiqy5knkbt411xH7VAVAIQN9vu/8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=UQ/9BjZwqVKewOziJeA9jJQ6oXmN3LrnncE0MdIaJlmobkRz+npqHMwpTEyDktVvT uOdhpTAwqBUDzoYhbS8Hc+BP50zQZbbZsvmrW3n/4w7KgHuZCt0j3qrHPxo1aAxfA6 nwmx/Cb61DopTSuMC6P61u0nvQyl9PRnpcfqjHDCLsofllj/iYQtT9YYhfDva/TjZh 5zuBz1VmGOHOg77Q/nt+FFymke3+OpCNvSAFduMrYcmLwgLgclkir1dQHikHbCT8uH M5u4yh/0KrrPt0J0ALEuKzl55imL6NZXq+Ute3JazaeCdVUDWSDGdlej4TA46hh7Js 7AGTNmuzwMxOQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] accel/habanalabs: Fix timestamp record release on reset To: "Praneeth Balasubramanian" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261205063651.2523441-1-praneethb2002@gmail.com> References: <20261205063651.2523441-1-praneethb2002@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 06:58:25 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] accel/habanalabs: inaccurate comment citing unregister_timestamp_node() -- commit 456b437299ee89a714b14ad80b2c00f226137c89 Author: Praneeth Balasubramanian accel/habanalabs: Fix timestamp record release on reset This commit updates wake_pending_user_interrupt_threads() to unlink each pending timestamp record, clear ts_reg_info.in_use, and save the buffer pointers before dropping ts_list_lock to release the timestamp and CQ buffer references. > diff --git a/drivers/accel/habanalabs/common/command_submission.c b/drive= rs/accel/habanalabs/common/command_submission.c > index 8a3febc2089ed..8bff77bf42f89 100644 > --- a/drivers/accel/habanalabs/common/command_submission.c > +++ b/drivers/accel/habanalabs/common/command_submission.c [ ... ] > @@ -1108,10 +1110,24 @@ wake_pending_user_interrupt_threads(struct hl_use= r_interrupt *interrupt) > spin_unlock_irqrestore(&interrupt->wait_list_lock, flags); > =20 > spin_lock_irqsave(&interrupt->ts_list_lock, flags); > - list_for_each_entry_safe(pend, temp, &interrupt->ts_list_head, list_nod= e) { > + while (!list_empty(&interrupt->ts_list_head)) { > + pend =3D list_first_entry(&interrupt->ts_list_head, > + struct hl_user_pending_interrupt, list_node); > + buf =3D pend->ts_reg_info.buf; > + cq_cb =3D pend->ts_reg_info.cq_cb; > list_del(&pend->list_node); > - hl_mmap_mem_buf_put(pend->ts_reg_info.buf); > - hl_cb_put(pend->ts_reg_info.cq_cb); > + pend->ts_reg_info.in_use =3D false; > + spin_unlock_irqrestore(&interrupt->ts_list_lock, flags); > + > + /* > + * As in unregister_timestamp_node(), put the references without > + * the lock: the release may sleep, and it may free the buffer > + * that holds pend. > + */ [Severity: Low] Are this comment and the commit message accurate in saying unregister_timestamp_node() snapshots the pointers and drops ts_list_lock before putting the references? In unregister_timestamp_node(), ts_list_lock is only dropped when need_lock is true (ts_get_and_handle_kernel_record() calls it with need_lock =3D=3D false), and the buffer pointers are read directly from record rather than saved under the lock: drivers/accel/habanalabs/common/command_submission.c:unregister_timestamp_n= ode() { ... if (need_lock) spin_unlock_irqrestore(&interrupt->ts_list_lock, flags); /* Put refcounts that were taken when we registered the event */ if (ts_rec_found) { hl_mmap_mem_buf_put(record->ts_reg_info.buf); hl_cb_put(record->ts_reg_info.cq_cb); } } Describing why wake_pending_user_interrupt_threads() drops the lock and saves the pointers without citing unregister_timestamp_node() as a precedent would avoid obscuring that discrepancy. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205063651.2523= 441-1-praneethb2002@gmail.com?part=3D1