Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Radhakrishna Sripada <radhakrishna.sripada@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris.p.wilson@intel.com>, stable@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/dpt: Use shmem for dpt objects
Date: Wed, 19 Jul 2023 14:36:18 +0100	[thread overview]
Message-ID: <37f64727-9bbd-c967-193c-97266dfc1331@linux.intel.com> (raw)
In-Reply-To: <20230718225118.2562132-1-radhakrishna.sripada@intel.com>


On 18/07/2023 23:51, Radhakrishna Sripada wrote:
> Dpt objects that are created from internal get evicted when there is
> memory pressure and do not get restored when pinned during scanout. The
> pinned page table entries look corrupted and programming the display
> engine with the incorrect pte's result in DE throwing pipe faults.
> 
> Create DPT objects from shmem and mark the object as dirty when pinning so
> that the object is restored when shrinker evicts an unpinned buffer object.
> 
> v2: Unconditionally mark the dpt objects dirty during pinning(Chris).
> 
> Fixes: 0dc987b699ce ("drm/i915/display: Add smem fallback allocation for dpt")
> Cc: <stable@vger.kernel.org> # v6.0+
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Suggested-by: Chris Wilson <chris.p.wilson@intel.com>
> Signed-off-by: Fei Yang <fei.yang@intel.com>
> Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_dpt.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dpt.c b/drivers/gpu/drm/i915/display/intel_dpt.c
> index 7c5fddb203ba..fbfd8f959f17 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpt.c
> +++ b/drivers/gpu/drm/i915/display/intel_dpt.c
> @@ -166,6 +166,8 @@ struct i915_vma *intel_dpt_pin(struct i915_address_space *vm)
>   		i915_vma_get(vma);
>   	}
>   
> +	dpt->obj->mm.dirty = true;
> +
>   	atomic_dec(&i915->gpu_error.pending_fb_pin);
>   	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
>   
> @@ -261,7 +263,7 @@ intel_dpt_create(struct intel_framebuffer *fb)
>   		dpt_obj = i915_gem_object_create_stolen(i915, size);
>   	if (IS_ERR(dpt_obj) && !HAS_LMEM(i915)) {
>   		drm_dbg_kms(&i915->drm, "Allocating dpt from smem\n");
> -		dpt_obj = i915_gem_object_create_internal(i915, size);
> +		dpt_obj = i915_gem_object_create_shmem(i915, size);
>   	}
>   	if (IS_ERR(dpt_obj))
>   		return ERR_CAST(dpt_obj);

Okay I think I get it after some more looking at the DPT code paths. 
Problem seems pretty clear - page tables are stored in dpt_obj and so 
are lost when backing store is discarded.

Changing to shmem object indeed looks the easiest option.

Some related thoughts:

1)
I wonder if intel_dpt_suspend/resume remain needed after this patch. 
Could you investigate please? On a glance their job was to restore the 
PTEs which would be lost from internal objects backing storage. With 
shmem objects that content should be preserved.

2)
I wonder if i915_vma_flush_writes should be used (as a companion of 
i915_vma_pin_iomap) from DPT dpt_bind_vma, dpt_insert_entries, etc. But 
then I am also not sure if it does the right thing for the 
i915_gem_object_pin_map path of i915_vma_pin_iomap. Perhaps it should 
call __i915_gem_object_flush_map itself for that mapping flavour and not 
do the ggtt flushing in that case.

In summary I think the fix is safe and correct but at least point 1) I 
think needs looking into. It can be a follow up work too.

Regards,

Tvrtko

  parent reply	other threads:[~2023-07-19 13:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 22:51 [Intel-gfx] [PATCH v2] drm/i915/dpt: Use shmem for dpt objects Radhakrishna Sripada
2023-07-19  0:27 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/dpt: Use shmem for dpt objects (rev2) Patchwork
2023-07-19  2:50 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2023-07-21  4:50   ` Sripada, Radhakrishna
2023-07-19 13:36 ` Tvrtko Ursulin [this message]
2023-07-19 20:53   ` [Intel-gfx] [PATCH v2] drm/i915/dpt: Use shmem for dpt objects Yang, Fei
2023-07-20  9:16     ` Tvrtko Ursulin
2023-07-20 17:02       ` Sripada, Radhakrishna
2023-07-21  8:17         ` Tvrtko Ursulin
2023-07-21 23:54           ` Sripada, Radhakrishna
2023-07-24 13:01             ` Tvrtko Ursulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37f64727-9bbd-c967-193c-97266dfc1331@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris.p.wilson@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=radhakrishna.sripada@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox