From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
Bryce Harrington <bryce@canonical.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 0/7] xfree86: Handle drm race condition
Date: Tue, 19 Mar 2013 11:02:14 +0100 [thread overview]
Message-ID: <514837A6.5010301@canonical.com> (raw)
In-Reply-To: <20130319092146.GC3872@cantiga.alporthouse.com>
Hey,
Op 19-03-13 10:21, Chris Wilson schreef:
> On Mon, Mar 18, 2013 at 01:51:44PM -0700, Bryce Harrington wrote:
>> Update: Squashes a couple commits to avoid potential hang if
>> git bisecting. No other changes from v1.
> I'd probably drop the last EAGAIN patch as that is part of the libdrm
> API, but other than that it looks to be a reasonably self-contained w/a
> for this perplexing problem.
>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris
>
And completely wrong, version I pushed to ubuntu's xorg-server for comparison:
>8--
Nacked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -7,6 +7,7 @@
#include <xf86drm.h>
#include <fcntl.h>
#include <unistd.h>
+#include <errno.h>
/* Linux platform device support */
#include "xf86_OSproc.h"
@@ -17,23 +18,54 @@
#include "hotplug.h"
+static Bool get_drm_master(int fd)
+{
+ int ret, tries = 400;
+
+ LogMessage(X_INFO, "spinning!\n");
+
+ while (tries--) {
+ if (drmSetMaster(fd) >= 0)
+ return TRUE;
+
+ if (errno != EINVAL)
+ break;
+
+ usleep(10000);
+ }
+ return FALSE;
+}
+
static Bool
get_drm_info(struct OdevAttributes *attribs, char *path)
{
drmSetVersion sv;
char *buf;
int fd;
+ int err = 0;
fd = open(path, O_RDWR, O_CLOEXEC);
if (fd == -1)
return FALSE;
- sv.drm_di_major = 1;
- sv.drm_di_minor = 4;
- sv.drm_dd_major = -1; /* Don't care */
- sv.drm_dd_minor = -1; /* Don't care */
- if (drmSetInterfaceVersion(fd, &sv)) {
- ErrorF("setversion 1.4 failed\n");
+ while (1) {
+ sv.drm_di_major = 1;
+ sv.drm_di_minor = 4;
+ sv.drm_dd_major = -1; /* Don't care */
+ sv.drm_dd_minor = -1; /* Don't care */
+
+ err = drmSetInterfaceVersion(fd, &sv);
+ if (!err)
+ break;
+
+ if (err == -EACCES) {
+ if (get_drm_master(fd))
+ continue;
+ ErrorF("drmSetMaster failed with -%i(%m)\n", errno);
+ } else
+ ErrorF("drmSetInterfaceVersion failed with %i(%s)\n", err, strerror(-err));
+
+ close(fd);
return FALSE;
}
next prev parent reply other threads:[~2013-03-19 10:02 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 ` [PATCH v2 5/7] xfree86: Fix race condition failure opening drm Bryce Harrington
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 [this message]
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=514837A6.5010301@canonical.com \
--to=maarten.lankhorst@canonical.com \
--cc=bryce@canonical.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox