From patchwork Thu Aug 4 08:09:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9262907 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ADC0160754 for ; Thu, 4 Aug 2016 08:10:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A014D2787D for ; Thu, 4 Aug 2016 08:10:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94B442832C; Thu, 4 Aug 2016 08:10:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 262132787D for ; Thu, 4 Aug 2016 08:10:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B927F6E69A; Thu, 4 Aug 2016 08:10:11 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 135706E654; Thu, 4 Aug 2016 08:10:07 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id q128so41409734wma.1; Thu, 04 Aug 2016 01:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=R7jzh9GqA/5ZXjltNG01cAZhhmUcGZYENKLuCGxotQI=; b=hDChL/Irdy7pUDeewaXcSloafwoERqj1qEakNWcBQt3EY8v320aZaYlzZLrQ3VHB4N he2UZVHPlbOBCN+8WFw6NDY/NW20GrsFIzQLhvaSdRz4QIUn84QkFXL/+ktg1RtxMMhF qFUDR65K8YzvyEAw0l0ha9zpdEzMDbPHMpobFR5yP9WQHiJRSkMTNgqblHvXIYWyqZ+Y PZtKMMay1wthTXps5OI1zGiN4EVUh+xi4WUZ6G8TdO/ZORQDu6qDmHgC0TnQGlTlJUFo BQWE0IkFaZ/6/80ZPLd+WDlSV+YNwr50jtChQg+f01rAZvCqrjf2OqHlggcmGeyZf03k dp+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=R7jzh9GqA/5ZXjltNG01cAZhhmUcGZYENKLuCGxotQI=; b=fwsj4F/u/fwevOVPWxtd6P1BWpdVFuWl2u/mR/5x7F8Bh3oakZNuXPAp0BKL6eTNuN OIlKya9JBFY1v7R64rVBIUbd0WNypTFsjhRG6Ce9PJxNyADL58wrKI7nZ75yMOkQLIj3 fy8jSUw+b+w4H3s/zywVXeeYUno5IPbBCnlyLzV8g5Rc/Y26r5c0EaAF23tc4mllHgJ2 ZSpUUPfymfdEmVTCL2f/Q67S0FOhbHUnax780Dv8uL5xfZHut26ANVWsRmQdY7zNbGGM hSMx2KEn5URKRSwiMak8bTZs6xSAy2pMaTWYm9C8U1M6lVInlPx1mEQDt1qIpWw8EHfI aWLA== X-Gm-Message-State: AEkooutydO8S8etISlvez6YBJck1Db55yhD9XwzD0YlukDT7Deh460swoRm0AgKM57Xl6A== X-Received: by 10.194.236.68 with SMTP id us4mr36161172wjc.12.1470298204243; Thu, 04 Aug 2016 01:10:04 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id qe2sm11547076wjc.28.2016.08.04.01.10.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Aug 2016 01:10:02 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 4 Aug 2016 09:09:53 +0100 Message-Id: <1470298193-21765-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 Cc: Ankitprasad Sharma , drm-intel-fixes@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] drm/i915: Add missing rpm wakelock to GGTT pread X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Joonas spotted a discrepancy between the pwrite and pread ioctls, in that pwrite takes the rpm wakelock around its GGTT access, The wakelock is required in order for the GTT to function. In disregard for the current convention, we take the rpm wakelock around the access itself rather than around the struct_mutex as the nesting is not strictly required and such ordering will one day be fixed by explicitly noting the barrier dependencies between the GGTT and rpm. Fixes: b50a53715f09 ("drm/i915: Support for pread/pwrite ...") Reported-by: Joonas Lahtinen Signed-off-by: Chris Wilson Cc: Ankitprasad Sharma Cc: Tvrtko Ursulin Cc: Joonas Lahtinen Cc: drm-intel-fixes@lists.freedesktop.org Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_gem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 9bef2c0803a5..9cb838ef8d02 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -887,9 +887,12 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, ret = i915_gem_shmem_pread(dev, obj, args, file); /* pread for non shmem backed objects */ - if (ret == -EFAULT || ret == -ENODEV) + if (ret == -EFAULT || ret == -ENODEV) { + intel_runtime_pm_get(to_i915(dev)); ret = i915_gem_gtt_pread(dev, obj, args->size, args->offset, args->data_ptr); + intel_runtime_pm_put(to_i915(dev)); + } out: i915_gem_object_put(obj);