Re: [PATCH v2 1/3] drm/msm/gpu: Add devfreq tuning debugfs

2023-01-23 Thread Rob Clark
On Mon, Jan 23, 2023 at 4:38 AM Krzysztof Kozlowski  wrote:
>
> On 11/01/2023 00:14, Rob Clark wrote:
> > From: Rob Clark 
> >
> > Make the handful of tuning knobs available visible via debugfs.
> >
> > v2: select DEVFREQ_GOV_SIMPLE_ONDEMAND because for some reason
> > struct devfreq_simple_ondemand_data depends on this
> >
> > Signed-off-by: Rob Clark 
> > ---
>
> For some reason this was merged even though earlier kbuild reported
> build failure. This breaks linux next and qcom defconfig. Please drop
> the patch from the linux next.
>
> See earlier build issues reported:
> https://lore.kernel.org/all/202301130108.fslqjvj8-...@intel.com/
>

This will fix it:  https://patchwork.freedesktop.org/series/113232/

BR,
-R


Re: [PATCH v2 1/3] drm/msm/gpu: Add devfreq tuning debugfs

2023-01-23 Thread Krzysztof Kozlowski
On 11/01/2023 00:14, Rob Clark wrote:
> From: Rob Clark 
> 
> Make the handful of tuning knobs available visible via debugfs.
> 
> v2: select DEVFREQ_GOV_SIMPLE_ONDEMAND because for some reason
> struct devfreq_simple_ondemand_data depends on this
> 
> Signed-off-by: Rob Clark 
> ---

For some reason this was merged even though earlier kbuild reported
build failure. This breaks linux next and qcom defconfig. Please drop
the patch from the linux next.

See earlier build issues reported:
https://lore.kernel.org/all/202301130108.fslqjvj8-...@intel.com/

Best regards,
Krzysztof



Re: [PATCH v2 1/3] drm/msm/gpu: Add devfreq tuning debugfs

2023-01-17 Thread Naresh Kamboju
Following build regression noticed on Linux next-20230118.

Regressions found on arm:
- build/gcc-8-imx_v6_v7_defconfig
- build/gcc-12-imx_v6_v7_defconfig
- build/clang-15-imx_v6_v7_defconfig
- build/clang-nightly-imx_v6_v7_defconfig

Reported-by: Linux Kernel Functional Testing 

WARNING: unmet direct dependencies detected for DEVFREQ_GOV_SIMPLE_ONDEMAND
  Depends on [n]: PM_DEVFREQ [=n]
  Selected by [y]:
  - DRM_MSM [=y] && HAS_IOMEM [=y] && DRM [=y] && (ARCH_QCOM [=n] ||
SOC_IMX5 [=y] || COMPILE_TEST [=n]) && COMMON_CLK [=y] &&
IOMMU_SUPPORT [=y] && (QCOM_OCMEM [=n] || QCOM_OCMEM [=n]=n) &&
(QCOM_LLCC [=n] || QCOM_LLCC [=n]=n) && (QCOM_COMMAND_DB [=n] ||
QCOM_COMMAND_DB [=n]=n)

WARNING: unmet direct dependencies detected for DEVFREQ_GOV_SIMPLE_ONDEMAND
  Depends on [n]: PM_DEVFREQ [=n]
  Selected by [y]:
  - DRM_MSM [=y] && HAS_IOMEM [=y] && DRM [=y] && (ARCH_QCOM [=n] ||
SOC_IMX5 [=y] || COMPILE_TEST [=n]) && COMMON_CLK [=y] &&
IOMMU_SUPPORT [=y] && (QCOM_OCMEM [=n] || QCOM_OCMEM [=n]=n) &&
(QCOM_LLCC [=n] || QCOM_LLCC [=n]=n) && (QCOM_COMMAND_DB [=n] ||
QCOM_COMMAND_DB [=n]=n)
make --silent --keep-going --jobs=8
O=/home/tuxbuild/.cache/tuxmake/builds/1/build ARCH=arm
CROSS_COMPILE=arm-linux-gnueabihf- 'CC=sccache
arm-linux-gnueabihf-gcc' 'HOSTCC=sccache gcc'
In file included from drivers/gpu/drm/msm/msm_gpu.h:18,
 from drivers/gpu/drm/msm/adreno/adreno_gpu.h:15,
 from drivers/gpu/drm/msm/adreno/adreno_device.c:9:
drivers/gpu/drm/msm/msm_drv.h:237:45: error: field
'gpu_devfreq_config' has incomplete type
  237 | struct devfreq_simple_ondemand_data gpu_devfreq_config;
  | ^~

Build log:
https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230118/testrun/14250189/suite/build/test/gcc-12-imx_v6_v7_defconfig/log

This was already reported a while back on lore,
https://lore.kernel.org/all/202301130108.fslqjvj8-...@intel.com/


