Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	intel-xe@lists.freedesktop.org
Cc: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>,
	Matthew Brost <matthew.brost@intel.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v16 3/7] drm/ttm: Use fault-injection to test error paths
Date: Thu, 6 Feb 2025 15:04:38 +0100	[thread overview]
Message-ID: <b5711d1b-07e0-40fc-9ad4-984e80fff3e5@amd.com> (raw)
In-Reply-To: <20250130101325.3068-4-thomas.hellstrom@linux.intel.com>

Am 30.01.25 um 11:13 schrieb Thomas Hellström:
> Use fault-injection to test partial TTM swapout and interrupted swapin.
> Return -EINTR for swapin to test the callers ability to handle and
> restart the swapin, and on swapout perform a partial swapout to test that
> the swapin and release_shrunken functionality.
>
> v8:
> - Use the core fault-injection system.
> v9:
> - Fix compliation failure for !CONFIG_FAULT_INJECTION
>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: <dri-devel@lists.freedesktop.org>
> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Reviewed-by: Matthew Brost <matthew.brost@intel.com> #v7

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/ttm/ttm_pool.c | 25 ++++++++++++++++++++++++-
>   1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
> index ffb7abf52bab..83b10706ba89 100644
> --- a/drivers/gpu/drm/ttm/ttm_pool.c
> +++ b/drivers/gpu/drm/ttm/ttm_pool.c
> @@ -48,6 +48,13 @@
>   
>   #include "ttm_module.h"
>   
> +#ifdef CONFIG_FAULT_INJECTION
> +#include <linux/fault-inject.h>
> +static DECLARE_FAULT_ATTR(backup_fault_inject);
> +#else
> +#define should_fail(...) false
> +#endif
> +
>   /**
>    * struct ttm_pool_dma - Helper object for coherent DMA mappings
>    *
> @@ -514,6 +521,12 @@ static int ttm_pool_restore_commit(struct ttm_pool_tt_restore *restore,
>   		if (ttm_backup_page_ptr_is_handle(p)) {
>   			unsigned long handle = ttm_backup_page_ptr_to_handle(p);
>   
> +			if (IS_ENABLED(CONFIG_FAULT_INJECTION) && ctx->interruptible &&
> +			    should_fail(&backup_fault_inject, 1)) {
> +				ret = -EINTR;
> +				break;
> +			}
> +
>   			if (handle == 0) {
>   				restore->restored_pages++;
>   				continue;
> @@ -1007,7 +1020,13 @@ long ttm_pool_backup(struct ttm_pool *pool, struct ttm_tt *tt,
>   
>   	alloc_gfp = GFP_KERNEL | __GFP_HIGH | __GFP_NOWARN | __GFP_RETRY_MAYFAIL;
>   
> -	for (i = 0; i < tt->num_pages; ++i) {
> +	num_pages = tt->num_pages;
> +
> +	/* Pretend doing fault injection by shrinking only half of the pages. */
> +	if (IS_ENABLED(CONFIG_FAULT_INJECTION) && should_fail(&backup_fault_inject, 1))
> +		num_pages = DIV_ROUND_UP(num_pages, 2);
> +
> +	for (i = 0; i < num_pages; ++i) {
>   		s64 shandle;
>   
>   		page = tt->pages[i];
> @@ -1293,6 +1312,10 @@ int ttm_pool_mgr_init(unsigned long num_pages)
>   			    &ttm_pool_debugfs_globals_fops);
>   	debugfs_create_file("page_pool_shrink", 0400, ttm_debugfs_root, NULL,
>   			    &ttm_pool_debugfs_shrink_fops);
> +#ifdef CONFIG_FAULT_INJECTION
> +	fault_create_debugfs_attr("backup_fault_inject", ttm_debugfs_root,
> +				  &backup_fault_inject);
> +#endif
>   #endif
>   
>   	mm_shrinker = shrinker_alloc(0, "drm-ttm_pool");


  reply	other threads:[~2025-02-06 14:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30 10:13 [PATCH v16 0/7] TTM shrinker helpers and xe buffer object shrinker Thomas Hellström
2025-01-30 10:13 ` [PATCH v16 1/7] drm/ttm: Provide a shmem backup implementation Thomas Hellström
2025-01-31 15:06   ` Christian König
2025-01-30 10:13 ` [PATCH v16 2/7] drm/ttm/pool, drm/ttm/tt: Provide a helper to shrink pages Thomas Hellström
2025-02-05 14:02   ` Christian König
2025-02-18 15:40     ` Thomas Hellström
2025-02-25  8:26       ` RESEND " Thomas Hellström
2025-03-05  3:01         ` Dave Airlie
2025-03-05  9:10           ` Christian König
2025-03-06 10:05             ` Thomas Hellström
2025-03-06 10:00           ` Thomas Hellström
2025-01-30 10:13 ` [PATCH v16 3/7] drm/ttm: Use fault-injection to test error paths Thomas Hellström
2025-02-06 14:04   ` Christian König [this message]
2025-01-30 10:13 ` [PATCH v16 4/7] drm/ttm: Add a macro to perform LRU iteration Thomas Hellström
2025-01-30 10:13 ` [PATCH v16 5/7] drm/ttm: Add helpers for shrinking Thomas Hellström
2025-01-30 10:13 ` [PATCH v16 6/7] drm/xe: Add a shrinker for xe bos Thomas Hellström
2025-02-06 14:06   ` Christian König
2025-01-30 10:13 ` [PATCH v16 7/7] drm/xe: Increase the XE_PL_TT watermark Thomas Hellström
2025-01-30 10:52 ` ✓ CI.Patch_applied: success for TTM shrinker helpers and xe buffer object shrinker (rev17) Patchwork
2025-01-30 10:52 ` ✗ CI.checkpatch: warning " Patchwork
2025-01-30 10:54 ` ✓ CI.KUnit: success " Patchwork
2025-01-30 11:10 ` ✓ CI.Build: " Patchwork
2025-01-30 11:16 ` ✓ CI.Hooks: " Patchwork
2025-01-30 11:27 ` ✗ CI.checksparse: warning " Patchwork
2025-01-30 11:40 ` ✓ Xe.CI.BAT: success " Patchwork
2025-01-30 13:47 ` ✗ Xe.CI.Full: failure " Patchwork

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=b5711d1b-07e0-40fc-9ad4-984e80fff3e5@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Amaranath.Somalapuram@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    /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