Skip to contentSkip to conversation

drm/amd/pm: Add warning for unexpected PG requests

PATCH Superseded Lijo Lazar 3 participants 6 messages Nov 25, 2021 – Nov 26, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 1/1 drm/amd/pm: Add warning for unexpected PG requests

Ideally power gate/ungate requests shouldn't come when smu block is uninitialized. Add a WARN message to check the origins if such a thing ever happens.

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -1
index e156add7b560..e0f8ab8be975 100644
@@ -277,8 +277,11 @@ static int smu_dpm_set_power_gate(void *handle,
 	struct smu_context *smu = handle;
 	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
+	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+		WARN(true, "SMU uninitialized but power %s requested for %u!\n",
+		     gate ? "gate" : "ungate", block_type);
 		return -EOPNOTSUPP;
+	}
 
 	switch (block_type) {
 	/*
Signature · 1 line
2.25.1
#1 lore raw

[Public]

Use dev_warn to be mGPU friendly?

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lijo Lazar
Sent: Thursday, November 25, 2021 7:51 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Limonciello, Mario <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH] drm/amd/pm: Add warning for unexpected PG requests

Ideally power gate/ungate requests shouldn't come when smu block is uninitialized. Add a WARN message to check the origins if such a thing ever happens.

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -1
index e156add7b560..e0f8ab8be975 100644
@@ -277,8 +277,11 @@ static int smu_dpm_set_power_gate(void *handle,
 	struct smu_context *smu = handle;
 	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
+	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+		WARN(true, "SMU uninitialized but power %s requested for %u!\n",
+		     gate ? "gate" : "ungate", block_type);
 		return -EOPNOTSUPP;
+	}
 
 	switch (block_type) {
 	/*

--
2.25.1

#2 lore raw
Quoted 3 lines · Guchun

[Public]

Use dev_warn to be mGPU friendly?

The intention is to get a trace as well along with that. There are multiple paths to this function.

Thanks,
Lijo

Quoted 38 lines

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lijo Lazar
Sent: Thursday, November 25, 2021 7:51 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Limonciello, Mario <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH] drm/amd/pm: Add warning for unexpected PG requests

Ideally power gate/ungate requests shouldn't come when smu block is uninitialized. Add a WARN message to check the origins if such a thing ever happens.

---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -2
index e156add7b560..e0f8ab8be975 100644
@@ -277,8 +277,11 @@ static int smu_dpm_set_power_gate(void *handle,
  	struct smu_context *smu = handle;
  	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
+	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+		WARN(true, "SMU uninitialized but power %s requested for %u!\n",
+		     gate ? "gate" : "ungate", block_type);
  		return -EOPNOTSUPP;
+	}
 
  	switch (block_type) {
  	/*
--

2.25.1

Reviewed-by
#3 lore raw

[Public]

Thanks for clarification, Lijo.

Regards,
Guchun

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, November 25, 2021 9:32 PM
To: Chen, Guchun <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Limonciello, Mario <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Add warning for unexpected PG requests

Quoted 3 lines · Guchun

[Public]

Use dev_warn to be mGPU friendly?

The intention is to get a trace as well along with that. There are multiple paths to this function.

Thanks,
Lijo

Quoted 41 lines

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lijo Lazar
Sent: Thursday, November 25, 2021 7:51 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Limonciello, Mario <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH] drm/amd/pm: Add warning for unexpected PG requests

Ideally power gate/ungate requests shouldn't come when smu block is uninitialized. Add a WARN message to check the origins if such a thing ever happens.

---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -2
index e156add7b560..e0f8ab8be975 100644
@@ -277,8 +277,11 @@ static int smu_dpm_set_power_gate(void *handle,
  	struct smu_context *smu = handle;
  	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
+	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+		WARN(true, "SMU uninitialized but power %s requested for %u!\n",
+		     gate ? "gate" : "ungate", block_type);
  		return -EOPNOTSUPP;
+	}
 
  	switch (block_type) {
  	/*
--

2.25.1

#4 lore raw
In reply to Lazar, Lijo

Am 2021-11-25 um 8:32 a.m. schrieb Lazar, Lijo:

Quoted 9 lines · Guchun
Quoted 3 lines

[Public]

Use dev_warn to be mGPU friendly?

The intention is to get a trace as well along with that. There are multiple paths to this function.

There is also a dev_WARN and dev_WARN_ONCE.

Regards,
  Felix

Quoted 47 lines

Thanks,
Lijo

Quoted 43 lines

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lijo Lazar
Sent: Thursday, November 25, 2021 7:51 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Limonciello, Mario <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH] drm/amd/pm: Add warning for unexpected PG requests

Ideally power gate/ungate requests shouldn't come when smu block is uninitialized. Add a WARN message to check the origins if such a thing ever happens.

---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ++++-

  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -0
index e156add7b560..e0f8ab8be975 100644
@@ -277,8 +277,11 @@ static int smu_dpm_set_power_gate(void *handle,
       struct smu_context *smu = handle;
       int ret = 0;
   -    if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
+    if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+        WARN(true, "SMU uninitialized but power %s requested for
 %u!\n",
+             gate ? "gate" : "ungate", block_type);
           return -EOPNOTSUPP;
+    }
         switch (block_type) {
       /*
Signature · 1 line
2.25.1
#5 lore raw
Quoted 4 lines · Felix Kuehling

Am 2021-11-25 um 8:32 a.m. schrieb Lazar, Lijo:

Quoted 3 lines · Guchun
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

[Public]

Use dev_warn to be mGPU friendly?

The intention is to get a trace as well along with that. There are multiple paths to this function.

There is also a dev_WARN and dev_WARN_ONCE.

Thanks Felix for the pointer. Sent a revised version.

Thanks,
Lijo

Quoted 51 lines

Regards,
  Felix

Quoted 47 lines

Thanks,
Lijo

Quoted 43 lines

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lijo Lazar
Sent: Thursday, November 25, 2021 7:51 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Limonciello, Mario <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH] drm/amd/pm: Add warning for unexpected PG requests

Ideally power gate/ungate requests shouldn't come when smu block is uninitialized. Add a WARN message to check the origins if such a thing ever happens.

---
   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ++++-
   1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -0
index e156add7b560..e0f8ab8be975 100644
@@ -277,8 +277,11 @@ static int smu_dpm_set_power_gate(void *handle,
       struct smu_context *smu = handle;
       int ret = 0;
   -    if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
+    if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+        WARN(true, "SMU uninitialized but power %s requested for
 %u!\n",
+             gate ? "gate" : "ungate", block_type);
           return -EOPNOTSUPP;
+    }
         switch (block_type) {
       /*
Signature · 1 line
2.25.1