All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xf86drm.c: add counter for ioctl restarting
@ 2012-04-13 13:26 Anton V. Boyarshinov
  2012-04-13 13:40 ` Chris Wilson
  2012-04-13 13:42 ` Daniel Vetter
  0 siblings, 2 replies; 8+ messages in thread
From: Anton V. Boyarshinov @ 2012-04-13 13:26 UTC (permalink / raw)
  To: DRI mailing list

In some cases ioclt->alarm->ioctl loop can be infinite:
ioctl(7, 0x40086482, 0xbfb62738)        = ? ERESTARTSYS (To be restarted)
--- SIGALRM (Alarm clock) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
ioctl(7, 0x40086482, 0xbfb62738)        = ? ERESTARTSYS (To be restarted)
and forever.

It seems, that limiting ioctl restarting by some resonable number of trys
is a dirty but working way to prevent Xorg lockups.

Signed-off-by: Anton V. Boyarshinov <boyarsh@altlinux.org>
---
 xf86drm.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index 6ea068f..9663f21 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -162,10 +162,11 @@ int
 drmIoctl(int fd, unsigned long request, void *arg)
 {
     int	ret;
+    int count=0;
 
     do {
 	ret = ioctl(fd, request, arg);
-    } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
+    } while (ret == -1 && (errno == EINTR || errno == EAGAIN) && ++count < 100 );
     return ret;
 }
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-04-16 15:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-13 13:26 [PATCH] xf86drm.c: add counter for ioctl restarting Anton V. Boyarshinov
2012-04-13 13:40 ` Chris Wilson
2012-04-16  8:45   ` Anton V. Boyarshinov
2012-04-13 13:42 ` Daniel Vetter
2012-04-13 14:45   ` Ville Syrjälä
2012-04-16  8:54   ` Anton V. Boyarshinov
2012-04-16 14:12     ` Adam Jackson
2012-04-16 15:05       ` Anton V. Boyarshinov

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.