From patchwork Wed Jan 5 14:58:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12704455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 657A8C43217 for ; Wed, 5 Jan 2022 15:00:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B289B10FAF4; Wed, 5 Jan 2022 15:00:15 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 828D810FAF8; Wed, 5 Jan 2022 15:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641394813; x=1672930813; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MTvPVnisEXbaMTys4ep5X2aJzUPbt+lEaOCT1g6iXCU=; b=OlXu504qbgtsuwJTsYXjw2hn8GkrT9i7KJuk/vfXGXey3QJV0AqgNHDX M4HQyNgtJCe9GFGl8VMr1AaduLCEXGK//sonR0yiHjz2RXwNzoQ/504u2 +0KL/daWlU8cg7mjV8cgcpKd5kazzchOMcJ+EqZwaX+5FtYhqOwH+MNY0 yEQEUXK/Q+IFzaNif2SbJ9pNZH9y7qdvZ17mFU4wAVtJk5HBIkTEVuveg KrjT6DT2JihWz0kYV6NNQsFlYYHTPgil3O+hKRYUobRj94n9acpWWUFYU y8g38LxJK/HaZIeCFXx4Kx6qN5Tt1s7jktsNwzsNV4B5t1pyGd3/2fxos g==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="239999792" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="239999792" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 07:00:13 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="512979184" Received: from unknown (HELO mwauld-desk1.intel.com) ([10.252.26.67]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 07:00:12 -0800 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Subject: [PATCH 3/4] drm/i915/ttm: ensure we unmap when purging Date: Wed, 5 Jan 2022 14:58:34 +0000 Message-Id: <20220105145835.142950-3-matthew.auld@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220105145835.142950-1-matthew.auld@intel.com> References: <20220105145835.142950-1-matthew.auld@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Thomas_Hellstr=C3=B6m?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Purging can happen during swapping out, or directly invoked with the madvise ioctl. In such cases this doesn't involve a ttm move, which skips umapping the object. Fixes: cf3e3e86d779 ("drm/i915: Use ttm mmap handling for ttm bo's.") Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index 8d61d4538a64..f148e7e48f86 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -399,6 +399,8 @@ int i915_ttm_purge(struct drm_i915_gem_object *obj) if (obj->mm.madv == __I915_MADV_PURGED) return 0; + ttm_bo_unmap_virtual(bo); + ret = ttm_bo_validate(bo, &place, &ctx); if (ret) return ret;