Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe/mocs: Check that MOCS table.ops is assigned
Date: Wed, 26 Jun 2024 23:31:09 +0200	[thread overview]
Message-ID: <bc86de52-01a2-478d-917e-60bdb04860e2@intel.com> (raw)
In-Reply-To: <20240626211256.1620889-2-matthew.d.roper@intel.com>



On 26.06.2024 23:12, Matt Roper wrote:
> When MOCS debugfs dumping was added in commit 9fbd0adbcbe8
> ("drm/xe/mocs: Add debugfs node to dump mocs"), a sanity check was added
> to xe_mocs_dump() to ensure table.ops->dump is not a NULL pointer.  The
> more common programmer mistake when adding MOCS enablement for new
> platforms is to simply forget to assign anything to table.ops
> altogether.  Extend the check to also cover a NULL table.ops and add a
> WARN() so that CI will help us catch these mistakes when new platforms
> are enabled in the future.

but for the programming mistakes, shouldn't we use xe_assert() instead?

and in get_mocs_settings() there is already:

	xe_assert(xe, !info->ops || info->ops->dump);

maybe it just needs to be updated?

> 
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_mocs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_mocs.c b/drivers/gpu/drm/xe/xe_mocs.c
> index de3f2d3f1b04..d43900d351f1 100644
> --- a/drivers/gpu/drm/xe/xe_mocs.c
> +++ b/drivers/gpu/drm/xe/xe_mocs.c
> @@ -779,7 +779,7 @@ void xe_mocs_dump(struct xe_gt *gt, struct drm_printer *p)
>  
>  	flags = get_mocs_settings(xe, &table);
>  
> -	if (!table.ops->dump)
> +	if (xe_gt_WARN_ON(gt, !table.ops || !table.ops->dump))
>  		return;
>  
>  	xe_pm_runtime_get_noresume(xe);

  reply	other threads:[~2024-06-26 21:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26 21:12 [PATCH] drm/xe/mocs: Check that MOCS table.ops is assigned Matt Roper
2024-06-26 21:31 ` Michal Wajdeczko [this message]
2024-06-27 19:51   ` Matt Roper
2024-06-26 22:37 ` ✓ CI.Patch_applied: success for " Patchwork
2024-06-26 22:38 ` ✓ CI.checkpatch: " Patchwork
2024-06-26 22:39 ` ✓ CI.KUnit: " Patchwork
2024-06-26 22:55 ` ✓ CI.Build: " Patchwork
2024-06-26 22:59 ` ✓ CI.Hooks: " Patchwork
2024-06-26 23:01 ` ✓ CI.checksparse: " Patchwork
2024-06-26 23:24 ` ✓ CI.BAT: " Patchwork
2024-06-27 10:33 ` ✗ 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=bc86de52-01a2-478d-917e-60bdb04860e2@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.d.roper@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