Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Summers, Stuart" <stuart.summers@intel.com>
To: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Belgaumkar, Vinay" <vinay.belgaumkar@intel.com>
Cc: "Vivekanandan, Balasubramani" <balasubramani.vivekanandan@intel.com>
Subject: Re: [PATCH v2] drm/xe: Fix a bug in pc_adjust_freq_bounds()
Date: Wed, 5 Aug 2026 20:37:03 +0000	[thread overview]
Message-ID: <30078648509cf682c11e12aa3eb025f2e293aaab.camel@intel.com> (raw)
In-Reply-To: <20260804232218.1736159-1-vinay.belgaumkar@intel.com>

On Tue, 2026-08-04 at 16:22 -0700, Vinay Belgaumkar wrote:
> In cases where min frequency was actually greater than BMG_MIN_FREQ,
> we were not using the updated min frequency as there was a missing
> call to pc_action_query_task_state() between the two settings of
> min frequency. Use the xe_guc_pc_get_min_freq_locked() variant to

But we aren't doing that any more right?

> obtain the frequency as a good practice, and cache the changed value
> to fix this issue.
> 
> v2: pc->freq_ready is not set until after pc_adjust_freq_bounds().
> Stay
> with pc_action_query_task_state() instead.
> 
> Fixes: bdde16c9ac5c ("drm/xe/bmg: Update Wa_14022085890")
> Signed-off-by: Balasubramani Vivekanandan
> <balasubramani.vivekanandan@intel.com>
> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_guc_pc.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c
> b/drivers/gpu/drm/xe/xe_guc_pc.c
> index 59f2fa79ad42..3106ac50827c 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
> @@ -911,6 +911,7 @@ static bool pc_needs_min_freq_change(struct
> xe_guc_pc *pc)
>  static int pc_adjust_freq_bounds(struct xe_guc_pc *pc)
>  {
>         int ret;
> +       u32 min_freq;
>  
>         lockdep_assert_held(&pc->freq_lock);
>  
> @@ -933,8 +934,13 @@ static int pc_adjust_freq_bounds(struct
> xe_guc_pc *pc)
>          * Same thing happens for Server platforms where min is
> listed as
>          * RPMax
>          */
> -       if (pc_get_min_freq(pc) > pc->rp0_freq)
> +       min_freq = pc_get_min_freq(pc);
> +       if (min_freq > pc->rp0_freq) {
>                 ret = pc_set_min_freq(pc, pc->rp0_freq);
> +               if (ret)
> +                       goto out;

nit: line break for readability

> +               min_freq = pc->rp0_freq;
> +       }
>  
>         /*
>          * Setting GT RP min frequency to 1.2GHz by default for
> @@ -947,8 +953,8 @@ static int pc_adjust_freq_bounds(struct xe_guc_pc
> *pc)
>          * we aren't expecting high power output across board
>          *
>          */
> -       if (pc_needs_min_freq_change(pc))
> -               ret = pc_set_min_freq(pc, max(BMG_MIN_FREQ,
> pc_get_min_freq(pc)));
> +       if (pc_needs_min_freq_change(pc) && min_freq < BMG_MIN_FREQ)

Should this be <=?

> +               ret = pc_set_min_freq(pc, BMG_MIN_FREQ);

Ok I didn't quite get this. Why do we want to ignore the min_freq if
it's above BMG_MIN_FREQ? If we calculated as such earlier, wouldn't we
want the higher value? so this should just be:
pc_set_min_freq(pc, max(BMG_MIN_FREQ, min_freq);

Thanks,
Stuart

>  
>  out:
>         return ret;


  parent reply	other threads:[~2026-08-05 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 23:22 [PATCH v2] drm/xe: Fix a bug in pc_adjust_freq_bounds() Vinay Belgaumkar
2026-08-04 23:34 ` ✓ CI.KUnit: success for drm/xe: Fix a bug in pc_adjust_freq_bounds() (rev2) Patchwork
2026-08-05  0:17 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-05  5:50 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-08-05 20:37 ` Summers, Stuart [this message]
2026-08-05 21:42   ` [PATCH v2] drm/xe: Fix a bug in pc_adjust_freq_bounds() Belgaumkar, Vinay

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=30078648509cf682c11e12aa3eb025f2e293aaab.camel@intel.com \
    --to=stuart.summers@intel.com \
    --cc=balasubramani.vivekanandan@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=vinay.belgaumkar@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