From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Anton V. Boyarshinov" Subject: [PATCH] xf86drm.c: add counter for ioctl restarting Date: Fri, 13 Apr 2012 17:26:42 +0400 Message-ID: <20120413172642.4c423352@boyarsh.office.altlinux.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from vint.altlinux.org (vint.altlinux.org [194.107.17.35]) by gabe.freedesktop.org (Postfix) with ESMTP id DD2659E947 for ; Fri, 13 Apr 2012 06:36:28 -0700 (PDT) Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vint.altlinux.org (Postfix) with ESMTP id 2042D3F80038 for ; Fri, 13 Apr 2012 13:26:44 +0000 (UTC) Received: from boyarsh.office.altlinux.ru (unknown [195.239.66.165]) by imap.altlinux.org (Postfix) with ESMTPSA id 08E373E48676 for ; Fri, 13 Apr 2012 17:26:44 +0400 (MSK) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: DRI mailing list List-Id: dri-devel@lists.freedesktop.org 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 --- 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