From patchwork Wed Feb 13 18:47:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 2139011 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 428043FCF6 for ; Wed, 13 Feb 2013 18:51:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 47C95E606B for ; Wed, 13 Feb 2013 10:51:34 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C5CFE6811 for ; Wed, 13 Feb 2013 10:50:56 -0800 (PST) Received: by mail-we0-f181.google.com with SMTP id t44so1269064wey.12 for ; Wed, 13 Feb 2013 10:50:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=whgsuvXk4B4aouDdNwRD/zRdyIhbm+xUHZQmzLzOHaM=; b=A+C8JUsU2RGyQCoXH+GBJfcclZyOmKM7rrGzlwh9xel2Ff0ztrAGCUaQ3QfBnM4ypO LoAGOC4K7PQkXhV55Ojr3rvObAGQTkMysFSFNYoRxX25D7iegAF77w2hQuWGkqAAkBn9 6LxVPGbe/y4rbXAVHsQ1CGVqPn83Y94+lDDnaBMWiGTot5e74OtFZxdGqYELR2sbf9gD Ad0SoIi97BSvlsopoCRauvdlgTGrjlvP3sxmbnq0zQKeoIyhg6wwUBBG+3J5aEOPeG3v m95hckI3pNlOPe7y2dtfFO50Kru/QSA0mrHHUvO0SZCYyVFN+10CNbQxTQBEWn7XhHuE feSA== X-Received: by 10.180.97.166 with SMTP id eb6mr11974549wib.20.1360781450502; Wed, 13 Feb 2013 10:50:50 -0800 (PST) Received: from localhost.boston.devel.redhat.com ([66.187.233.206]) by mx.google.com with ESMTPS id t7sm37441009wiy.2.2013.02.13.10.50.48 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 13 Feb 2013 10:50:49 -0800 (PST) From: j.glisse@gmail.com To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/radeon: Catch reservation deadlock on same buffer with different handle Date: Wed, 13 Feb 2013 13:47:30 -0500 Message-Id: <1360781250-3325-1-git-send-email-j.glisse@gmail.com> X-Mailer: git-send-email 1.7.11.7 Cc: Jerome Glisse , stable@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Jerome Glisse This patch print a warning message when trying to reserve same buffer twice in same cs ioctl (because the buffer is known by userspace under 2 different handle). It does not try to fix the issue like : https://patchwork.kernel.org/patch/1812991/ Just to make this case easier to debug. Cc: stable@vger.kernel.org Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/radeon_object.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index d3aface..e40743d 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -355,6 +355,18 @@ int radeon_bo_list_validate(struct list_head *head) r = ttm_eu_reserve_buffers(head); if (unlikely(r != 0)) { + if (r == -EDEADLK) { + /* this is not a GPU lockup, ttm_eu_reserve_buffers + * can not trigger detection of GPU lockup. This is + * a dead lock trying to reserve the same buffer again + * probably because the buffer is know as 2 different + * handle by userspace. Print a warning message so + * that we know what's going on. + */ + DRM_ERROR("Dead lock reserving buffer (one buffer is know by userspace under 2 different handle)\n"); + /* Do not return -EDEADLK to avoid useless GPU reset */ + return -EINVAL; + } return r; } list_for_each_entry(lobj, head, tv.head) {