You are not logged in.

#1 2021-11-07 12:42:21

leonavis
Member
From: Bremen, Germany
Registered: 2021-06-27
Posts: 34

[SOLVED] CoreCtrl undervolting issue

Greetings,

I have already made a gitlab-request here and a request under the AUR-page here, only getting a reaction on the second one, recommending to reinstall Arch.

I am ready to do that, but before I thought I might ask here.

When I compile CoreCtrl, it works flawlessly. I followed the setup-steps on the gitlab-page. Undervolting and fancontrol work as they should. As soon as I reboot though, fancontrol still works, undervolting however does not; it is still shown in CoreCtrl as it should be, but it doesn't work anymore, instead I get the default voltage. I can solve the problem by just reinstalling the program, it is not even neccessary to recompile it.

If it's unclear what I mean, there's a screenshot on the gitlab-page. It shows that the card should use a specific voltage, like 1090mV, instead it uses the default 1150mV.

The problem occurs regardless of kernel (tried my default Zen-kernel, the "normal" one, and LTS). As soon as I reinstall the program everything works as it should again, until the next boot. To just reinstall Arch seems like such a dirty solution...

So if someone has an idea it would be appreciated.

Last edited by leonavis (2021-11-27 13:57:01)

Offline

#2 2021-11-07 12:51:18

Scimmia
Fellow
Registered: 2012-09-01
Posts: 8,751

Re: [SOLVED] CoreCtrl undervolting issue

When it's not working, run `pacman -Qkk <packagename>`, see if something has been changed.

Offline

#3 2021-11-07 12:53:19

leonavis
Member
From: Bremen, Germany
Registered: 2021-06-27
Posts: 34

Re: [SOLVED] CoreCtrl undervolting issue

Scimmia wrote:

When it's not working, run `pacman -Qkk <packagename>`, see if something has been changed.

The output is

 ~  pacman -Qkk corectrl
corectrl: 59 total files, 0 altered files

Edit: Alright, playing around with it a bit, by now it seems it works when I just restart it. Which is strange and new, didn't work like that before... but you know, I can live with it, won't reinstall the whole system for that little bug. Still, weird behavior of the program.

Last edited by leonavis (2021-11-07 13:02:24)

Offline

#4 2021-11-14 06:12:47

leonavis
Member
From: Bremen, Germany
Registered: 2021-06-27
Posts: 34

Re: [SOLVED] CoreCtrl undervolting issue

Well, 5.15 broke the thing completely. Cannot control voltage or clockspeed with CoreCtrl anymore. Not the only one with the problem, but oh well. LTS still works, so I'm using that for now.

Offline

#5 2021-11-21 05:41:23

leonavis
Member
From: Bremen, Germany
Registered: 2021-06-27
Posts: 34

Re: [SOLVED] CoreCtrl undervolting issue

Hello again, asking for help once more

On the AMD DRM freedesktop.gitlab-page there is a patch posted by a maintainer that's probably, maybe, fixing something.... maybe. So I wanted to apply it.

It starts like this

From 3b97d0e952b82e85701ae0efbab6ababb208fccf Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Wed, 3 Nov 2021 15:52:53 -0400
Subject: [PATCH] drm/amdgpu/powerplay: fix sysfs_emit/sysfs_emit_at handling

sysfs_emit and sysfs_emit_at requrie a page boundary
aligned buf address. Make them happy!

v2: fix sysfs_emit -> sysfs_emit_at missed conversions

Cc: Lang Yu <lang.yu@amd.com>
Cc: Darren Powell <darren.powell@amd.com>
Fixes: 6db0c87a0a8e ("amdgpu/pm: Replace hwmgr smu usage of sprintf with sysfs_emit")
Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1774
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
... [patch comes now, see link]

Since it's apparantly a patch for the amdgpu-driver, which is integrated into the kernel, I tried to patch the kernel with it (with asp, modifying the PKGBUILD, makepkg -s).

