From nobody Sun Feb 8 00:50:23 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F41292E62D9 for ; Fri, 19 Dec 2025 21:53:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766181240; cv=none; b=EIWwnHYYZfJrekRP/brkjX0O60bDUtIbqo3nnyxx60qfrwjyziufRfEpk20ANeWZP4zFgtFB+tR9JsBLJlu3jE7C3y9N07WLXj+zoHKsD9Bbc9IHvNssKF+lBPfXYroVylrpYkYmqGKtFn5SLEDfsEHnpIP3BaU0qT+n/bJ2v2k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766181240; c=relaxed/simple; bh=zHHV/SBHViEmW+aXytGNRmUvK/Izxv4tzbqOR8GsqLo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A6aC+KzNl3SXDzvVH0oGE72A+FkvuhxXVPJ7z+DhYHbLmckckf87dvbDULBsBVHJ+O0iD1PQCyQNx84q7QAmVUXCMZq4/O0HyKn3GpBzoTGoDtfF4PAdk4Zjr4ygAQ0Nr6ygnEcfBRbv/IDeGL40YP/0RepCFE8BepklXfkak8I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SqL2ikcb; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SqL2ikcb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766181238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rkXEdzkbRQECKf+aADUpL9UrjM7M5Y0Z71t+7qrFeC4=; b=SqL2ikcbH4F13Bmh64G8pPMYS5SEadGfMNHlxQg6RBYKYvY75k1a9c6oVUn6wBpC5TYxsR JB2SZzm1Kg/ZhlkL/DYcVcnS0GA2ETTbapqaFQ49q4uBmzJqlyhng1In0qldAwNEDwzmVo bNoYfKUc0uqqJ5tflAfff5nPWOzRaYc= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-207-LGR_lSpcPTmR4GwMKFkHxA-1; Fri, 19 Dec 2025 16:53:53 -0500 X-MC-Unique: LGR_lSpcPTmR4GwMKFkHxA-1 X-Mimecast-MFC-AGG-ID: LGR_lSpcPTmR4GwMKFkHxA_1766181232 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D72D21956094; Fri, 19 Dec 2025 21:53:51 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.166]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B027730001A2; Fri, 19 Dec 2025 21:53:49 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, "Timur Tabi" , "Dave Airlie" , "Maarten Lankhorst" , "Ben Skeggs" , "Simona Vetter" , "Ben Skeggs" , "David Airlie" , "Thomas Zimmermann" , "Maxime Ripard" , "Danilo Krummrich" , "Lyude Paul" Subject: [PATCH 1/2] drm/nouveau/disp/nv50-: Set lock_core in curs507a_prepare Date: Fri, 19 Dec 2025 16:52:02 -0500 Message-ID: <20251219215344.170852-2-lyude@redhat.com> In-Reply-To: <20251219215344.170852-1-lyude@redhat.com> References: <20251219215344.170852-1-lyude@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" For a while, I've been seeing a strange issue where some (usually not all) of the display DMA channels will suddenly hang, particularly when there is a visible cursor on the screen that is being frequently updated, and especially when said cursor happens to go between two screens. While this brings back lovely memories of fixing Intel Skylake bugs, I would quite like to fix it :). It turns out the problem that's happening here is that we're managing to reach nv50_head_flush_set() in our atomic commit path without actually holding nv50_disp->mutex. This means that cursor updates happening in parallel (along with any other atomic updates that need to use the core channel) will race with eachother, which eventually causes us to corrupt the pushbuffer - leading to a plethora of various GSP errors, usually: nouveau 0000:c1:00.0: gsp: Xid:56 CMDre 00000000 00000218 00102680 000000= 04 00800003 nouveau 0000:c1:00.0: gsp: Xid:56 CMDre 00000000 0000021c 00040509 000000= 04 00000001 nouveau 0000:c1:00.0: gsp: Xid:56 CMDre 00000000 00000000 00000000 000000= 01 00000001 The reason this is happening is because generally we check whether we need to set nv50_atom->lock_core at the end of nv50_head_atomic_check(). However, curs507a_prepare is called from the fb_prepare callback, which happens after the atomic check phase. As a result, this can lead to commits that both touch the core channel but also don't grab nv50_disp->mutex. So, fix this by making sure that we set nv50_atom->lock_core in cus507a_prepare(). Signed-off-by: Lyude Paul Fixes: 1590700d94ac ("drm/nouveau/kms/nv50-: split each resource type into = their own source files") Cc: # v4.18+ Reviewed-by: Dave Airlie --- drivers/gpu/drm/nouveau/dispnv50/curs507a.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c b/drivers/gpu/drm/= nouveau/dispnv50/curs507a.c index a95ee5dcc2e39..1a889139cb053 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/curs507a.c +++ b/drivers/gpu/drm/nouveau/dispnv50/curs507a.c @@ -84,6 +84,7 @@ curs507a_prepare(struct nv50_wndw *wndw, struct nv50_head= _atom *asyh, asyh->curs.handle =3D handle; asyh->curs.offset =3D offset; asyh->set.curs =3D asyh->curs.visible; + nv50_atom(asyh->state.state)->lock_core =3D true; } } =20 --=20 2.52.0 From nobody Sun Feb 8 00:50:23 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A99AD2D7384 for ; Fri, 19 Dec 2025 21:54:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766181243; cv=none; b=CdFMigOyKJqyh01nKOivrC+Sp6UqnZVpe1qNCycAoXxbXwEbkzd/BIPATh4OLR5BoQ2w1clhJKfrLd4tk1hRzm0Hfav2WxllDN9M2Tzh4GGBRJ/CuTDK4uK/JVW0Rcq8X3uiGmsoeuYUum9sJH5pjp+TujQZTu7Aw1ouqhm1BqE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766181243; c=relaxed/simple; bh=Wwk4XtNT/QwR671eROxJvK+6rFePJGFk3RXRtUiR3KA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Asvf9cu82w+WaGwC/EsAPDsQs5jREVSdzBwkqeo7aBHZvWbWDScZaun0aEJdGe94G/gs0/hvknjqIlEBHaI/f6fIM6sUwXpDDJFdxpJoEBX0g24WrTTkGoFvijG35ppalei7rx9zkFnTwqVDw0GkmSm+y6QOyoBkmVxrSFEke6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=C8dxW8Ri; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="C8dxW8Ri" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766181240; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yT/vkIL4JqiLKqlGqIsKx0mk6qKhYZKvJPVbSWT23XE=; b=C8dxW8RisnnAuUzu7TOj6+w/az2793foIA3KRltOu1kjL/3CeCCYfptrej+FE7Roj1TGos DzcVqstjxGYqe9NlDq60dcHio+KUiIwD+3w/uBU/TDn6ytjaQI+Zz3ytNKDZTxhUOUIs9n 54iBaY04xHsp2xtea9H6Fku2rhQ0Zns= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-279-71bDXKARMI2wW1XdZGx_IQ-1; Fri, 19 Dec 2025 16:53:57 -0500 X-MC-Unique: 71bDXKARMI2wW1XdZGx_IQ-1 X-Mimecast-MFC-AGG-ID: 71bDXKARMI2wW1XdZGx_IQ_1766181235 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7950D18005AE; Fri, 19 Dec 2025 21:53:55 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.166]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 31C7B300021A; Fri, 19 Dec 2025 21:53:53 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: "Timur Tabi" , "Dave Airlie" , "Maarten Lankhorst" , "Ben Skeggs" , "Simona Vetter" , "Ben Skeggs" , "David Airlie" , "Thomas Zimmermann" , "Maxime Ripard" , "Danilo Krummrich" , "Lyude Paul" Subject: [PATCH 2/2] drm/nouveau/kms/nv50-: Assert we hold nv50_disp->lock in nv50_head_flush_* Date: Fri, 19 Dec 2025 16:52:03 -0500 Message-ID: <20251219215344.170852-3-lyude@redhat.com> In-Reply-To: <20251219215344.170852-1-lyude@redhat.com> References: <20251219215344.170852-1-lyude@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" Now that we've had one bug that occurred in nouveau as the result of nv50_head_flush_* being called without the appropriate locks, let's add some lockdep asserts to make sure this doesn't happen in the future. Signed-off-by: Lyude Paul Reviewed-by: Dave Airlie --- drivers/gpu/drm/nouveau/dispnv50/head.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouv= eau/dispnv50/head.c index 3dd742b4f8232..e32ed1db6c566 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head.c @@ -43,6 +43,9 @@ nv50_head_flush_clr(struct nv50_head *head, union nv50_head_atom_mask clr =3D { .mask =3D asyh->clr.mask & ~(flush ? 0 : asyh->set.mask), }; + + lockdep_assert_held(&head->disp->mutex); + if (clr.crc) nv50_crc_atomic_clr(head); if (clr.olut) head->func->olut_clr(head); if (clr.core) head->func->core_clr(head); @@ -65,6 +68,8 @@ nv50_head_flush_set_wndw(struct nv50_head *head, struct n= v50_head_atom *asyh) void nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh) { + lockdep_assert_held(&head->disp->mutex); + if (asyh->set.view ) head->func->view (head, asyh); if (asyh->set.mode ) head->func->mode (head, asyh); if (asyh->set.core ) head->func->core_set(head, asyh); --=20 2.52.0