mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: specify devfreq timer through dt
Originally,
nvgpu uses deferrable timer for devfreq polling by default,
this leads to issues below because of unstable polling interval.
- out of time frequency scaling
- unstable GPU frequency scaling
This change lets users be able to specify devfreq timer through dt.
If the dt node 'devfreq-timer' equals to 'delayed', then gpu will uses
delayed timer for devfreq polling.
Bug 3823798
Change-Id: Idc0849b4a6b8af52fda8e88f5c831f183b7a27de
Signed-off-by: shaochunk <shaochunk@nvidia.com>
(cherry picked from commit c655a5e058)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2908703
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
878182c1d5
commit
d6359b5adc
@@ -23,6 +23,7 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <uapi/linux/nvgpu.h>
|
||||
#include <linux/devfreq.h>
|
||||
|
||||
#include <nvgpu/defaults.h>
|
||||
#include <nvgpu/kmem.h>
|
||||
@@ -43,6 +44,7 @@
|
||||
#include "os_linux.h"
|
||||
#include "sysfs.h"
|
||||
#include "ioctl.h"
|
||||
#include "scale.h"
|
||||
|
||||
#define EMC3D_DEFAULT_RATIO 750
|
||||
|
||||
@@ -73,6 +75,36 @@ void nvgpu_read_support_gpu_tools(struct gk20a *g)
|
||||
}
|
||||
}
|
||||
|
||||
void nvgpu_read_devfreq_timer(struct gk20a *g)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
|
||||
struct device_node *np;
|
||||
int ret = 0;
|
||||
const char *timer;
|
||||
|
||||
np = nvgpu_get_node(g);
|
||||
ret = of_property_read_string(np, "devfreq-timer", &timer);
|
||||
if (ret != 0) {
|
||||
nvgpu_log_info(g, "GPU devfreq monitor uses default timer");
|
||||
} else {
|
||||
if (strncmp(timer, "deferrable",
|
||||
sizeof("deferrable") - 1) == 0) {
|
||||
g->scale_profile->devfreq_profile.timer =
|
||||
DEVFREQ_TIMER_DEFERRABLE;
|
||||
} else if (strncmp(timer, "delayed",
|
||||
sizeof("delayed") - 1) == 0) {
|
||||
g->scale_profile->devfreq_profile.timer =
|
||||
DEVFREQ_TIMER_DELAYED;
|
||||
} else {
|
||||
nvgpu_err(g, "dt specified "
|
||||
"invalid devfreq timer for GPU: %s", timer);
|
||||
}
|
||||
}
|
||||
#else
|
||||
nvgpu_log_info(g, "GPU devfreq monitor uses default timer");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void nvgpu_init_vars(struct gk20a *g)
|
||||
{
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2016-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -24,5 +24,6 @@ int nvgpu_probe(struct gk20a *g,
|
||||
|
||||
void nvgpu_init_gk20a(struct gk20a *g);
|
||||
void nvgpu_read_support_gpu_tools(struct gk20a *g);
|
||||
void nvgpu_read_devfreq_timer(struct gk20a *g);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "platform_gk20a.h"
|
||||
#include "scale.h"
|
||||
#include "os_linux.h"
|
||||
#include "driver_common.h"
|
||||
|
||||
/*
|
||||
* gk20a_scale_qos_notify()
|
||||
@@ -520,6 +521,7 @@ void gk20a_scale_init(struct device *dev)
|
||||
int error = 0;
|
||||
|
||||
register_gpu_opp(dev);
|
||||
nvgpu_read_devfreq_timer(g);
|
||||
|
||||
profile->devfreq_profile.initial_freq =
|
||||
profile->devfreq_profile.freq_table[0];
|
||||
|
||||
Reference in New Issue
Block a user