It goes smoothly, until it's time to apply the patch. Makepkg asks me what file to patch then, showing me the code. Which makes me think this might not be for the kernel, but for some other package. I just cannot figure out which, and my request wasn't answered yet on the freedesktop-gitlab-page either.

So maybe someone here has an idea.

Edit

alright should be linux-firmware since that's where AMDGPU is located. So I tried that, but no luck again:

==> Starting prepare()...
can't find file to patch at input line 30
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|From 3b97d0e952b82e85701ae0efbab6ababb208fccf Mon Sep 17 00:00:00 2001
|From: Alex Deucher <alexander.deucher@amd.com>
|Date: Wed, 3 Nov 2021 15:52:53 -0400
|Subject: [PATCH] drm/amdgpu/powerplay: fix sysfs_emit/sysfs_emit_at handling
|
|sysfs_emit and sysfs_emit_at requrie a page boundary
|aligned buf address. Make them happy!
|
|v2: fix sysfs_emit -> sysfs_emit_at missed conversions
|
|Cc: Lang Yu <lang.yu@amd.com>
|Cc: Darren Powell <darren.powell@amd.com>
|Fixes: 6db0c87a0a8e ("amdgpu/pm: Replace hwmgr smu usage of sprintf with sysfs_emit")
|Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1774
|Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
|---
| .../gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c   |  8 ++++++--
| .../gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c    | 10 +++++++---
| .../gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c    |  2 ++
| .../gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h    | 13 +++++++++++++
| .../gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c  | 12 +++++++++---
| .../gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c  |  4 ++++
| .../gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c  | 14 ++++++++++----
| 7 files changed, 51 insertions(+), 12 deletions(-)
|
|diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
|index 1de3ae77e03e..258c573acc97 100644
|--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
|+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
--------------------------
File to patch: ^C
==> ERROR: Aborted by user! Exiting...

Pretty sure that's because I don't use the "original" linux-firmware but the one from Pacman. Checking up on that, by now I do believe I was supposed to patch the original kernel, because I found

|--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c

located in the kernel-package I downloaded.

So when I'm back home I'll try that. This is a fun exercise for me. ^^

Edit2.

Before heading out I couldn't let my hands off it, turns out I didn't even need the original kernel, could use the Arch-linux one and just manually insert the driver's location. Now I get this

/home/leonavis/build/linux/PKGBUILD: line 43: scripts/setlocalversion: No such file or directory

But I'm pretty sure I'll find a solution in time...

Edit3.

So far so good, though I'm not certain why it won't work. This is the ouput of makepkg -s

 ✘  ~/build/linux  makepkg -s
==> Making package: leo-linux 5.15.2.arch1-1 (Sun Nov 21 18:32:27 2021)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Cloning archlinux-linux git repo...
Cloning into bare repository '/home/leonavis/build/linux/archlinux-linux'...
remote: Enumerating objects: 8673201, done.
remote: Total 8673201 (delta 0), reused 0 (delta 0), pack-reused 8673201
Receiving objects: 100% (8673201/8673201), 3.41 GiB | 24.17 MiB/s, done.
Resolving deltas: 100% (7207347/7207347), done.
  -> Found config
  -> Found 0001-drm-amdgpu-powerplay-fix-sysfs_emit-sysfs_emit_at-ha.patch
==> Validating source files with sha256sums...
    archlinux-linux ... Skipped
    config ... Passed
    0001-drm-amdgpu-powerplay-fix-sysfs_emit-sysfs_emit_at-ha.patch ... Passed
==> Verifying source file signatures with gpg...
    archlinux-linux git repo ... Passed
==> Extracting sources...
  -> Creating working copy of archlinux-linux git repo...
