From patchwork Tue Aug 9 16:47:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9271823 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 5977860754 for ; Tue, 9 Aug 2016 16:48:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B38827CFC for ; Tue, 9 Aug 2016 16:48:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E7B32839B; Tue, 9 Aug 2016 16:48:00 +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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B4A8D27CFC for ; Tue, 9 Aug 2016 16:47:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B83D6E09E; Tue, 9 Aug 2016 16:47:59 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F0266E09E for ; Tue, 9 Aug 2016 16:47:58 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id o80so4324095wme.0 for ; Tue, 09 Aug 2016 09:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id; bh=zHkW/WVkrct2k4Yyx2BO4Ku0uRwUqV6+7SVPUn5Ltro=; b=GHPTqU4kKK4mKugisIzsFxqXXv/fP2xL9pTUjCwQ0v3XHTk70Ki6WqVO8BspUkuvt8 JUl9WvisrepcwCmkwgOZGecZG5YpNPaQ4lxFaLfsTmE8Mnb8HUbYjxR0wEaztxBLSxSY RH6mf0R4p7tyfIytXlhduh+lP7TjYcay0rbyX7A15WF0CHvEmdu5YzRG+vWPa54ZAL3j xWRiztakOoq06Fu/4h4gor20dq6egl/vtQf/3m7dLkIdKdClp7Cx6QT8bDx+L8D+iK/d L0HSge1Y9gpIDjsKDQ4JMEWOx838HIbzXP0iAhvSQPSCu2I/Zm3Cral+Pxqwz3Uw9Ham 1Xeg== 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:subject:date:message-id; bh=zHkW/WVkrct2k4Yyx2BO4Ku0uRwUqV6+7SVPUn5Ltro=; b=DeLPUX1OOBvpr2bnzhmezd4TDgXwfxn+gzx5UHKCSzEG+9w+XixI7ZtP+wLpgRuRn6 upeUzwARzoHEyrrmsfbEVJhr7mOU5AHfp6HOvT9OpKJROZcWx9pqbxlFSsHcTrEFC5XQ JlSLXlJOhEL2oNow2MxyJIvVXkbLmglII88bv3IkmsUVZKKgAwX8KD4hQV1oC9XuTZU+ K/+F63fdZL56eQtdNOWM2LKyRh697xMtYlrn/2SY47jSgJ4ALQh84KjJPmvTN47EaqjK Qq2XuP1B8pBfwF4cyxExKWXsWNKcP4LPTpHBmEJ7ITEqvOW36anVwtIDN7qLOwIOJG0Q FvFg== X-Gm-Message-State: AEkoouvkd982uyB30UwxVUM4TehcI7Zhc5HS25O968DWZHta5Kkv2R33YybUFErYy54neQ== X-Received: by 10.28.228.132 with SMTP id b126mr24161518wmh.93.1470761276676; Tue, 09 Aug 2016 09:47:56 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id al10sm38837059wjc.12.2016.08.09.09.47.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2016 09:47:55 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Tue, 9 Aug 2016 17:47:50 +0100 Message-Id: <1470761272-1245-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 Subject: [Intel-gfx] [CI 1/3] drm/i915: Always mark the writer as also a read for busy ioctl 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 One of the few guarantees we want the busy ioctl to provide is that the reported busy writer is included in the set of busy read engines. This should be provided by the ordering of setting and retiring the active trackers, but we can do better by explicitly setting the busy read engine flag for the last writer. Signed-off-by: Chris Wilson Cc: Daniel Vetter --- drivers/gpu/drm/i915/i915_gem.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index d71fa9a93afa..0478e4610da4 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -3748,7 +3748,7 @@ static __always_inline unsigned int __busy_read_flag(unsigned int id) static __always_inline unsigned int __busy_write_id(unsigned int id) { - return id; + return id | __busy_read_flag(id); } static __always_inline unsigned int @@ -3857,9 +3857,11 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, args->busy |= busy_check_reader(&obj->last_read[idx]); /* For ABI sanity, we only care that the write engine is in - * the set of read engines. This is ensured by the ordering - * of setting last_read/last_write in i915_vma_move_to_active, - * and then in reverse in retire. + * the set of read engines. This should be ensured by the + * ordering of setting last_read/last_write in + * i915_vma_move_to_active(), and then in reverse in retire. + * However, for good measure, we always report the last_write + * request as a busy read as well as being a busy write. * * We don't care that the set of active read/write engines * may change during construction of the result, as it is