All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bryce Harrington <bryce@canonical.com>
To: intel-gfx@lists.freedesktop.org, Chris Wilson <chris@chris-wilson.co.uk>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Subject: [PATCH v2 5/7] xfree86: Fix race condition failure opening drm.
Date: Mon, 18 Mar 2013 13:51:49 -0700	[thread overview]
Message-ID: <1363639911-21239-6-git-send-email-bryce@canonical.com> (raw)
In-Reply-To: <1363639911-21239-1-git-send-email-bryce@canonical.com>

If other processes have had drm open previously, xserver may attempt to
open the device too early and fail, with xserver error exit "Cannot
run in framebuffer mode" or Xorg.0.log messages about "setversion 1.4
failed".

In this situation, we're receiving back -EACCES from libdrm.  To address
this we need to re-set ourselves as the drm master, and keep trying to
set the interface until it works (or until we give up).

See https://bugs.launchpad.net/ubuntu/+source/libdrm/+bug/982889

Signed-off-by: Bryce Harrington <bryce@canonical.com>
---
 hw/xfree86/os-support/linux/lnx_platform.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index 4094866..bb76d90 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -43,8 +43,14 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
 	    if (tries > 1)
 		LogMessage(X_INFO, "setversion 1.4 succeeded on try #%d\n", tries);
 	    break;
+	} if (err != -EACCES) {
+	    break;
 	}
+
 	usleep(1000);
+
+	if (!drmSetMaster(fd))
+	    LogMessage(X_INFO, "drmSetMaster succeeded\n");
     }
     if (err) {
         ErrorF("setversion 1.4 failed: %s\n", strerror(-err));
-- 
1.7.9.5

  parent reply	other threads:[~2013-03-18 20:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18 20:51 [PATCH v2 0/7] xfree86: Handle drm race condition Bryce Harrington
2013-03-18 20:51 ` [PATCH v2 1/7] xfree86: (Cleanup) Close fd if drm interface 1.4 could not be set Bryce Harrington
2013-03-18 20:51 ` [PATCH v2 2/7] xfree86: Track error code and add label for error handling Bryce Harrington
2013-03-18 20:51 ` [PATCH v2 3/7] xfree86: Provide more details on failure Bryce Harrington
2013-03-18 20:51 ` [PATCH v2 4/7] xfree86: Keep trying to set interface on drm for 2 seconds Bryce Harrington
2013-03-18 20:51 ` Bryce Harrington [this message]
2013-03-18 20:51 ` [PATCH v2 6/7] xfree86: Be verbose if waiting on opening the drm device Bryce Harrington
2013-03-18 20:51 ` [PATCH v2 7/7] xfree86: Also handle EAGAIN errors from drmSetInterfaceVersion() Bryce Harrington
2013-03-19  9:21 ` [PATCH v2 0/7] xfree86: Handle drm race condition Chris Wilson
2013-03-19 10:02   ` Maarten Lankhorst
2013-03-19 10:27     ` Chris Wilson
2013-03-19 10:50       ` Maarten Lankhorst
2013-03-19 11:10         ` Dave Airlie
     [not found]           ` <CAPM=9twNnKV9DUNJ-BfrnXTrj=W+AGyxqauCPMW2kCx39bj_pA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-19 12:18             ` Maarten Lankhorst
2013-03-19 21:13         ` Chris Wilson
2013-03-20  8:40           ` Maarten Lankhorst
2013-03-20 10:43             ` Maarten Lankhorst
2013-03-20 14:09             ` Chris Wilson
2013-03-30 18:02 ` Chris Wilson
2013-03-31 17:14   ` Ben Widawsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363639911-21239-6-git-send-email-bryce@canonical.com \
    --to=bryce@canonical.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@canonical.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.