NetBSD Problem Report #55555

From www@netbsd.org  Sat Aug  8 23:39:25 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C25F41A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  8 Aug 2020 23:39:25 +0000 (UTC)
Message-Id: <20200808233924.CAD1A1A923A@mollari.NetBSD.org>
Date: Sat,  8 Aug 2020 23:39:24 +0000 (UTC)
From: nervoso@k1.com.br
Reply-To: nervoso@k1.com.br
To: gnats-bugs@NetBSD.org
Subject: X freezes and message on console about atomic update fail on intel_sprite.c
X-Send-Pr-Version: www-1.0

>Number:         55555
>Category:       port-amd64
>Synopsis:       X freezes and message on console about atomic update fail on intel_sprite.c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 08 23:40:00 +0000 2020
>Last-Modified:  Sun Jan 10 17:50:01 +0000 2021
>Originator:     sergio lenzi
>Release:        HEAD 9.99.67
>Organization:
k1.com.br
>Environment:
NetBSD desktop64.lenzicasa 9.99.69 NetBSD 9.99.69 (LZTHEAD) #0: Sat Aug  8 18:47:28 -03 2020  NetBSD@install64.netbsd:/home/NetBSD/BUILD/HEAD/amd64/OBJ/sys/arch/amd64/compile/GENERIC amd64
>Description:
Desktop, using mate-desktop and firefox 77, on playing youtube freezes after some time, but not the machine... Message from kernel: Potential atomic update failure on pipe A: -35 the machine is an old dell optiplex 360 with intel G33 builtin graphic chip.  using other video adapter (radeon) the system never locks.
This also occurs in the i386 port
>How-To-Repeat:
Install mate-desktop, start firefox, play some videos, the message shows on the console: Potential atomic update failure on pipe A: -35 than some time later, the graphic desktop freezes, or sometimes on play video, a message of BadAlloc not enough resources shows, and the player aborts, 
only a reboot can bring the desktop to play videos again
>Fix:
apply the patch to intel_sprite.c 

diff -up usr/src/sys/external/bsd/drm2/dist/drm/i915/intel_sprite.c.orig usr/src/sys/external/bsd/drm2/dist/drm/i915/intel_sprite.c
--- usr/src/sys/external/bsd/drm2/dist/drm/i915/intel_sprite.c.orig     2020-08-08 16:37:09.346946639 -0300
+++ usr/src/sys/external/bsd/drm2/dist/drm/i915/intel_sprite.c  2020-08-08 16:37:25.787602724 -0300
@@ -89,7 +89,7 @@ void intel_pipe_update_start(struct inte
        struct drm_device *dev = crtc->base.dev;
        const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
        enum pipe pipe = crtc->pipe;
-       long timeout = msecs_to_jiffies_timeout(1);
+       long timeout = msecs_to_jiffies_timeout(100);
        int scanline, min, max, vblank_start;
 #ifdef __NetBSD__
        drm_waitqueue_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
@@ -124,7 +124,7 @@ void intel_pipe_update_start(struct inte
        trace_i915_pipe_update_start(crtc);

 #ifdef __NetBSD__
-       DRM_SPIN_TIMED_WAIT_UNTIL(ret, wq, &dev->vbl_lock, timeout,
+       DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(ret, wq, &dev->vbl_lock, timeout,
            (scanline = intel_get_crtc_scanline(crtc),
                scanline < min || scanline > max));
        if (ret <= 0)

>Audit-Trail:
From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@netbsd.org, nervoso@k1.com.br
Cc: port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: port-amd64/55555: X freezes and message on console about atomic update fail on intel_sprite.c
Date: Sun, 09 Aug 2020 11:30:14 +1000

 nice find!  i haven't tried yet, but i'm pretty sure you
 found the problem.

 i'm pretty sure you're right -- converting to NOINTR
 should match the linux TASK_UNINTERRUPTIBLE susage.

 > -       long timeout = msecs_to_jiffies_timeout(1);
 > +       long timeout = msecs_to_jiffies_timeout(100);

 can you explain this part?  i'm not sure what this one
 is for..

 thanks heaps for the PR.


 .mrg.

From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org, mrg@eterna.com.au
Cc: 
Subject: Re: port-amd64/55555: X freezes and message on console about atomic
 update fail on intel_sprite.c
Date: Fri, 30 Oct 2020 22:39:24 -0400

 FWIW, I've been running with this patch for months, no issues noted.

 Thanks,

 Dave

From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/55555: X freezes and message on console about atomic
 update fail on intel_sprite.c
Date: Sat, 31 Oct 2020 03:55:24 +0000

 Do you need both parts of this change, or just _NOINTR?

 If a change is "make us match upstream behaviour more" it's pretty much
 auto-approved.

From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55555 CVS commit: src/sys/external/bsd/drm2/dist/drm/i915
Date: Sat, 31 Oct 2020 04:05:42 +0000

 Module Name:	src
 Committed By:	maya
 Date:		Sat Oct 31 04:05:42 UTC 2020

 Modified Files:
 	src/sys/external/bsd/drm2/dist/drm/i915: intel_sprite.c

 Log Message:
 Match linux here and wait without interrupts.

 From David H. Gutteridge in PR port-amd64/55555
 There's a second part to the patch, but "make our code behave the way
 the upstream code does" is very welcome.
 Also PR kern/54515 and possibly others.


 To generate a diff of this commit:
 cvs rdiff -u -r1.10 -r1.11 \
     src/sys/external/bsd/drm2/dist/drm/i915/intel_sprite.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/55555: X freezes and message on console about atomic
 update fail on intel_sprite.c
Date: Sun, 01 Nov 2020 18:32:08 -0500

 On Sat, 31 Oct 2020, at 03:55:24 +0000, coypu wrote:
 > Do you need both parts of this change, or just _NOINTR?
 > 
 > If a change is "make us match upstream behaviour more" it's pretty much
 > auto-approved.

 Hi Maya,

 I'd applied the full patch submitted, and tested on various versions
 of -current. I can back out the timeout adjustment and try again without
 it. (This is testing on a machine that exhibits part of the issue, but
 it isn't as bad as what other people have experienced.)

 Thanks,

 Dave

From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/55555: X freezes and message on console about atomic
 update fail on intel_sprite.c
Date: Mon, 2 Nov 2020 07:24:18 +0000

 Sorry about the mis-credit, Sergio.
 It's a really good patch.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55555 CVS commit: [netbsd-9] src/sys/external/bsd/drm2/dist/drm/i915
Date: Sun, 29 Nov 2020 11:34:04 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Nov 29 11:34:04 UTC 2020

 Modified Files:
 	src/sys/external/bsd/drm2/dist/drm/i915 [netbsd-9]: intel_sprite.c

 Log Message:
 Pull up following revision(s) (requested by maya in ticket #1136):

 	sys/external/bsd/drm2/dist/drm/i915/intel_sprite.c: revision 1.11

 Match linux here and wait without interrupts.

 From David H. Gutteridge in PR port-amd64/55555
 There's a second part to the patch, but "make our code behave the way
 the upstream code does" is very welcome.

 Also PR kern/54515 and possibly others.


 To generate a diff of this commit:
 cvs rdiff -u -r1.9 -r1.9.4.1 \
     src/sys/external/bsd/drm2/dist/drm/i915/intel_sprite.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/55555: X freezes and message on console about atomic
 update fail on intel_sprite.c
Date: Sun, 10 Jan 2021 12:49:11 -0500

 FWIW, I don't notice any distinction running without the second half of
 the original patch submitted.

 Dave

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.