All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe: Initialize freq_lock even with skip_guc_pc
Date: Fri, 12 Jan 2024 16:10:37 -0500	[thread overview]
Message-ID: <ZaGqzR8RXWbWolfg@intel.com> (raw)
In-Reply-To: <20240112182949.181403-2-matthew.d.roper@intel.com>

On Fri, Jan 12, 2024 at 10:29:50AM -0800, Matt Roper wrote:
> gucpc isn't initialized when skip_guc_pc is used, but some of the sysfs
> frequency entries still try to grab the uninitialized frequency mutex
> before realizing that they need to bail out.  Tweak the init/fini code
> flows so that the mutex is always initialized properly.

hmmm... good catch.
But I honestly don't believe we should be calling/running any function
that is trying to get the freq_lock. If guc pc is skip, why would we try
to communicate with guc to get or set the freq?

The shared buffers are not set and all. We need a deeper decoupling here.
Vinay?

> 
> Fixes: 975e4a3795d4 ("drm/xe: Manually setup C6 when skip_guc_pc is set")
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_guc_pc.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index f71085228cb3..67ce24fae79d 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
> @@ -964,11 +964,12 @@ void xe_guc_pc_fini(struct xe_guc_pc *pc)
>  
>  	if (xe->info.skip_guc_pc) {
>  		xe_gt_idle_disable_c6(pc_to_gt(pc));
> -		return;
> +		goto out;
>  	}
>  
>  	XE_WARN_ON(xe_guc_pc_gucrc_disable(pc));
>  	XE_WARN_ON(xe_guc_pc_stop(pc));
> +out:
>  	mutex_destroy(&pc->freq_lock);
>  }
>  
> @@ -984,11 +985,11 @@ int xe_guc_pc_init(struct xe_guc_pc *pc)
>  	struct xe_bo *bo;
>  	u32 size = PAGE_ALIGN(sizeof(struct slpc_shared_data));
>  
> -	if (xe->info.skip_guc_pc)
> -		return 0;
> -
>  	mutex_init(&pc->freq_lock);
>  
> +	if (xe->info.skip_guc_pc)
> +		return 0;
> +
>  	bo = xe_managed_bo_create_pin_map(xe, tile, size,
>  					  XE_BO_CREATE_VRAM_IF_DGFX(tile) |
>  					  XE_BO_CREATE_GGTT_BIT);
> -- 
> 2.43.0
> 

  parent reply	other threads:[~2024-01-12 21:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 18:29 [PATCH] drm/xe: Initialize freq_lock even with skip_guc_pc Matt Roper
2024-01-12 18:55 ` ✓ CI.Patch_applied: success for " Patchwork
2024-01-12 18:55 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-12 18:56 ` ✓ CI.KUnit: success " Patchwork
2024-01-12 19:03 ` ✓ CI.Build: " Patchwork
2024-01-12 19:04 ` ✓ CI.Hooks: " Patchwork
2024-01-12 19:05 ` ✓ CI.checksparse: " Patchwork
2024-01-12 19:28 ` ✓ CI.BAT: " Patchwork
2024-01-12 21:10 ` Rodrigo Vivi [this message]
2024-01-12 21:16   ` [PATCH] " Belgaumkar, Vinay
2024-01-12 21:33     ` Matt Roper

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=ZaGqzR8RXWbWolfg@intel.com \
    --to=rodrigo.vivi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.