On Monday 23 July 2007 07:59:24 am Eric Anholt wrote:
> This was used to make all ioctl handlers return -errno on linux and
> errno on *BSD. Instead, just return -errno in shared code, and flip sign
> on return from shared code to *BSD code.
I was trying to determine why my system hung and focused on the shared code
change. Then I decide it was time to forage for food after looking at the
commit diff.
There are a couple of problems with the BSD driver however.
1) Locking is broken in drm_auth.c causing my system to hang. Patch is at the
end of this email. I pasted it in as well as attaching it as I have had
problems on other mailing lists with attachments.
2) In drm_getstats, memset(&stats, 0, sizeof(stats)) should be
memset(stats, 0, sizeof(drm_stats_t)). Could also of used bzero.
3) In drm_setversion, retv is never used. I changed the routine to work as
before, but havn't yet read the drm specification on what should occur or
looked at the rest of the code to see if it matters.
--- bsd-core/drm_auth.c.orig 2007-07-21 23:13:43.000000000 -0700
+++ bsd-core/drm_auth.c 2007-07-25 01:43:08.000000000 -0700
@@ -1,4 +1,4 @@
-/* drm_auth.h -- IOCTLs for authentication -*- linux-c -*-
+/* drm_auth.c -- IOCTLs for authentication -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by [EMAIL PROTECTED]
*/
/*-
@@ -66,7 +66,6 @@
entry->priv = priv;
entry->next = NULL;
- DRM_LOCK();
if (dev->magiclist[hash].tail) {
dev->magiclist[hash].tail->next = entry;
dev->magiclist[hash].tail = entry;
@@ -74,7 +73,6 @@
dev->magiclist[hash].head = entry;
dev->magiclist[hash].tail = entry;
}
- DRM_UNLOCK();
return 0;
}
@@ -88,7 +86,6 @@
DRM_DEBUG("%d\n", magic);
hash = drm_hash_magic(magic);
- DRM_LOCK();
for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) {
if (pt->magic == magic) {
if (dev->magiclist[hash].head == pt) {
@@ -100,11 +97,9 @@
if (prev) {
prev->next = pt->next;
}
- DRM_UNLOCK();
return 0;
}
}
- DRM_UNLOCK();
free(pt, M_DRM);
return EINVAL;
@@ -129,8 +124,8 @@
continue;
} while (drm_find_file(dev, auth->magic));
file_priv->magic = auth->magic;
- DRM_UNLOCK();
drm_add_magic(dev, file_priv, auth->magic);
+ DRM_UNLOCK();
}
DRM_DEBUG("%u\n", auth->magic);
@@ -152,8 +147,8 @@
drm_remove_magic(dev, auth->magic);
DRM_UNLOCK();
return 0;
- } else {
- DRM_UNLOCK();
- return EINVAL;
}
+
+ DRM_UNLOCK();
+ return EINVAL;
}
--- bsd-core/drm_auth.c.orig 2007-07-21 23:13:43.000000000 -0700
+++ bsd-core/drm_auth.c 2007-07-25 01:43:08.000000000 -0700
@@ -1,4 +1,4 @@
-/* drm_auth.h -- IOCTLs for authentication -*- linux-c -*-
+/* drm_auth.c -- IOCTLs for authentication -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by [EMAIL PROTECTED]
*/
/*-
@@ -66,7 +66,6 @@
entry->priv = priv;
entry->next = NULL;
- DRM_LOCK();
if (dev->magiclist[hash].tail) {
dev->magiclist[hash].tail->next = entry;
dev->magiclist[hash].tail = entry;
@@ -74,7 +73,6 @@
dev->magiclist[hash].head = entry;
dev->magiclist[hash].tail = entry;
}
- DRM_UNLOCK();
return 0;
}
@@ -88,7 +86,6 @@
DRM_DEBUG("%d\n", magic);
hash = drm_hash_magic(magic);
- DRM_LOCK();
for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) {
if (pt->magic == magic) {
if (dev->magiclist[hash].head == pt) {
@@ -100,11 +97,9 @@
if (prev) {
prev->next = pt->next;
}
- DRM_UNLOCK();
return 0;
}
}
- DRM_UNLOCK();
free(pt, M_DRM);
return EINVAL;
@@ -129,8 +124,8 @@
continue;
} while (drm_find_file(dev, auth->magic));
file_priv->magic = auth->magic;
- DRM_UNLOCK();
drm_add_magic(dev, file_priv, auth->magic);
+ DRM_UNLOCK();
}
DRM_DEBUG("%u\n", auth->magic);
@@ -152,8 +147,8 @@
drm_remove_magic(dev, auth->magic);
DRM_UNLOCK();
return 0;
- } else {
- DRM_UNLOCK();
- return EINVAL;
}
+
+ DRM_UNLOCK();
+ return EINVAL;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel