From patchwork Sat Dec 12 16:42:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Nicolai_H=C3=A4hnle?= X-Patchwork-Id: 7835191 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 15811BEEE1 for ; Sat, 12 Dec 2015 16:43:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BBBE820398 for ; Sat, 12 Dec 2015 16:42:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 95D3F203B4 for ; Sat, 12 Dec 2015 16:42:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D0FD6E3A3; Sat, 12 Dec 2015 08:42:57 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-f171.google.com (mail-qk0-f171.google.com [209.85.220.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2B57A6E3A3 for ; Sat, 12 Dec 2015 08:42:56 -0800 (PST) Received: by qkdp187 with SMTP id p187so82193934qkd.1 for ; Sat, 12 Dec 2015 08:42:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=PvH4UHflBP/pszJ9NHECPAXIpznH9/8r98Rp8VeCNwk=; b=wnNDZH10su+hLoIWtHP+DldKobUo3Ghvv3qi5nYURIlFTQ5V7aQ8bS37Txz6yTj/sI wEAC2hZ7oV1qISHc4Dv5B9ag8w7ns0+qf9PQqOC51b2vm00UXz+ggNiryXHedh8ydwUr h286oko8DqfkgLchfTIA+b88LTWJ5+pPP6UDE42EytHbOpKuBCt70OS6azBSA3PvTYrY A2E3iag+p0qVb9KqkWQS/9CwrxEedt4xM+fDQyQj/wN/++I85uQkOjLivf09xYtyDpys 06z15/8isUGCUHawcYKmaRLMMXKischjPmcyafbEJSfxHMAMv+DE22uaBxAMXBUCpIP+ pnwA== X-Received: by 10.13.219.85 with SMTP id d82mr13961698ywe.136.1449938575481; Sat, 12 Dec 2015 08:42:55 -0800 (PST) Received: from cassiopeia.local ([200.121.5.35]) by smtp.gmail.com with ESMTPSA id e64sm16694564ywb.25.2015.12.12.08.42.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 12 Dec 2015 08:42:55 -0800 (PST) From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/3] drm/radeon: only increment sync_seq when a fence is really emitted Date: Sat, 12 Dec 2015 11:42:25 -0500 Message-Id: <1449938545-8707-3-git-send-email-nhaehnle@gmail.com> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 Cc: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicolai Hähnle In the rare situation where the kmalloc fails we're probably screwed anyway, but let's try to be more robust about it. Signed-off-by: Nicolai Hähnle --- drivers/gpu/drm/radeon/radeon_fence.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index df09ca7..05815c4 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -130,7 +130,7 @@ int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence **fence, int ring) { - u64 seq = ++rdev->fence_drv[ring].sync_seq[ring]; + u64 seq; /* we are protected by the ring emission mutex */ *fence = kmalloc(sizeof(struct radeon_fence), GFP_KERNEL); @@ -138,7 +138,7 @@ int radeon_fence_emit(struct radeon_device *rdev, return -ENOMEM; } (*fence)->rdev = rdev; - (*fence)->seq = seq; + (*fence)->seq = seq = ++rdev->fence_drv[ring].sync_seq[ring]; (*fence)->ring = ring; (*fence)->is_vm_update = false; fence_init(&(*fence)->base, &radeon_fence_ops,