From patchwork Thu Jun 24 08:42:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Hellstr=C3=B6m?= X-Patchwork-Id: 12341545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C96BC49EA5 for ; Thu, 24 Jun 2021 08:43:12 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E06A5613F8 for ; Thu, 24 Jun 2021 08:43:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E06A5613F8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C6E866EB22; Thu, 24 Jun 2021 08:43:07 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7A0806EB21; Thu, 24 Jun 2021 08:43:06 +0000 (UTC) IronPort-SDR: +/J23F4pa5xuYmk/zusfUtfjLnWIwGw4V3ZfTVPckQ9LIeg8K8rj6xR+Tq4+g7omrjLD8LnRkI POoM04eSjT2w== X-IronPort-AV: E=McAfee;i="6200,9189,10024"; a="205601335" X-IronPort-AV: E=Sophos;i="5.83,296,1616482800"; d="scan'208";a="205601335" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2021 01:43:05 -0700 IronPort-SDR: d+KoUZGvqw5hdmH6uHCLSy1jwkIqSGdyD3wAOPXRGS0WPycGD8r/ZuwXW0xjgronGT5+rYlHle dj2IDXhd1etg== X-IronPort-AV: E=Sophos;i="5.83,296,1616482800"; d="scan'208";a="453344907" Received: from cmutgix-mobl.gar.corp.intel.com (HELO thellst-mobl1.intel.com) ([10.249.254.20]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2021 01:43:03 -0700 From: =?utf-8?q?Thomas_Hellstr=C3=B6m?= To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH v10 0/3] drm/i915: Move system memory to TTM for discrete Date: Thu, 24 Jun 2021 10:42:37 +0200 Message-Id: <20210624084240.270219-1-thomas.hellstrom@linux.intel.com> X-Mailer: git-send-email 2.31.1 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?= , matthew.auld@intel.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Early implementation of moving system memory for discrete cards over to TTM. We first add the notion of objects being migratable under the object lock to i915 gem, and add some asserts to verify that objects are either locked or pinned when the placement is checked by the gem code. Patch 2 deals with updating the i915 gem bookkeeping after a TTM move, Patch 3 moves system over from shmem to TTM for discrete Note that the mock device doesn't consider itself discrete so the TTM system path is not checked by the mock selftests. v2: - Style fixes (reported by Matthew Auld) - Drop the last patch (migration) It needs selftests and some additional work. - Unconditionally add VM_IO at mmap time. v3: - More style fixes (reported by Matthew Auld) - Don't overfill the busy placement vector (reported by Matthew Auld) v4: - Remove confusion around shrinkable objects (reported by Matthew Auld) v5: - Remove confusion around shrinkable objects again, but this time in the correct patch. (reported by Matthew Auld) v6: - One patch already committed. - Introduce a __i915_gem_object_is_lmem() to be used in situations where we know that a fence that can't currently signal keeps the object from being migrated or evicted. - Rebase on accelerated TTM moves - Fix TODO:s for supporting system memory with TTM. - Update the object GEM region after a TTM move if compatible. - Move a couple of warnings for shmem on DGFX. v7: - Just updated a commit message with version history under dashes. v8: - Reinstate alignment at ttm_bo_init_reserved() time. (Reported by Matthew Auld). - When changing regions, also move the object to the new region list and break early. (Reported by Matthew Auld). - Don't flag the object as contiguous based on the current region min pages size. v9: - Remove a DGFX warning in __i915_gem_object_release_shmem since it is called from the userptr code. v10: - Add some comments around the gem object "mem_flags" field, and use a full unsigned int for it. (Suggested by Daniel Vetter). - Add an object locked section while checking mem_flags in the live mman selftest. Thomas Hellström (3): drm/i915: Update object placement flags to be mutable drm/i915/ttm: Adjust gem flags and caching settings after a move drm/i915/ttm: Use TTM for system memory drivers/gpu/drm/i915/gem/i915_gem_internal.c | 4 +- drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 22 ++ drivers/gpu/drm/i915/gem/i915_gem_lmem.h | 2 + drivers/gpu/drm/i915/gem/i915_gem_mman.c | 12 +- drivers/gpu/drm/i915/gem/i915_gem_object.c | 38 ++++ drivers/gpu/drm/i915/gem/i915_gem_object.h | 14 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 27 ++- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_phys.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_region.c | 4 - drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 9 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 196 ++++++++++++++---- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 4 +- .../drm/i915/gem/selftests/huge_gem_object.c | 4 +- .../gpu/drm/i915/gem/selftests/huge_pages.c | 5 +- .../drm/i915/gem/selftests/i915_gem_mman.c | 25 ++- .../drm/i915/gem/selftests/i915_gem_phys.c | 3 +- drivers/gpu/drm/i915/i915_drv.h | 3 - drivers/gpu/drm/i915/i915_gpu_error.c | 2 +- drivers/gpu/drm/i915/intel_memory_region.c | 7 +- drivers/gpu/drm/i915/intel_memory_region.h | 8 + 21 files changed, 288 insertions(+), 105 deletions(-)