From patchwork Fri Jan 30 05:38:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilija Hadzic X-Patchwork-Id: 5746651 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1F77A9F358 for ; Fri, 30 Jan 2015 05:39:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 44C1620251 for ; Fri, 30 Jan 2015 05:39:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AEF9C2024C for ; Fri, 30 Jan 2015 05:39:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B697C6E815; Thu, 29 Jan 2015 21:39:07 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qg0-f45.google.com (mail-qg0-f45.google.com [209.85.192.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DD4A6E815 for ; Thu, 29 Jan 2015 21:39:06 -0800 (PST) Received: by mail-qg0-f45.google.com with SMTP id q107so36802345qgd.4 for ; Thu, 29 Jan 2015 21:39:06 -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; bh=57VOMZbWUDArcWBNinKAfVHiv7kpg9EALu0AFAmtDl8=; b=e3a9JDGrql3l5o6dUP7RuDROgi5uy3+I19GBHxXloNBvmBkPE1EAsC8YEGzLqdymTP C54cUwvLo95SIk9GtGYqUVxdBogMsZxBecoLOnhi7QICLBVMpa/Q/oeJ0Xl8bXO17fUP tzN+zi7lHjGYjVQPwyjtRkijWuNg+D/W8/uXWO2/U6XxRh1RG+NNzWJy1MRKTzl8Y60j O/RP48fT7cvPb/aZfDKJ5SvtBxwQKl5gN6NUxzg1RjtNLUklWA9S613MSZtOMgjEk3u4 6rXT+XqiSJIbWjQ9kZrCoplfRnQP7CrvEH72I9sP88TDT4sPi6SsWgejVtx6rxShlch9 k3oA== X-Received: by 10.224.86.74 with SMTP id r10mr9150524qal.45.1422596346230; Thu, 29 Jan 2015 21:39:06 -0800 (PST) Received: from caterpillar.hsd1.nj.comcast.net. (c-98-221-34-209.hsd1.nj.comcast.net. [98.221.34.209]) by mx.google.com with ESMTPSA id q8sm9174976qam.1.2015.01.29.21.39.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jan 2015 21:39:05 -0800 (PST) From: Ilija Hadzic X-Google-Original-From: Ilija Hadzic To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/radeon: fix the crash in benchmark functions Date: Fri, 30 Jan 2015 00:38:43 -0500 Message-Id: <1422596324-1737-1-git-send-email-ihadzic@research.bell-labs.com> X-Mailer: git-send-email 2.2.0 Cc: Ilija Hadzic , stable@vger.kernel.org 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: , MIME-Version: 1.0 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 radeon_copy_dma and radeon_copy_blit must be called with a valid reservation object. Otherwise a crash will be provoked. We borrow the object from destination BO. Cc: stable@vger.kernel.org Signed-off-by: Ilija Hadzic --- drivers/gpu/drm/radeon/radeon_benchmark.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c index 9e7f23d..87d5fb2 100644 --- a/drivers/gpu/drm/radeon/radeon_benchmark.c +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c @@ -34,7 +34,8 @@ static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size, uint64_t saddr, uint64_t daddr, - int flag, int n) + int flag, int n, + struct reservation_object *resv) { unsigned long start_jiffies; unsigned long end_jiffies; @@ -47,12 +48,12 @@ static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size, case RADEON_BENCHMARK_COPY_DMA: fence = radeon_copy_dma(rdev, saddr, daddr, size / RADEON_GPU_PAGE_SIZE, - NULL); + resv); break; case RADEON_BENCHMARK_COPY_BLIT: fence = radeon_copy_blit(rdev, saddr, daddr, size / RADEON_GPU_PAGE_SIZE, - NULL); + resv); break; default: DRM_ERROR("Unknown copy method\n"); @@ -120,7 +121,8 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size, if (rdev->asic->copy.dma) { time = radeon_benchmark_do_move(rdev, size, saddr, daddr, - RADEON_BENCHMARK_COPY_DMA, n); + RADEON_BENCHMARK_COPY_DMA, n, + dobj->tbo.resv); if (time < 0) goto out_cleanup; if (time > 0) @@ -130,7 +132,8 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size, if (rdev->asic->copy.blit) { time = radeon_benchmark_do_move(rdev, size, saddr, daddr, - RADEON_BENCHMARK_COPY_BLIT, n); + RADEON_BENCHMARK_COPY_BLIT, n, + dobj->tbo.resv); if (time < 0) goto out_cleanup; if (time > 0)