Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: yaolu@kylinos.cn
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/xe/gt: Log LMTT init failure and block VF operations
Date: Thu, 26 Nov 2026 13:27:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-235597@kernel.org> (raw)
In-Reply-To: <20261126131441.1734445-1-yaolu@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe/pf: NULL deref in xe_lmtt_page_size() via unguarded
  debugfs paths
--

commit 2b2063f5a4b0e6ca91307ed198eee693dd8674d9
Author: Lu Yao <yaolu@kylinos.cn>

drm/xe/gt: Log LMTT init failure and block VF operations

This commit logs an error when xe_lmtt_init() fails during GT initialization
while keeping the PF alive, and adds a readiness check in
xe_sriov_pf_wait_ready() to reject subsequent VF operations when the LMTT
is uninitialized.

Link: https://lore.kernel.org/dri-devel/20261119095003.reakox5n3mhp5utx@intel.com/

> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.c b/drivers/gpu/drm/xe/xe_sriov_pf.c
> index 33bd754d138fa..2122964610a0f 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf.c
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf.c
[ ... ]
> @@ -143,6 +145,18 @@ int xe_sriov_pf_init_late(struct xe_device *xe)
>  	return 0;
>  }
>  
> +static int pf_check_lmtt(struct xe_device *xe)
> +{
> +	struct xe_tile *tile;
> +	unsigned int id;
> +
> +	for_each_tile(tile, xe, id)
> +		if (!xe_lmtt_is_ready(&tile->sriov.pf.lmtt))
> +			return -ENODEV;
> +
> +	return 0;
> +}
> +
>  /**
>   * xe_sriov_pf_wait_ready() - Wait until PF is ready to operate.
>   * @xe: the &xe_device to test
> @@ -160,6 +174,10 @@ int xe_sriov_pf_wait_ready(struct xe_device *xe)
>  	if (xe_device_wedged(xe))
>  		return -ECANCELED;
>  
> +	err = pf_check_lmtt(xe);
> +	if (err)
> +		return err;

[Severity: Medium]
Can PF-side VF debugfs handlers still reach the uninitialized LMTT and
dereference a NULL lmtt->ops pointer when xe_lmtt_init() fails?

When xe_lmtt_init() fails, it clears lmtt->ops and leaves lmtt->pd NULL,
while gt_init_lmtt() lets probe complete and register SR-IOV debugfs files.
Not all PF-side VF debugfs entry points call xe_sriov_pf_wait_ready().  For
example, writing a KLV blob containing GUC_KLV_VF_CFG_LMEM_SIZE_KEY to
config_blob runs config_blob_write() -> xe_gt_sriov_pf_config_restore() ->
pf_restore_vf_config_klv() -> pf_provision_vf_lmem() ->
pf_get_lmem_alignment() -> xe_lmtt_page_size(), which hits
lmtt_assert(lmtt, lmtt->ops) and dereferences lmtt->ops in
lmtt_page_size().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126131441.1734445-1-yaolu@kylinos.cn?part=1

  parent reply	other threads:[~2026-11-26 13:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  8:54 [PATCH] drm/xe/gt: Abort GT init on LMTT initialization failure yaolu
2026-11-18 14:02 ` ✓ CI.KUnit: success for " Patchwork
2026-11-18 14:44 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-18 20:03 ` [PATCH] " Summers, Stuart
2026-11-19  9:50   ` Piotr Piórkowski
     [not found]     ` <20261126131441.1734445-1-yaolu@kylinos.cn>
2026-11-26 13:27       ` sashiko-bot [this message]
2026-11-19  6:00 ` ✓ Xe.CI.FULL: success for " 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-235597@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yaolu@kylinos.cn \
    /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