Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9103177pxu; Mon, 28 Dec 2020 06:43:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyu+a9KKqqcYZy9jz5k6zLIagXHJ+HWtVHMUytvvxEpypG5nHVv5IKul66rkJp7i1bJNMnl X-Received: by 2002:a17:906:af99:: with SMTP id mj25mr42766649ejb.414.1609166582275; Mon, 28 Dec 2020 06:43:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166582; cv=none; d=google.com; s=arc-20160816; b=kPLPiE+wPpoXgI0gRMyKjuHIm0K/Y6ssITmExaINwomTOulp6Z4XABWUB8ygyPOSMZ h4Gt9V5hNZzc52ZaomCmdr+YqTm9Wr32WWbZcyPSFe91gEecgpnbJPDG9zgvNQBTeVvs Vx6Z2yB3pAaQ0iNydHxD5cFnmSAlJLA5W1s2AUkELIF4oqZvywNtIh3Zly2O8DCPoYKb hrsdSUj7u6bIV76UPDHibHUybQoNJCWkYQD8y/p9pV8AcOUOsuM56z8lU1U93M0+DkOt nwdrAHW6m3iFquq7VrDB74SJNvQOEFvi01nf/9oPo8zNUtIcuFgEqKPWT9STV5CuH8qi AGAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wRKYGO/6RqJjN4RvhyLnHA58g9VoWBeBgSFT0QJWC4o=; b=z7BkojqH+yYqaoCEgnnlO/Ifpzmw58ISR5W8IIqCRfoqkY83/ays86d2ksA51j0tnw RvznQB1OV1P4GZrE+opypKx29IJ6ZsB8xt82yI4OXkPca4ycTIFo+sO3qhTJlNBXhaXq RaXqNS0kx/Y/laIWbKsMwymtJnOXHgjnKxyY+6l6YWfhYIhM7X9GlxV+B/cDXu4X+jjp 8mkudcgT18og7EfANA61d09rSo4HEfhfk8pz+vN0oopC+pTZB4CrH6Kp4fQ6ZYipSA2N z3toh20PCHCTknCO440x8gdEZ7RuuVc9Oeilz0jmXk1q7KoQygQdj4Eq55WYF2fbQcJd fCgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2mp2SBv2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e22si12693702edu.9.2020.12.28.06.42.39; Mon, 28 Dec 2020 06:43:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2mp2SBv2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505789AbgL1OkE (ORCPT + 99 others); Mon, 28 Dec 2020 09:40:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:36662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503555AbgL1O3W (ORCPT ); Mon, 28 Dec 2020 09:29:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 71E18207B2; Mon, 28 Dec 2020 14:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165747; bh=rFds84nruXeeXELKjkbZXs5IHda98QF3gj5mHl0fdHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2mp2SBv2ziGDd6ldraE+TzbABgmt8/rFtab1ENy8zkGQM7MWNzU0B6FJcOi0xYTQT u5sbZ4jOKnSGBa6/qZOboapo+zfI1WUQ3dNwpcm1tYn924a4lzx3BkFg1Ja6LGV1W9 GEOUgaFgybvunjtG+CDlYAslbuda/6X9y4SpdkIc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, CQ Tang , Chris Wilson , Matthew Auld , Jani Nikula Subject: [PATCH 5.10 639/717] drm/i915: Fix mismatch between misplaced vma check and vma insert Date: Mon, 28 Dec 2020 13:50:37 +0100 Message-Id: <20201228125051.545994335@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Wilson commit 0e53656ad8abc99e0a80c3de611e593ebbf55829 upstream. When inserting a VMA, we restrict the placement to the low 4G unless the caller opts into using the full range. This was done to allow usersapce the opportunity to transition slowly from a 32b address space, and to avoid breaking inherent 32b assumptions of some commands. However, for insert we limited ourselves to 4G-4K, but on verification we allowed the full 4G. This causes some attempts to bind a new buffer to sporadically fail with -ENOSPC, but at other times be bound successfully. commit 48ea1e32c39d ("drm/i915/gen9: Set PIN_ZONE_4G end to 4GB - 1 page") suggests that there is a genuine problem with stateless addressing that cannot utilize the last page in 4G and so we purposefully excluded it. This means that the quick pin pass may cause us to utilize a buggy placement. Reported-by: CQ Tang Testcase: igt/gem_exec_params/larger-than-life-batch Fixes: 48ea1e32c39d ("drm/i915/gen9: Set PIN_ZONE_4G end to 4GB - 1 page") Signed-off-by: Chris Wilson Cc: CQ Tang Reviewed-by: CQ Tang Reviewed-by: Matthew Auld Cc: # v4.5+ Link: https://patchwork.freedesktop.org/patch/msgid/20201216092951.7124-1-chris@chris-wilson.co.uk (cherry picked from commit 5f22cc0b134ab702d7f64b714e26018f7288ffee) Signed-off-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c @@ -382,7 +382,7 @@ eb_vma_misplaced(const struct drm_i915_g return true; if (!(flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS) && - (vma->node.start + vma->node.size - 1) >> 32) + (vma->node.start + vma->node.size + 4095) >> 32) return true; if (flags & __EXEC_OBJECT_NEEDS_MAP &&