Cloning into 'archlinux-linux'...
done.
Updating files: 100% (74307/74307), done.
Updating files: 100% (11335/11335), done.
Switched to a new branch 'makepkg'
==> Starting prepare()...
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c
Setting version...
Applying patch 0001-drm-amdgpu-powerplay-fix-sysfs_emit-sysfs_emit_at-ha.patch...
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
Reversed (or previously applied) patch detected!  Skipping patch.
4 out of 4 hunks ignored -- saving rejects to file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c.rej
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
Reversed (or previously applied) patch detected!  Skipping patch.
5 out of 5 hunks ignored -- saving rejects to file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c.rej
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c.rej
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h.rej
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
Reversed (or previously applied) patch detected!  Skipping patch.
6 out of 6 hunks ignored -- saving rejects to file drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c.rej
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c
Reversed (or previously applied) patch detected!  Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c.rej
patching file drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c
Reversed (or previously applied) patch detected!  Skipping patch.
7 out of 7 hunks ignored -- saving rejects to file drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c.rej
==> ERROR: A failure occurred in prepare().
    Aborting...

So is it patching it twice? I don't know. PKGBUILD looks like this

# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgbase=leo-linux
pkgver=5.15.2.arch1
pkgrel=1
pkgdesc='Linux'
_srctag=v${pkgver%.*}-${pkgver##*.}
url="https://github.com/archlinux/linux/commits/$_srctag"
arch=(x86_64)
license=(GPL2)
makedepends=(
  bc kmod libelf pahole cpio perl tar xz
  xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick
  git
)
options=('!strip')
_srcname=archlinux-linux
source=(
  "$_srcname::git+https://github.com/archlinux/linux?signed#tag=$_srctag"
  config         # the main kernel config file
  0001-drm-amdgpu-powerplay-fix-sysfs_emit-sysfs_emit_at-ha.patch
)
validpgpkeys=(
  'ABAF11C65A2970B130ABE3C479BE3E4300411886'  # Linus Torvalds
  '647F28654894E3BD457199BE38DBBDC86092693E'  # Greg Kroah-Hartman
  'A2FF3A36AAA56654109064AB19802F8B0D70FC30'  # Jan Alexander Steffens (heftig)
  'C7E7849466FE2358343588377258734B41C31549'  # David Runge <dvzrv@archlinux.org>
)
sha256sums=('SKIP'
            'e2d8d59ee965f5fabcb9dd15b70074798e168ccdbd75a9540390c281279f113d'
            'c0669a0dcd972cb58e456880aef555d1856bf15e8907d1ddf8eda274791c1c2e')

export KBUILD_BUILD_HOST=archlinux
export KBUILD_BUILD_USER=$pkgbase
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"

prepare() {
  cd $_srcname
  patch --forward --strip=1 --input="${srcdir}/0001-drm-amdgpu-powerplay-fix-sysfs_emit-sysfs_emit_at-ha.patch"
...

(cut off stuff that isn't relevant)

I'll also include the patch-file.

From 3b97d0e952b82e85701ae0efbab6ababb208fccf Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Wed, 3 Nov 2021 15:52:53 -0400
Subject: [PATCH] drm/amdgpu/powerplay: fix sysfs_emit/sysfs_emit_at handling

sysfs_emit and sysfs_emit_at requrie a page boundary
aligned buf address. Make them happy!

v2: fix sysfs_emit -> sysfs_emit_at missed conversions

Cc: Lang Yu <lang.yu@amd.com>
Cc: Darren Powell <darren.powell@amd.com>
Fixes: 6db0c87a0a8e ("amdgpu/pm: Replace hwmgr smu usage of sprintf with sysfs_emit")
Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1774
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c   |  8 ++++++--
 .../gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c    | 10 +++++++---
 .../gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c    |  2 ++
 .../gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h    | 13 +++++++++++++
 .../gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c  | 12 +++++++++---
 .../gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c  |  4 ++++
 .../gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c  | 14 ++++++++++----
 7 files changed, 51 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
index 1de3ae77e03e..258c573acc97 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
@@ -1024,6 +1024,8 @@ static int smu10_print_clock_levels(struct pp_hwmgr *hwmgr,
 	uint32_t min_freq, max_freq = 0;
 	uint32_t ret = 0;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	switch (type) {
 	case PP_SCLK:
 		smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetGfxclkFrequency, &now);
@@ -1065,7 +1067,7 @@ static int smu10_print_clock_levels(struct pp_hwmgr *hwmgr,
 			if (ret)
 				return ret;
 
-			size = sysfs_emit(buf, "%s:\n", "OD_SCLK");
+			size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK");
 			size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
 			(data->gfx_actual_soft_min_freq > 0) ? data->gfx_actual_soft_min_freq : min_freq);
 			size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
@@ -1081,7 +1083,7 @@ static int smu10_print_clock_levels(struct pp_hwmgr *hwmgr,
 			if (ret)
 				return ret;
 
-			size = sysfs_emit(buf, "%s:\n", "OD_RANGE");
+			size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
 			size += sysfs_emit_at(buf, size, "SCLK: %7uMHz %10uMHz\n",
 				min_freq, max_freq);
 		}
@@ -1456,6 +1458,8 @@ static int smu10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
 	if (!buf)
 		return -EINVAL;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	size += sysfs_emit_at(buf, size, "%s %16s %s %s %s %s\n",title[0],
 			title[1], title[2], title[3], title[4], title[5]);
 
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
index e7803ce8f67a..aceebf584225 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
@@ -4914,6 +4914,8 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,
 	int size = 0;
 	uint32_t i, now, clock, pcie_speed;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	switch (type) {
 	case PP_SCLK:
 		smum_send_msg_to_smc(hwmgr, PPSMC_MSG_API_GetSclkFrequency, &clock);
@@ -4963,7 +4965,7 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,
 		break;
 	case OD_SCLK:
 		if (hwmgr->od_enabled) {
-			size = sysfs_emit(buf, "%s:\n", "OD_SCLK");
+			size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK");
 			for (i = 0; i < odn_sclk_table->num_of_pl; i++)
 				size += sysfs_emit_at(buf, size, "%d: %10uMHz %10umV\n",
 					i, odn_sclk_table->entries[i].clock/100,
@@ -4972,7 +4974,7 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,
 		break;
 	case OD_MCLK:
 		if (hwmgr->od_enabled) {
-			size = sysfs_emit(buf, "%s:\n", "OD_MCLK");
+			size += sysfs_emit_at(buf, size, "%s:\n", "OD_MCLK");
 			for (i = 0; i < odn_mclk_table->num_of_pl; i++)
 				size += sysfs_emit_at(buf, size, "%d: %10uMHz %10umV\n",
 					i, odn_mclk_table->entries[i].clock/100,
@@ -4981,7 +4983,7 @@ static int smu7_print_clock_levels(struct pp_hwmgr *hwmgr,
 		break;
 	case OD_RANGE:
 		if (hwmgr->od_enabled) {
-			size = sysfs_emit(buf, "%s:\n", "OD_RANGE");
+			size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
 			size += sysfs_emit_at(buf, size, "SCLK: %7uMHz %10uMHz\n",
 				data->golden_dpm_table.sclk_table.dpm_levels[0].value/100,
 				hwmgr->platform_descriptor.overdriveLimit.engineClock/100);
@@ -5518,6 +5520,8 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
 	if (!buf)
 		return -EINVAL;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	size += sysfs_emit_at(buf, size, "%s %16s %16s %16s %16s %16s %16s %16s\n",
 			title[0], title[1], title[2], title[3],
 			title[4], title[5], title[6], title[7]);
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
index b94a77e4e714..8e28a8eecefc 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
@@ -1550,6 +1550,8 @@ static int smu8_print_clock_levels(struct pp_hwmgr *hwmgr,
 	uint32_t i, now;
 	int size = 0;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	switch (type) {
 	case PP_SCLK:
 		now = PHM_GET_FIELD(cgs_read_ind_register(hwmgr->device,
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h
index ad33983a8064..2a75da1e9f03 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h
@@ -109,6 +109,19 @@ int phm_irq_process(struct amdgpu_device *adev,
 			   struct amdgpu_irq_src *source,
 			   struct amdgpu_iv_entry *entry);
 
+/*
+ * Helper function to make sysfs_emit_at() happy. Align buf to
+ * the current page boundary and record the offset.
+ */
+static inline void phm_get_sysfs_buf(char **buf, int *offset)
+{
+	if (!*buf || !offset)
+		return;
+
+	*offset = offset_in_page(*buf);
+	*buf -= *offset;
+}
+
 int smu9_register_irq_handlers(struct pp_hwmgr *hwmgr);
 
 void *smu_atom_get_data_table(void *dev, uint32_t table, uint16_t *size,
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
index c152a61ddd2c..c981fc2882f0 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
@@ -4548,6 +4548,8 @@ static int vega10_get_ppfeature_status(struct pp_hwmgr *hwmgr, char *buf)
 	int ret = 0;
 	int size = 0;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	ret = vega10_get_enabled_smc_features(hwmgr, &features_enabled);
 	PP_ASSERT_WITH_CODE(!ret,
 			"[EnableAllSmuFeatures] Failed to get enabled smc features!",
@@ -4637,6 +4639,8 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
 
 	int i, now, size = 0, count = 0;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	switch (type) {
 	case PP_SCLK:
 		if (data->registry_data.sclk_dpm_key_disabled)
@@ -4717,7 +4721,7 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
 
 	case OD_SCLK:
 		if (hwmgr->od_enabled) {
-			size = sysfs_emit(buf, "%s:\n", "OD_SCLK");
+			size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK");
 			podn_vdd_dep = &data->odn_dpm_table.vdd_dep_on_sclk;
 			for (i = 0; i < podn_vdd_dep->count; i++)
 				size += sysfs_emit_at(buf, size, "%d: %10uMhz %10umV\n",
@@ -4727,7 +4731,7 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
 		break;
 	case OD_MCLK:
 		if (hwmgr->od_enabled) {
-			size = sysfs_emit(buf, "%s:\n", "OD_MCLK");
+			size += sysfs_emit_at(buf, size, "%s:\n", "OD_MCLK");
 			podn_vdd_dep = &data->odn_dpm_table.vdd_dep_on_mclk;
 			for (i = 0; i < podn_vdd_dep->count; i++)
 				size += sysfs_emit_at(buf, size, "%d: %10uMhz %10umV\n",
@@ -4737,7 +4741,7 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
 		break;
 	case OD_RANGE:
 		if (hwmgr->od_enabled) {
-			size = sysfs_emit(buf, "%s:\n", "OD_RANGE");
+			size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
 			size += sysfs_emit_at(buf, size, "SCLK: %7uMHz %10uMHz\n",
 				data->golden_dpm_table.gfx_table.dpm_levels[0].value/100,
 				hwmgr->platform_descriptor.overdriveLimit.engineClock/100);
@@ -5112,6 +5116,8 @@ static int vega10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
 	if (!buf)
 		return -EINVAL;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	size += sysfs_emit_at(buf, size, "%s %16s %s %s %s %s\n",title[0],
 			title[1], title[2], title[3], title[4], title[5]);
 
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c
index 8558718e15a8..f7e783e1c888 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c
@@ -2141,6 +2141,8 @@ static int vega12_get_ppfeature_status(struct pp_hwmgr *hwmgr, char *buf)
 	int ret = 0;
 	int size = 0;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	ret = vega12_get_enabled_smc_features(hwmgr, &features_enabled);
 	PP_ASSERT_WITH_CODE(!ret,
 		"[EnableAllSmuFeatures] Failed to get enabled smc features!",
@@ -2244,6 +2246,8 @@ static int vega12_print_clock_levels(struct pp_hwmgr *hwmgr,
 	int i, now, size = 0;
 	struct pp_clock_levels_with_latency clocks;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	switch (type) {
 	case PP_SCLK:
 		PP_ASSERT_WITH_CODE(
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c
index 0cf39c1244b1..03e63be4ee27 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c
@@ -3238,6 +3238,8 @@ static int vega20_get_ppfeature_status(struct pp_hwmgr *hwmgr, char *buf)
 	int ret = 0;
 	int size = 0;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	ret = vega20_get_enabled_smc_features(hwmgr, &features_enabled);
 	PP_ASSERT_WITH_CODE(!ret,
 			"[EnableAllSmuFeatures] Failed to get enabled smc features!",
@@ -3364,6 +3366,8 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,
 	int ret = 0;
 	uint32_t gen_speed, lane_width, current_gen_speed, current_lane_width;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	switch (type) {
 	case PP_SCLK:
 		ret = vega20_get_current_clk_freq(hwmgr, PPCLK_GFXCLK, &now);
@@ -3479,7 +3483,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,
 	case OD_SCLK:
 		if (od8_settings[OD8_SETTING_GFXCLK_FMIN].feature_id &&
 		    od8_settings[OD8_SETTING_GFXCLK_FMAX].feature_id) {
-			size = sysfs_emit(buf, "%s:\n", "OD_SCLK");
+			size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK");
 			size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
 				od_table->GfxclkFmin);
 			size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
@@ -3489,7 +3493,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,
 
 	case OD_MCLK:
 		if (od8_settings[OD8_SETTING_UCLK_FMAX].feature_id) {
-			size = sysfs_emit(buf, "%s:\n", "OD_MCLK");
+			size += sysfs_emit_at(buf, size, "%s:\n", "OD_MCLK");
 			size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
 				od_table->UclkFmax);
 		}
@@ -3503,7 +3507,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,
 		    od8_settings[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id &&
 		    od8_settings[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id &&
 		    od8_settings[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id) {
-			size = sysfs_emit(buf, "%s:\n", "OD_VDDC_CURVE");
+			size += sysfs_emit_at(buf, size, "%s:\n", "OD_VDDC_CURVE");
 			size += sysfs_emit_at(buf, size, "0: %10uMhz %10dmV\n",
 				od_table->GfxclkFreq1,
 				od_table->GfxclkVolt1 / VOLTAGE_SCALE);
@@ -3518,7 +3522,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,
 		break;
 
 	case OD_RANGE:
-		size = sysfs_emit(buf, "%s:\n", "OD_RANGE");
+		size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
 
 		if (od8_settings[OD8_SETTING_GFXCLK_FMIN].feature_id &&
 		    od8_settings[OD8_SETTING_GFXCLK_FMAX].feature_id) {
@@ -4003,6 +4007,8 @@ static int vega20_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
 	if (!buf)
 		return -EINVAL;
 
+	phm_get_sysfs_buf(&buf, &size);
+
 	size += sysfs_emit_at(buf, size, "%16s %s %s %s %s %s %s %s %s %s %s\n",
 			title[0], title[1], title[2], title[3], title[4], title[5],
 			title[6], title[7], title[8], title[9], title[10]);
-- 
2.31.1

Maybe someone knows what I'm doing wrong, would be very much thankful for any input.

Edit4. Alright got it,

  local src
  for src in "${source[@]}"; do
    src="${src%%::*}"
    src="${src##*/}"
    [[ $src = *.patch ]] || continue
    echo "Applying patch $src..."
    patch -Np1 < "../$src"
  done

That's why it wanted to apply the patches twice. Compiling now, hope it'll go through and fix the problem with CoreCtrl.

Edit 5. Kernel-compilation worked out, but didn't help at all with the problem.

Last edited by leonavis (2021-11-22 16:45:27)

Offline

#6 2021-11-26 17:27:12

leonavis
Member
From: Bremen, Germany
Registered: 2021-06-27
Posts: 34

Re: [SOLVED] CoreCtrl undervolting issue

Okay, it's solved now. New kernel patch fixes it. Not the original problem... but oh well.

Edit Original problem was solved by reinstalling the system. Not the most elegant solution. But fixed it.

Last edited by leonavis (2021-11-27 13:56:48)

Offline

Board footer

Powered by FluxBB