--
Linaro LKFT
https://lkft.linaro.org


Re: [PATCH v2 1/3] drm/msm/gpu: Add devfreq tuning debugfs

2023-01-12 Thread kernel test robot
Hi Rob,

I love your patch! Yet something to improve:

[auto build test ERROR on drm/drm-next]
[also build test ERROR on drm-exynos/exynos-drm-next drm-intel/for-linux-next 
drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.2-rc3 
next-20230112]
[cannot apply to drm-misc/drm-misc-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Rob-Clark/drm-msm-gpu-Add-devfreq-tuning-debugfs/20230111-071620
base:   git://anongit.freedesktop.org/drm/drm drm-next
patch link:
https://lore.kernel.org/r/20230110231447.1939101-2-robdclark%40gmail.com
patch subject: [PATCH v2 1/3] drm/msm/gpu: Add devfreq tuning debugfs
config: arc-buildonly-randconfig-r003-20230112
compiler: arc-elf-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/intel-lab-lkp/linux/commit/a5db640b1edb9bb3a67015ce8183f9b6c2e44fa0
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Rob-Clark/drm-msm-gpu-Add-devfreq-tuning-debugfs/20230111-071620
git checkout a5db640b1edb9bb3a67015ce8183f9b6c2e44fa0
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 
O=build_dir ARCH=arc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 
O=build_dir ARCH=arc SHELL=/bin/bash drivers/gpu/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   In file included from drivers/gpu/drm/msm/msm_kms.h:14,
from drivers/gpu/drm/msm/disp/msm_disp_snapshot.h:27,
from drivers/gpu/drm/msm/disp/msm_disp_snapshot.c:8:
>> drivers/gpu/drm/msm/msm_drv.h:238:45: error: field 'gpu_devfreq_config' has 
>> incomplete type
 238 | struct devfreq_simple_ondemand_data gpu_devfreq_config;
 | ^~

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for DEVFREQ_GOV_SIMPLE_ONDEMAND
   Depends on [n]: PM_DEVFREQ [=n]
   Selected by [y]:
   - DRM_MSM [=y] && HAS_IOMEM [=y] && DRM [=y] && (ARCH_QCOM || SOC_IMX5 || 
COMPILE_TEST [=y]) && COMMON_CLK [=y] && IOMMU_SUPPORT [=y] && (QCOM_OCMEM [=n] 
|| QCOM_OCMEM [=n]=n) && (QCOM_LLCC [=y] || QCOM_LLCC [=y]=n) && 
(QCOM_COMMAND_DB [=n] || QCOM_COMMAND_DB [=n]=n)


vim +/gpu_devfreq_config +238 drivers/gpu/drm/msm/msm_drv.h

   107  
   108  struct drm_device *dev;
   109  
   110  struct msm_kms *kms;
   111  int (*kms_init)(struct drm_device *dev);
   112  
   113  /* subordinate devices, if present: */
   114  struct platform_device *gpu_pdev;
   115  
   116  /* possibly this should be in the kms component, but it is
   117   * shared by both mdp4 and mdp5..
   118   */
   119  struct hdmi *hdmi;
   120  
   121  /* DSI is shared by mdp4 and mdp5 */
   122  struct msm_dsi *dsi[2];
   123  
   124  struct msm_dp *dp[MSM_DP_CONTROLLER_COUNT];
   125  
   126  /* when we have more than one 'msm_gpu' these need to be an 
array: */
   127  struct msm_gpu *gpu;
   128  
   129  /* gpu is only set on open(), but we need this info earlier */
   130  bool is_a2xx;
   131  bool has_cached_coherent;
   132  
   133  struct drm_fb_helper *fbdev;
   134  
   135  struct msm_rd_state *rd;   /* debugfs to dump all submits */
   136  struct msm_rd_state *hangrd;   /* debugfs to dump hanging 
submits */
   137  struct msm_perf_state *perf;
   138  
   139  /**
   140   * List of all GEM objects (mainly for debugfs, protected by 
obj_lock
   141   * (acquire before per GEM object lock)
   142   */
   143  struct list_head objects;
   144  struct mutex obj_lock;
   145  
   146  /**
   147   * lru:
   148   *
   149   * The various LRU's that a GEM object is in at various stages 
of
   150   * it's lifetime.  Objects start out in the unbacked LRU.  When
   151   * pinned (for scannout or permanently mapped GPU buffers, like
   152   * ringbuffer, memptr, fw, etc) it moves to the pinned LRU.  
When
   153   * unpinned, it moves into willneed or dontneed LRU depending on
   154   * madvise state.  When backing pages are evicted (willneed) or
   155   

[PATCH v2 1/3] drm/msm/gpu: Add devfreq tuning debugfs

2023-01-10 Thread Rob Clark
From: Rob Clark 

Make the handful of tuning knobs available visible via debugfs.

v2: select DEVFREQ_GOV_SIMPLE_ONDEMAND because for some reason
struct devfreq_simple_ondemand_data depends on this

Signed-off-by: Rob Clark 
---
 drivers/gpu/drm/msm/Kconfig   |  1 +
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c |  2 +-
 drivers/gpu/drm/msm/msm_debugfs.c | 12 
 drivers/gpu/drm/msm/msm_drv.h |  9 +
 drivers/gpu/drm/msm/msm_gpu.h |  3 ---
 drivers/gpu/drm/msm/msm_gpu_devfreq.c |  6 --
 6 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 3c9dfdb0b328..f7abacb4b221 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -23,6 +23,7 @@ config DRM_MSM
select SHMEM
select TMPFS
select QCOM_SCM
+   select DEVFREQ_GOV_SIMPLE_ONDEMAND
select WANT_DEV_COREDUMP
select SND_SOC_HDMI_CODEC if SND_SOC
select SYNC_FILE
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index 36c8fb699b56..6f7401f2acda 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -2021,7 +2021,7 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)
 * to cause power supply issues:
 */
if (adreno_is_a618(adreno_gpu) || adreno_is_7c3(adreno_gpu))
-   gpu->clamp_to_idle = true;
+   priv->gpu_clamp_to_idle = true;
 
/* Check if there is a GMU phandle and set it up */
node = of_parse_phandle(pdev->dev.of_node, "qcom,gmu", 0);
diff --git a/drivers/gpu/drm/msm/msm_debugfs.c 
b/drivers/gpu/drm/msm/msm_debugfs.c
index 95f4374ae21c..d6ecff0ab618 100644
--- a/drivers/gpu/drm/msm/msm_debugfs.c
+++ b/drivers/gpu/drm/msm/msm_debugfs.c
@@ -305,6 +305,7 @@ void msm_debugfs_init(struct drm_minor *minor)
 {
struct drm_device *dev = minor->dev;
struct msm_drm_private *priv = dev->dev_private;
+   struct dentry *gpu_devfreq;
 
drm_debugfs_create_files(msm_debugfs_list,
 ARRAY_SIZE(msm_debugfs_list),
@@ -325,6 +326,17 @@ void msm_debugfs_init(struct drm_minor *minor)
debugfs_create_file("shrink", S_IRWXU, minor->debugfs_root,
dev, _fops);
 
+   gpu_devfreq = debugfs_create_dir("devfreq", minor->debugfs_root);
+
+   debugfs_create_bool("idle_clamp",0600, gpu_devfreq,
+   >gpu_clamp_to_idle);
+
+   debugfs_create_u32("upthreshold",0600, gpu_devfreq,
+  >gpu_devfreq_config.upthreshold);
+
+   debugfs_create_u32("downdifferential",0600, gpu_devfreq,
+  >gpu_devfreq_config.downdifferential);
+
if (priv->kms && priv->kms->funcs->debugfs_init)
priv->kms->funcs->debugfs_init(priv->kms, minor);
 
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 876d8d5eec2f..6cb1c6d230e8 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -234,6 +235,14 @@ struct msm_drm_private {
 */
unsigned int hangcheck_period;
 
+   /** gpu_devfreq_config: Devfreq tuning config for the GPU. */
+   struct devfreq_simple_ondemand_data gpu_devfreq_config;
+
+   /**
+* gpu_clamp_to_idle: Enable clamping to idle freq when inactive
+*/
+   bool gpu_clamp_to_idle;
+
/**
 * disable_err_irq:
 *
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 732295e25683..ab110c377916 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -275,9 +275,6 @@ struct msm_gpu {
 
struct msm_gpu_state *crashstate;
 
-   /* Enable clamping to idle freq when inactive: */
-   bool clamp_to_idle;
-
/* True if the hardware supports expanded apriv (a650 and newer) */
bool hw_apriv;
 
diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c 
b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
index 025940eb08d1..0d7ff7ddc029 100644
--- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c
+++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
@@ -183,6 +183,7 @@ static bool has_devfreq(struct msm_gpu *gpu)
 void msm_devfreq_init(struct msm_gpu *gpu)
 {
struct msm_gpu_devfreq *df = >devfreq;
+   struct msm_drm_private *priv = gpu->dev->dev_private;
 
/* We need target support to do devfreq */
if (!gpu->funcs->gpu_busy)
@@ -209,7 +210,7 @@ void msm_devfreq_init(struct msm_gpu *gpu)
 
df->devfreq = devm_devfreq_add_device(>pdev->dev,
_devfreq_profile, DEVFREQ_GOV_SIMPLE_ONDEMAND,
-   NULL);
+   >gpu_devfreq_config);
 
if (IS_ERR(df->devfreq)) {
DRM_DEV_ERROR(>pdev->dev, "Couldn't initialize GPU 
devfreq\n");
@@