Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alan Previn" <alan.previn.teres.alexis@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v10 3/3] drm/xe/guc: Add dump_cache to optimize GuC CT/Log compression flow
Date: Tue, 06 Oct 2026 18:04:57 +0000	[thread overview]
Message-ID: <sashiko-outbox-162316@kernel.org> (raw)
In-Reply-To: <20261006175129.3366784-8-alan.previn.teres.alexis@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] locking: Sleeping in atomic context when freeing vmalloc'd dump cache under spinlock
--

commit 4127e505817735f2e0895aab3e86bcc1556be816
Author: Alan Previn <alan.previn.teres.alexis@intel.com>
Date:   Tue Oct 6 17:51:31 2026 +0000

drm/xe/guc: Add dump_cache to optimize GuC CT/Log compression flow
    
This commit introduces a dump_cache structure to store a compressed copy
of the GuC CT and log buffers. This avoids recompressing the buffers
multiple times during xe_devcoredump preparation.

> diff --git a/drivers/gpu/drm/xe/xe_guc_log.c b/drivers/gpu/drm/xe/xe_guc_log.c
> index 47adaf70d5bfb..90aeaccea596c 100644
> --- a/drivers/gpu/drm/xe/xe_guc_log.c
> +++ b/drivers/gpu/drm/xe/xe_guc_log.c

[ ... ]

> @@ -296,30 +310,48 @@ static void xe_guc_print_blob_compressed(struct xe_gt *gt, struct drm_printer *p
>  err:
> -	drm_printf(p, "%s.length: 0x%zx Algo: ERROR (compression failed)\n",
> -		   length_label, total_size);
> -out:
>  	kvfree(dst);
>  	kvfree(wksp);
>  }
>  #endif
>  
> +/**
> + * xe_guc_dump_cache_fini - release a dump blob's compression cache
> + * @cache: cache embedded in the snapshot being freed
> + */
> +void xe_guc_dump_cache_fini(struct xe_guc_dump_cache *cache)
> +{
> +	kvfree(cache->data);

[Severity: High]
Does this code risk sleeping in an atomic context when xe_guc_dump_cache_fini()
is called?

The xe_guc_dump_cache_fini() function calls kvfree() on cache->data, which
may be backed by vmalloc() if the compressed blob was large.

In drivers/gpu/drm/xe/xe_guc_ct.c, the ct_dead_worker_func() workqueue function
calls xe_guc_log_snapshot_free() while holding the ct->dead.lock spinlock:

	spin_lock_irq(&ct->dead.lock);

	xe_guc_log_snapshot_free(ct->dead.snapshot_log);

Calling kvfree() on a vmalloc pointer triggers vfree(), which can sleep while
acquiring the vmap_area_lock or performing page tree operations, potentially
leading to a deadlock since hardware interrupts are disabled.

> +	cache->data = NULL;
> +	cache->size = 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261006175129.3366784-5-alan.previn.teres.alexis@intel.com?part=3

  reply	other threads:[~2026-10-06 18:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 17:51 [PATCH v10 0/3] drm/xe/guc: Compress GuC log and CTB dump with zstd Alan Previn
2026-10-06 17:51 ` [PATCH v10 1/3] drm/xe: Remove extra newlines from LRC snapshot dump Alan Previn
2026-10-06 17:51 ` [PATCH v10 2/3] drm/xe/guc: Compress GuC log and CTB dump with zstd Alan Previn
2026-10-06 17:51 ` [PATCH v10 3/3] drm/xe/guc: Add dump_cache to optimize GuC CT/Log compression flow Alan Previn
2026-10-06 18:04   ` sashiko-bot [this message]
2026-10-06 17:57 ` ✗ CI.checkpatch: warning for drm/xe/guc: Compress GuC log and CTB dump with zstd (rev6) Patchwork
2026-10-06 17:59 ` ✓ CI.KUnit: success " Patchwork
2026-10-06 18:16 ` ✗ CI.checksparse: warning " Patchwork
2026-10-06 18:39 ` ✓ Xe.CI.BAT: success " Patchwork
2026-10-06 23:46 ` ✗ 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=sashiko-outbox-162316@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alan.previn.teres.alexis@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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