Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@kernel.org>,
	Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 3/4] drm/i915: Add helpers for managing rps thresholds
Date: Tue, 23 May 2023 10:07:31 +0100	[thread overview]
Message-ID: <f3402477-2880-a312-c6cc-bef79d7c2f57@linux.intel.com> (raw)
In-Reply-To: <ZGv2J0t5XtMnYaXt@ashyti-mobl2.lan>


On 23/05/2023 00:09, Andi Shyti wrote:
> Hi Tvrtko,
> 
> On Mon, May 22, 2023 at 12:59:27PM +0100, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> In preparation for exposing via sysfs add helpers for managing rps
>> thresholds.
>>
>> v2:
>>   * Force sw and hw re-programming on threshold change.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Cc: Rodrigo Vivi <rodrigo.vivi@kernel.org>
>> ---
>>   drivers/gpu/drm/i915/gt/intel_rps.c | 54 +++++++++++++++++++++++++++++
>>   drivers/gpu/drm/i915/gt/intel_rps.h |  4 +++
>>   2 files changed, 58 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
>> index 333abc8f7ecb..afde601a6111 100644
>> --- a/drivers/gpu/drm/i915/gt/intel_rps.c
>> +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
>> @@ -16,7 +16,9 @@
>>   #include "intel_gt.h"
>>   #include "intel_gt_clock_utils.h"
>>   #include "intel_gt_irq.h"
>> +#include "intel_gt_pm.h"
>>   #include "intel_gt_pm_irq.h"
>> +#include "intel_gt_print.h"
>>   #include "intel_gt_regs.h"
>>   #include "intel_mchbar_regs.h"
>>   #include "intel_pcode.h"
>> @@ -2574,6 +2576,58 @@ int intel_rps_set_min_frequency(struct intel_rps *rps, u32 val)
>>   		return set_min_freq(rps, val);
>>   }
>>   
>> +u8 intel_rps_get_up_threshold(struct intel_rps *rps)
>> +{
>> +	return rps->power.up_threshold;
>> +}
>> +
>> +static int rps_set_threshold(struct intel_rps *rps, u8 *threshold, u8 val)
>> +{
>> +	int ret;
>> +
>> +	if (val > 100)
>> +		return -EINVAL;
>> +
>> +	ret = mutex_lock_interruptible(&rps->lock);
>> +	if (ret)
>> +		return ret;
>> +
>> +	if (*threshold == val)
>> +		goto out_unlock;
>> +
>> +	*threshold = val;
>> +
>> +	/* Force reset. */
>> +	rps->last_freq = -1;
>> +	mutex_lock(&rps->power.mutex);
>> +	rps->power.mode = -1;
>> +	mutex_unlock(&rps->power.mutex);
>> +
>> +	intel_rps_set(rps, clamp(rps->cur_freq,
>> +				 rps->min_freq_softlimit,
>> +				 rps->max_freq_softlimit));
> 
> why are you resetting here?

I want to ensure the next calls to rps_set go past the "if (val == 
rps->last_freq)" and "if (new_power == rps->power.mode)" checks (second 
one via gen6_rps_set_thresholds->rps_set_power" so new values are 
immediately programmed into the hardware and sw state reset and 
re-calculated.

Regards,

Tvrtko

  reply	other threads:[~2023-05-23  9:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 11:59 [Intel-gfx] [PATCH 1/4] drm/i915: Move setting of rps thresholds to init Tvrtko Ursulin
2023-05-22 11:59 ` [Intel-gfx] [PATCH 2/4] drm/i915: Record default rps threshold values Tvrtko Ursulin
2023-05-22 14:52   ` Rodrigo Vivi
2023-05-22 22:48   ` Andi Shyti
2023-05-22 11:59 ` [Intel-gfx] [PATCH 3/4] drm/i915: Add helpers for managing rps thresholds Tvrtko Ursulin
2023-05-22 14:52   ` Rodrigo Vivi
2023-05-22 23:09   ` Andi Shyti
2023-05-23  9:07     ` Tvrtko Ursulin [this message]
2023-05-23 11:39       ` Andi Shyti
2023-05-22 11:59 ` [Intel-gfx] [PATCH 4/4] drm/i915: Expose RPS thresholds in sysfs Tvrtko Ursulin
2023-05-22 23:10   ` Andi Shyti
2023-05-22 14:52 ` [Intel-gfx] [PATCH 1/4] drm/i915: Move setting of rps thresholds to init Rodrigo Vivi
2023-05-22 18:21 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] " Patchwork
2023-05-22 18:21 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-05-22 18:37 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-05-22 22:48 ` [Intel-gfx] [PATCH 1/4] " Andi Shyti
2023-05-23  2:11 ` [Intel-gfx] ✓ Fi.CI.IGT: success for series starting with [1/4] " 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=f3402477-2880-a312-c6cc-bef79d7c2f57@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=andi.shyti@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=rodrigo.vivi@kernel.org \
    /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