Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5254915imu; Tue, 15 Jan 2019 14:10:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN5KTg6UI6wiGIOIYOmyGnM767j7/Tvs7Y80EeJcaB942W9Gwsn2KQWFUrm6lySRp2uA9axW X-Received: by 2002:a63:e5c:: with SMTP id 28mr5349706pgo.369.1547590232363; Tue, 15 Jan 2019 14:10:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547590232; cv=none; d=google.com; s=arc-20160816; b=M06kBUeAWvfvjvpgsSdyK+ntHTmDz5XJfwQmvZ5vz4YPOAatJJ0AOPcSz1zbK+Tr2j j9RECFHwBaLyhk2BC3r3rVRr74WhmlNmurzDKwkmJqo+IZEx17IimuS/g3FDWR05Fwwz NDkesPj3DZRCBmSei4Ylt0ec3er/MrPoUEvcr5S+IHoTW8qY83Z2wUJedjG1Hyqlx9Ko zzHl0n4gujH0q71BlQS10gu6qIZMdmwI3xi04/XIasx1yuNvaVdzqO/nnTjRL07yciZv djbhpRzlV5qrhyw8xdxSPFmodXF0M8fCRuFAQpn+xN3aP64LiRyzphtvbtFD64lE9ukO 2TfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qF4abqVZxfZbEwp2e56esJlZsiMEG+RAFGwGnWqE2sY=; b=LDfc+21bdQqILA5mc/G8ZB6qvoGqfuz2qxg1NOR+w7POuMd0+PbDfYoPMLHhbxL6Mm fd14GQBG1e8YOwaFGeKGOwao9FlMxbSRJi69RQ+904/xCAqklqzxlJHK87qGkRDH8NcN FIdhBI42O/CyAubMZVgifJ00TyKF7iDynGJOz12zzvuAzrvGfQWC880ro69hybIU/Nmu dbkKBhnYqsMXvA+TZKtoPHk8Nz+hvC1XXyUga/KGbswyeQ3Kp9GgXyaTPLfaAZkk82d0 TC1d/9Gqj2kafZDahnYGu7yoS6jHCfZjnw+idn29OJIqS+1Mi4IjRHQt2YRVu+zuGSGj llcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o+ATUUBz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a13si4259954pgh.561.2019.01.15.14.10.16; Tue, 15 Jan 2019 14:10:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o+ATUUBz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732287AbfAOQsR (ORCPT + 99 others); Tue, 15 Jan 2019 11:48:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:34854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387708AbfAOQpK (ORCPT ); Tue, 15 Jan 2019 11:45:10 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 097552054F; Tue, 15 Jan 2019 16:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547570709; bh=Rj/cmFtFaLg7xtn58edwVQzAUrYLZVJzoJIYWleiIaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o+ATUUBzXCd+40yVF55ouPeDrNBwU8J6pTIGKn8t9i55yyoFPlBKlZFi4xj4B3QF6 TmPJp9yvTRJGSiBdsycseoTueVwieT0dzyIzy7A3C1x2DSL9rsLypGstlJPcLWscIs e9a7inf0hG8T5i1N+1Urw21lkzFybh7wrd/RnZY0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Joonas Lahtinen , Mika Kuoppala , Matthew Auld , Jani Nikula Subject: [PATCH 4.20 43/57] drm/i915: Unwind failure on pinning the gen7 ppgtt Date: Tue, 15 Jan 2019 17:36:24 +0100 Message-Id: <20190115154913.350212370@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115154910.734892368@linuxfoundation.org> References: <20190115154910.734892368@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chris Wilson commit 280d479b310298dfeb1d6f9a1617eca37beb6ce4 upstream. If we fail to pin the ggtt vma slot for the ppgtt page tables, we need to unwind the locals before reporting the error. Or else on subsequent attempts to bind the page tables into the ggtt, we will already believe that the vma has been pinned and continue on blithely. If something else should happen to be at that location, choas ensues. Fixes: a2bbf7148342 ("drm/i915/gtt: Only keep gen6 page directories pinned while active") Signed-off-by: Chris Wilson Cc: Joonas Lahtinen Cc: Mika Kuoppala Cc: Matthew Auld Cc: # v4.19+ Reviewed-by: Matthew Auld Link: https://patchwork.freedesktop.org/patch/msgid/20181222030623.21710-1-chris@chris-wilson.co.uk (cherry picked from commit d4de753526f4d99f541f1b6ed1d963005c09700c) Signed-off-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/i915_gem_gtt.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -2117,6 +2117,7 @@ static struct i915_vma *pd_vma_create(st int gen6_ppgtt_pin(struct i915_hw_ppgtt *base) { struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(base); + int err; /* * Workaround the limited maximum vma->pin_count and the aliasing_ppgtt @@ -2132,9 +2133,17 @@ int gen6_ppgtt_pin(struct i915_hw_ppgtt * allocator works in address space sizes, so it's multiplied by page * size. We allocate at the top of the GTT to avoid fragmentation. */ - return i915_vma_pin(ppgtt->vma, - 0, GEN6_PD_ALIGN, - PIN_GLOBAL | PIN_HIGH); + err = i915_vma_pin(ppgtt->vma, + 0, GEN6_PD_ALIGN, + PIN_GLOBAL | PIN_HIGH); + if (err) + goto unpin; + + return 0; + +unpin: + ppgtt->pin_count = 0; + return err; } void gen6_ppgtt_unpin(struct i915_hw_ppgtt *base)