From patchwork Wed Nov 27 06:11:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ville Syrjala X-Patchwork-Id: 13886603 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 0ECACD609A0 for ; Wed, 27 Nov 2024 06:11:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A9D9110E40F; Wed, 27 Nov 2024 06:11:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="DhK+F1lF"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 636CA10E2F0 for ; Wed, 27 Nov 2024 06:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732687885; x=1764223885; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QnaqUyixPY9yOPx260hUz69mbuGgnrc/2qTM88kpREA=; b=DhK+F1lFAKZ6TJ643cD1mZ3/+rC/GzJ3CFF6aB2lmYgFX8V0JldsT7IL Udncri9STAIKcefuhu3OnpmXHzBDubbqFqWbxialR19dksxcHdSlQe0Ra TYBsQXYzP2ESCeoABNYHbs1TgWNdl2QDHweY2k0bauMeokyq/laJIVwJJ yqoqmXmkgFjJcSgDg0K5St0dH18xr2O6WYV5qZhaiXu7Y+fiGTTYYc2op tEQ5hgvxJXDPVwOeVqNocbZ/3sUDA/XfaxcXgRVcIwaug6viCuFS5qGE1 rYfSSHX+JibEgRFSDs3kjqpG392ynZdACtm48wdJuim31j6MMhzitob5M Q==; X-CSE-ConnectionGUID: RhB9kV0tRveYadHUP+TA/A== X-CSE-MsgGUID: uSfzo1gMRHyT7DPfRYXxGQ== X-IronPort-AV: E=McAfee;i="6700,10204,11268"; a="33125370" X-IronPort-AV: E=Sophos;i="6.12,188,1728975600"; d="scan'208";a="33125370" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2024 22:11:24 -0800 X-CSE-ConnectionGUID: tAoe4qKZRPGDwd3jb0Gfvw== X-CSE-MsgGUID: rC0dX5yTS3eYkoXZSliXoQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,188,1728975600"; d="scan'208";a="91982013" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 26 Nov 2024 22:11:21 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 27 Nov 2024 08:11:20 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Cc: Brian Geffon , Vidya Srinivas Subject: [PATCH 1/4] drm/i915: Don't reuse commit_work for the cleanup Date: Wed, 27 Nov 2024 08:11:14 +0200 Message-ID: <20241127061117.25622-2-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241127061117.25622-1-ville.syrjala@linux.intel.com> References: <20241127061117.25622-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Ville Syrjälä Currently we reuse the commit_work for a later cleanup step. Let's not do that so that atomic ioctl handler won't accidentally wait for the cleanup work when it really wants to just wait on the commit_tail() part. We'll just add another work struct for the cleanup. Cc: Brian Geffon Cc: Vidya Srinivas Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 6 +++--- drivers/gpu/drm/i915/display/intel_display_types.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 9db255bb1230..5260f6eafaf8 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -7581,7 +7581,7 @@ static void intel_atomic_dsb_cleanup(struct intel_crtc_state *crtc_state) static void intel_atomic_cleanup_work(struct work_struct *work) { struct intel_atomic_state *state = - container_of(work, struct intel_atomic_state, base.commit_work); + container_of(work, struct intel_atomic_state, cleanup_work); struct drm_i915_private *i915 = to_i915(state->base.dev); struct intel_crtc_state *old_crtc_state; struct intel_crtc *crtc; @@ -7936,8 +7936,8 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state) * schedule point (cond_resched()) here anyway to keep latencies * down. */ - INIT_WORK(&state->base.commit_work, intel_atomic_cleanup_work); - queue_work(system_highpri_wq, &state->base.commit_work); + INIT_WORK(&state->cleanup_work, intel_atomic_cleanup_work); + queue_work(system_highpri_wq, &state->cleanup_work); } static void intel_atomic_commit_work(struct work_struct *work) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 339e4b0f7698..d7ce8f01645b 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -587,6 +587,8 @@ struct intel_atomic_state { bool skip_intermediate_wm; bool rps_interactive; + + struct work_struct cleanup_work; }; struct intel_plane_state { From patchwork Wed Nov 27 06:11:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ville Syrjala X-Patchwork-Id: 13886604 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 22502D609A1 for ; Wed, 27 Nov 2024 06:11:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B151110E41A; Wed, 27 Nov 2024 06:11:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="m0n9QRko"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 016A310E2F0 for ; Wed, 27 Nov 2024 06:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732687888; x=1764223888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+y1wepGF0Yyc1ONrPPjR0wKx63tw+RSWs1nLpt7ZxtY=; b=m0n9QRko8Hc8MG3V59kSYqbi46iw/rXpJYGnATtr9xKORH38VpRkPUF4 EYKeR9XpSLmJYwhg6lqqK7ixINtG1Os2DCG5oCTUTP9ZVNRO0zL/Po02N +CnCRif27nkLIqkqLtzws3hVzXsyfXyZznmbSEEONpMUFWEbHV0XkDLTC uouKjkhDgIcDry2qQ1tgOBQPFqnI90BXqMmUZoZeDOalFvz5Mmr+lkphG EOQnfp2RRsi7geepUUaIA+SClDkuXz6sVM6dP42pfNH3uubY4ZvqKCGQZ UK5kk4M3kt0/PeGeo+8PwYp3WA0SgTVOr0esurpBLIdv208btL+xmdEPT A==; X-CSE-ConnectionGUID: qOCPbfCrTueoFWsqMbfA4A== X-CSE-MsgGUID: F0464S+rRdOmS2jI6kLVhA== X-IronPort-AV: E=McAfee;i="6700,10204,11268"; a="33125379" X-IronPort-AV: E=Sophos;i="6.12,188,1728975600"; d="scan'208";a="33125379" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2024 22:11:28 -0800 X-CSE-ConnectionGUID: fc0krJHtTGGIss3Z2etmMg== X-CSE-MsgGUID: MsTen081S5G2efYPHDPWmg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,188,1728975600"; d="scan'208";a="91982041" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 26 Nov 2024 22:11:25 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 27 Nov 2024 08:11:24 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Cc: Brian Geffon , Vidya Srinivas Subject: [PATCH 2/4] drm/i915: Intruduce display.wq.cleanup Date: Wed, 27 Nov 2024 08:11:15 +0200 Message-ID: <20241127061117.25622-3-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241127061117.25622-1-ville.syrjala@linux.intel.com> References: <20241127061117.25622-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Ville Syrjälä Introduce a dedicated workqueue for the commit cleanup work. In the future we'll need this to guarantee all the cleanup works have finished at a specific point during suspend. Cc: Brian Geffon Cc: Vidya Srinivas Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 2 +- drivers/gpu/drm/i915/display/intel_display_core.h | 3 +++ drivers/gpu/drm/i915/display/intel_display_driver.c | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 5260f6eafaf8..4805bf682d43 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -7937,7 +7937,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state) * down. */ INIT_WORK(&state->cleanup_work, intel_atomic_cleanup_work); - queue_work(system_highpri_wq, &state->cleanup_work); + queue_work(dev_priv->display.wq.cleanup, &state->cleanup_work); } static void intel_atomic_commit_work(struct work_struct *work) diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h index 62b0597aa91e..554870d2494b 100644 --- a/drivers/gpu/drm/i915/display/intel_display_core.h +++ b/drivers/gpu/drm/i915/display/intel_display_core.h @@ -554,6 +554,9 @@ struct intel_display { /* unbound hipri wq for page flips/plane updates */ struct workqueue_struct *flip; + + /* hipri wq for commit cleanups */ + struct workqueue_struct *cleanup; } wq; /* Grouping using named structs. Keep sorted. */ diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c index 2a6301b8674a..286d6f893afa 100644 --- a/drivers/gpu/drm/i915/display/intel_display_driver.c +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c @@ -242,6 +242,7 @@ int intel_display_driver_probe_noirq(struct drm_i915_private *i915) i915->display.wq.modeset = alloc_ordered_workqueue("i915_modeset", 0); i915->display.wq.flip = alloc_workqueue("i915_flip", WQ_HIGHPRI | WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE); + i915->display.wq.cleanup = alloc_workqueue("i915_cleanup", WQ_HIGHPRI, 0); intel_mode_config_init(i915); @@ -571,6 +572,7 @@ void intel_display_driver_remove(struct drm_i915_private *i915) flush_workqueue(i915->display.wq.flip); flush_workqueue(i915->display.wq.modeset); + flush_workqueue(i915->display.wq.cleanup); /* * MST topology needs to be suspended so we don't have any calls to @@ -613,6 +615,7 @@ void intel_display_driver_remove_noirq(struct drm_i915_private *i915) destroy_workqueue(i915->display.wq.flip); destroy_workqueue(i915->display.wq.modeset); + destroy_workqueue(i915->display.wq.cleanup); intel_fbc_cleanup(&i915->display); } From patchwork Wed Nov 27 06:11:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ville Syrjala X-Patchwork-Id: 13886605 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 D8ABDD609A0 for ; Wed, 27 Nov 2024 06:11:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F3BD10E41B; Wed, 27 Nov 2024 06:11:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="WJkQ+b7J"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 840CD10E41B for ; Wed, 27 Nov 2024 06:11:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732687894; x=1764223894; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fUd+kId7JrnpuU0nelCSw1p2wTK4ktXTlO8jzVqHgPU=; b=WJkQ+b7Jkm2IiQRmBnCpg8F5+vAsn72SxJ3h4e30pK1vuPDhJYlgoeoO aX9lfWmSRDUfw7kVCBEuy+hzA67wx3ufyME+Dz63xsoxzH4O0IxQHn6Mj XPBc+2A/VwcznMpcAKVlNzqRYB3qrgwqGHp9h51Gmy10sXRGskSW/kcvi NDNriaOeB/q7uyF8t2XwpLTGg6YePlWAmMktLLPIm5/N8pRcKMgXVCOyF 4nNMNi9/PwreKmjujyKN4WqO1kIZHZSRohUP2JlZLMWduyiQuTw8hlYIC KHn13n0Z+waMYqqGk9JKMplVqxEsvXbL5Kz1v0HwfWS1+SYr8SS/p87o1 A==; X-CSE-ConnectionGUID: i/EyYOgvROaHN0Hx6BLRVA== X-CSE-MsgGUID: MUA8GfEORFOxU7u1PScmng== X-IronPort-AV: E=McAfee;i="6700,10204,11268"; a="33125395" X-IronPort-AV: E=Sophos;i="6.12,188,1728975600"; d="scan'208";a="33125395" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2024 22:11:33 -0800 X-CSE-ConnectionGUID: ybY4isJWQU+t1Ecx+wsQNg== X-CSE-MsgGUID: PFNTo6aBR+qrwdZ6vDLr1Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,188,1728975600"; d="scan'208";a="91982068" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 26 Nov 2024 22:11:28 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 27 Nov 2024 08:11:27 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Cc: Brian Geffon , Vidya Srinivas Subject: [PATCH 3/4] drm/i915/dpt: Evict all DPT VMAs on suspend Date: Wed, 27 Nov 2024 08:11:16 +0200 Message-ID: <20241127061117.25622-4-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241127061117.25622-1-ville.syrjala@linux.intel.com> References: <20241127061117.25622-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Ville Syrjälä Currently intel_dpt_resume() tries to blindly rewrite all the PTEs for currently bound DPT VMAs. That is problematic because the CPU mapping for the DPT is only really guaranteed to exist while the DPT object has been pinned. In the past we worked around this issue by making DPT objects unshrinkable, but that is undesirable as it'll waste physical RAM. Let's instead forcefully evict all the DPT VMAs on suspend, thus guaranteeing that intel_dpt_resume() has nothing to do. To guarantee that all the DPT VMAs are evictable by intel_dpt_suspend() we need to flush the cleanup workqueue after the display output has been shut down. And for good measure throw in a few extra WARNs to catch any mistakes. Cc: Brian Geffon Cc: Vidya Srinivas Signed-off-by: Ville Syrjälä --- .../drm/i915/display/intel_display_driver.c | 3 +++ drivers/gpu/drm/i915/display/intel_dpt.c | 4 ++-- drivers/gpu/drm/i915/gt/intel_ggtt.c | 19 ++++++++++++++----- drivers/gpu/drm/i915/gt/intel_gtt.h | 4 ++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c index 286d6f893afa..973bee43b554 100644 --- a/drivers/gpu/drm/i915/display/intel_display_driver.c +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c @@ -680,6 +680,9 @@ int intel_display_driver_suspend(struct drm_i915_private *i915) else i915->display.restore.modeset_state = state; + /* ensure all DPT VMAs have been unpinned for intel_dpt_suspend() */ + flush_workqueue(i915->display.wq.cleanup); + intel_dp_mst_suspend(i915); return ret; diff --git a/drivers/gpu/drm/i915/display/intel_dpt.c b/drivers/gpu/drm/i915/display/intel_dpt.c index ce8c76e44e6a..8b1f0e92a11c 100644 --- a/drivers/gpu/drm/i915/display/intel_dpt.c +++ b/drivers/gpu/drm/i915/display/intel_dpt.c @@ -205,7 +205,7 @@ void intel_dpt_resume(struct drm_i915_private *i915) struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb); if (fb->dpt_vm) - i915_ggtt_resume_vm(fb->dpt_vm); + i915_ggtt_resume_vm(fb->dpt_vm, true); } mutex_unlock(&i915->drm.mode_config.fb_lock); } @@ -233,7 +233,7 @@ void intel_dpt_suspend(struct drm_i915_private *i915) struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb); if (fb->dpt_vm) - i915_ggtt_suspend_vm(fb->dpt_vm); + i915_ggtt_suspend_vm(fb->dpt_vm, true); } mutex_unlock(&i915->drm.mode_config.fb_lock); diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c index d60a6ca0cae5..f6c59f20832f 100644 --- a/drivers/gpu/drm/i915/gt/intel_ggtt.c +++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c @@ -107,11 +107,12 @@ int i915_ggtt_init_hw(struct drm_i915_private *i915) /** * i915_ggtt_suspend_vm - Suspend the memory mappings for a GGTT or DPT VM * @vm: The VM to suspend the mappings for + * @evict_all: Evict all VMAs * * Suspend the memory mappings for all objects mapped to HW via the GGTT or a * DPT page table. */ -void i915_ggtt_suspend_vm(struct i915_address_space *vm) +void i915_ggtt_suspend_vm(struct i915_address_space *vm, bool evict_all) { struct i915_vma *vma, *vn; int save_skip_rewrite; @@ -157,7 +158,7 @@ void i915_ggtt_suspend_vm(struct i915_address_space *vm) goto retry; } - if (!i915_vma_is_bound(vma, I915_VMA_GLOBAL_BIND)) { + if (evict_all || !i915_vma_is_bound(vma, I915_VMA_GLOBAL_BIND)) { i915_vma_wait_for_bind(vma); __i915_vma_evict(vma, false); @@ -172,13 +173,15 @@ void i915_ggtt_suspend_vm(struct i915_address_space *vm) vm->skip_pte_rewrite = save_skip_rewrite; mutex_unlock(&vm->mutex); + + drm_WARN_ON(&vm->i915->drm, evict_all && !list_empty(&vm->bound_list)); } void i915_ggtt_suspend(struct i915_ggtt *ggtt) { struct intel_gt *gt; - i915_ggtt_suspend_vm(&ggtt->vm); + i915_ggtt_suspend_vm(&ggtt->vm, false); ggtt->invalidate(ggtt); list_for_each_entry(gt, &ggtt->gt_list, ggtt_link) @@ -1545,6 +1548,7 @@ int i915_ggtt_enable_hw(struct drm_i915_private *i915) /** * i915_ggtt_resume_vm - Restore the memory mappings for a GGTT or DPT VM * @vm: The VM to restore the mappings for + * @all_evicted: Were all VMAs expected to be evicted on suspend? * * Restore the memory mappings for all objects mapped to HW via the GGTT or a * DPT page table. @@ -1552,13 +1556,18 @@ int i915_ggtt_enable_hw(struct drm_i915_private *i915) * Returns %true if restoring the mapping for any object that was in a write * domain before suspend. */ -bool i915_ggtt_resume_vm(struct i915_address_space *vm) +bool i915_ggtt_resume_vm(struct i915_address_space *vm, bool all_evicted) { struct i915_vma *vma; bool write_domain_objs = false; drm_WARN_ON(&vm->i915->drm, !vm->is_ggtt && !vm->is_dpt); + if (all_evicted) { + drm_WARN_ON(&vm->i915->drm, !list_empty(&vm->bound_list)); + return false; + } + /* First fill our portion of the GTT with scratch pages */ vm->clear_range(vm, 0, vm->total); @@ -1598,7 +1607,7 @@ void i915_ggtt_resume(struct i915_ggtt *ggtt) list_for_each_entry(gt, &ggtt->gt_list, ggtt_link) intel_gt_check_and_clear_faults(gt); - flush = i915_ggtt_resume_vm(&ggtt->vm); + flush = i915_ggtt_resume_vm(&ggtt->vm, false); if (drm_mm_node_allocated(&ggtt->error_capture)) ggtt->vm.scratch_range(&ggtt->vm, ggtt->error_capture.start, diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h b/drivers/gpu/drm/i915/gt/intel_gtt.h index 6b85222ee3ea..0a36ea751b63 100644 --- a/drivers/gpu/drm/i915/gt/intel_gtt.h +++ b/drivers/gpu/drm/i915/gt/intel_gtt.h @@ -608,8 +608,8 @@ int i915_ppgtt_init_hw(struct intel_gt *gt); struct i915_ppgtt *i915_ppgtt_create(struct intel_gt *gt, unsigned long lmem_pt_obj_flags); -void i915_ggtt_suspend_vm(struct i915_address_space *vm); -bool i915_ggtt_resume_vm(struct i915_address_space *vm); +void i915_ggtt_suspend_vm(struct i915_address_space *vm, bool evict_all); +bool i915_ggtt_resume_vm(struct i915_address_space *vm, bool all_evicted); void i915_ggtt_suspend(struct i915_ggtt *gtt); void i915_ggtt_resume(struct i915_ggtt *ggtt); From patchwork Wed Nov 27 06:11:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ville Syrjala X-Patchwork-Id: 13886606 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 397FAD609A0 for ; Wed, 27 Nov 2024 06:11:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D459610E2F0; Wed, 27 Nov 2024 06:11:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="X5SWXKwc"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3604210E2F0 for ; Wed, 27 Nov 2024 06:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732687905; x=1764223905; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GTmywVm8wGK+3xi7gMx1LDBRRoQKj1XPTRE7cjrVGZ4=; b=X5SWXKwcAdh1uT7fNW2khb+iCRRxIqdkbNSF9N8X/5mqc3edHMf95awC jobymCaX6DAtFnsryeJc5i9vtmSV+fIcpxN2GoodctoUy9Fhim39D+fLR /zCVyOTrmdby5Aw7h2Q1DTxyrvZr0Kunc+p7ghfjKBWbw04xVoJ4afTuH 1gqFdc2Y9fIsJZPyvc1AqqM0KN0RKJAfWGvivi6xP7k6VcaEfzlgT9dr3 nNr0DD11mceKSZVveOMivj+mI2Pbp37y4DgxEy0B80NbqxAMNfp4kWvF7 5SbD+pPPALfoEDmusWRwG6rR3qzQxXRt3j2qzh7FnomQFwHERKAKgVRcu Q==; X-CSE-ConnectionGUID: O1qKv0zZSsGiuzsIkHApuQ== X-CSE-MsgGUID: aGAM+AjZRkeLnnYhXx8Nww== X-IronPort-AV: E=McAfee;i="6700,10204,11268"; a="33125427" X-IronPort-AV: E=Sophos;i="6.12,188,1728975600"; d="scan'208";a="33125427" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2024 22:11:45 -0800 X-CSE-ConnectionGUID: gR5tiDrpTZyDkElxk5epIg== X-CSE-MsgGUID: SFJl/pq0TcCxV1dzKrsslQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,188,1728975600"; d="scan'208";a="91982088" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 26 Nov 2024 22:11:32 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 27 Nov 2024 08:11:31 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Cc: Brian Geffon , Vidya Srinivas Subject: [PATCH 4/4] Revert "drm/i915/dpt: Make DPT object unshrinkable" Date: Wed, 27 Nov 2024 08:11:17 +0200 Message-ID: <20241127061117.25622-5-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241127061117.25622-1-ville.syrjala@linux.intel.com> References: <20241127061117.25622-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Ville Syrjälä This reverts commit 51064d471c53dcc8eddd2333c3f1c1d9131ba36c. Now that we forcefully evict all DPT VMAs during suspend there should be no problem allowing the shrinker to eat the DPT objects. Cc: Brian Geffon Cc: Vidya Srinivas Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12965 Signed-off-by: Ville Syrjälä Acked-by: Brian Geffon --- drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm/i915/gem/i915_gem_object.h index 3dc61cbd2e11..bb713e096db2 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_object.h +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h @@ -283,9 +283,7 @@ bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj); static inline bool i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj) { - /* TODO: make DPT shrinkable when it has no bound vmas */ - return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE) && - !obj->is_dpt; + return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE); } static inline bool