mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: Add sw shadow for load value
Reading the load value may increase CPU power consumption temprorarily. In most cases we are ok with a value that was read a moment earlier. This patch introduces a software shadow for gpu load. The shadow is updated before starting scaling and all scaling code paths use the sw shadow. Change-Id: I53d2ccb8e7f83147f411a14d3104d890dd9af9a3 Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/453347 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
committed by
Dan Willemsen
parent
273f754cb5
commit
b33020008b
@@ -192,6 +192,9 @@ static void gk20a_scale_notify(struct platform_device *pdev, bool busy)
|
|||||||
struct gk20a_scale_profile *profile = g->scale_profile;
|
struct gk20a_scale_profile *profile = g->scale_profile;
|
||||||
struct devfreq *devfreq = g->devfreq;
|
struct devfreq *devfreq = g->devfreq;
|
||||||
|
|
||||||
|
/* update the software shadow */
|
||||||
|
gk20a_pmu_load_update(g);
|
||||||
|
|
||||||
/* inform edp about new constraint */
|
/* inform edp about new constraint */
|
||||||
if (platform->prescale)
|
if (platform->prescale)
|
||||||
platform->prescale(pdev);
|
platform->prescale(pdev);
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ static ssize_t gk20a_load_show(struct device *dev,
|
|||||||
busy_time = 0;
|
busy_time = 0;
|
||||||
} else {
|
} else {
|
||||||
gk20a_busy(g->dev);
|
gk20a_busy(g->dev);
|
||||||
|
gk20a_pmu_load_update(g);
|
||||||
gk20a_pmu_load_norm(g, &busy_time);
|
gk20a_pmu_load_norm(g, &busy_time);
|
||||||
gk20a_idle(g->dev);
|
gk20a_idle(g->dev);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3676,17 +3676,23 @@ int gk20a_pmu_destroy(struct gk20a *g)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int gk20a_pmu_load_norm(struct gk20a *g, u32 *load)
|
int gk20a_pmu_load_norm(struct gk20a *g, u32 *load)
|
||||||
|
{
|
||||||
|
*load = g->pmu.load_shadow;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gk20a_pmu_load_update(struct gk20a *g)
|
||||||
{
|
{
|
||||||
struct pmu_gk20a *pmu = &g->pmu;
|
struct pmu_gk20a *pmu = &g->pmu;
|
||||||
u16 _load = 0;
|
u16 _load = 0;
|
||||||
|
|
||||||
if (!pmu->perfmon_ready) {
|
if (!pmu->perfmon_ready) {
|
||||||
*load = 0;
|
pmu->load_shadow = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmu_copy_from_dmem(pmu, pmu->sample_buffer, (u8 *)&_load, 2, 0);
|
pmu_copy_from_dmem(pmu, pmu->sample_buffer, (u8 *)&_load, 2, 0);
|
||||||
*load = _load / 10;
|
pmu->load_shadow = _load / 10;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1079,6 +1079,7 @@ struct pmu_gk20a {
|
|||||||
bool perfmon_ready;
|
bool perfmon_ready;
|
||||||
|
|
||||||
u32 sample_buffer;
|
u32 sample_buffer;
|
||||||
|
u32 load_shadow;
|
||||||
|
|
||||||
struct mutex isr_mutex;
|
struct mutex isr_mutex;
|
||||||
struct mutex isr_enable_lock;
|
struct mutex isr_enable_lock;
|
||||||
@@ -1119,6 +1120,7 @@ int pmu_mutex_acquire(struct pmu_gk20a *pmu, u32 id, u32 *token);
|
|||||||
int pmu_mutex_release(struct pmu_gk20a *pmu, u32 id, u32 *token);
|
int pmu_mutex_release(struct pmu_gk20a *pmu, u32 id, u32 *token);
|
||||||
int gk20a_pmu_destroy(struct gk20a *g);
|
int gk20a_pmu_destroy(struct gk20a *g);
|
||||||
int gk20a_pmu_load_norm(struct gk20a *g, u32 *load);
|
int gk20a_pmu_load_norm(struct gk20a *g, u32 *load);
|
||||||
|
int gk20a_pmu_load_update(struct gk20a *g);
|
||||||
int gk20a_pmu_debugfs_init(struct platform_device *dev);
|
int gk20a_pmu_debugfs_init(struct platform_device *dev);
|
||||||
void gk20a_pmu_reset_load_counters(struct gk20a *g);
|
void gk20a_pmu_reset_load_counters(struct gk20a *g);
|
||||||
void gk20a_pmu_get_load_counters(struct gk20a *g, u32 *busy_cycles,
|
void gk20a_pmu_get_load_counters(struct gk20a *g, u32 *busy_cycles,
|
||||||
|
|||||||
Reference in New Issue
Block a user