From patchwork Wed Oct 19 08:03:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9383697 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 4713260487 for ; Wed, 19 Oct 2016 08:03:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B41C288D2 for ; Wed, 19 Oct 2016 08:03:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2EAE6289DB; Wed, 19 Oct 2016 08:03:45 +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 DBDCD288D2 for ; Wed, 19 Oct 2016 08:03:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 41D9A6E2B5; Wed, 19 Oct 2016 08:03:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 472926E2B5 for ; Wed, 19 Oct 2016 08:03:42 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id f193so2732186wmg.0 for ; Wed, 19 Oct 2016 01:03:42 -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=b0ILckjWd99G6ma0dCyiYNHqtdi/ze5l6z3b7Xru11I=; b=NMaUBb9RRxsEWpNAFkFHhMI8+nIoIn9NX4rxSixt/uGMl6yr0B1OkGjkNV+BdR7mcD FqVp36jLGhW3j/wNGX4kiW3px3tQW8AogLnV+3InXi6UwN/16pk+MbpmLM8vqVaewREL JOvq7aXdCH9rJrjlNXr/yWQ4/00lXYqkUlWtBENLxX+z1eZx2iom1bHeHYSSGLBtdomM 5fsIjmxnLUFj8nbQdMNXz5VB7+oelI/oZRUtjhrH3rp4TjYqXFckpAtV++Ryl0qQevRa /PKww/HiL8v72Ze8U5egA0VXc4zB9GPtF1WRjqE83XYmrLmEWP+7zmRnYI9bV0VeMHi/ d54g== 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=b0ILckjWd99G6ma0dCyiYNHqtdi/ze5l6z3b7Xru11I=; b=QTNC+K4kf7waNBJE1uA8Ti2WprgHVdNDQ/xWlmIz+/LZvhTAbv8zxhpe4SBZKJhaP/ lB0PCQXvFs8ZoQr2898GGMF3ILLvsMBkRMcVauEOIQlHd6agZdwP101wbhC2dkPZP9EN QUln95dW3DodTOaVnZB3s+lut6jCDzhT96aoV5K0CQZBj1+bxwIoVVTLZKN8BNA/uIT5 MA5lLPNQ1QyOwZHrdMHnexKdv7kh2bGBhlwCr54pAZU2L3Lhui3WgAwKzjt1Voy6bsKg XZ/Rrbl+DZrYwOE4zbmCB7lqQNWx1B6LElw4hk/Vcr9vLO5r0AWhtXIpxhswi3k2zB/3 fEbg== X-Gm-Message-State: AA6/9RlXyYgiF3rMWCN2imLiptVTPRKjk85GGsgYBB1v7gSKWZeAIAUA88pmYVbXkzl9qQ== X-Received: by 10.28.9.141 with SMTP id 135mr4230121wmj.68.1476864220556; Wed, 19 Oct 2016 01:03:40 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id y2sm67191133wjx.20.2016.10.19.01.03.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2016 01:03:39 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Wed, 19 Oct 2016 09:03:34 +0100 Message-Id: <20161019080335.19147-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.9.3 Subject: [Intel-gfx] [PATCH 1/2] drm/i915: Catch premature unpinning of pages 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 Try to catch the violation of unpinning the backing storage whilst still bound to the GPU. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_drv.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 33c44c631bab..6c8a104b42ed 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -3181,14 +3181,15 @@ i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n) static inline void i915_gem_object_pin_pages(struct drm_i915_gem_object *obj) { - BUG_ON(obj->pages == NULL); + GEM_BUG_ON(obj->pages == NULL); obj->pages_pin_count++; } static inline void i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj) { - BUG_ON(obj->pages_pin_count == 0); + GEM_BUG_ON(obj->pages_pin_count == 0); obj->pages_pin_count--; + GEM_BUG_ON(obj->pages_pin_count < obj->bind_count); } enum i915_map_type {