Re: [PATCH v2] media: qcom: camss: fix VFE pm domain off

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29/11/2024 23:52, barnabas.czeman@xxxxxxxxxxxxxx wrote:
On 2024-11-30 00:07, Bryan O'Donoghue wrote:
On 29/11/2024 22:45, barnabas.czeman@xxxxxxxxxxxxxx wrote:
On 2024-11-29 23:08, Bryan O'Donoghue wrote:
On 29/11/2024 13:46, barnabas.czeman@xxxxxxxxxxxxxx wrote:
On 2024-11-29 13:25, Bryan O'Donoghue wrote:
On 29/11/2024 11:44, barnabas.czeman@xxxxxxxxxxxxxx wrote:
The change does not describe how to reproduce the problem, which commit base is tested, which platform is testes, there is no enough information,
unfortunately.
I can reproduce the problem with megapixels-sensorprofile on msm8953 and
it can be reproduced with megapixels on msm8996.
The base is the last commit on next.

Can you verify if vfe_domain_on has run and if so whether or not genpd_link is NULL when that function exists.

I have added some debug logs it seems pm_domain_on and pm_domain_off is called twice on the same object. [   63.473360] qcom-camss 1b00020.camss: pm_domain_on 19842ce8 link 42973800 [   63.481524] qcom-camss 1b00020.camss: pm_domain_on 19840080 link 4e413800 [   63.481555] qcom-camss 1b00020.camss: pm_domain_on 19842ce8 link 42973800 [   63.481632] qcom-camss 1b00020.camss: pm_domain_off 19840080 link 4e413800 [   63.481641] qcom-camss 1b00020.camss: pm_domain_off 19842ce8 link 42973800
[   63.654004] qcom-camss 1b00020.camss: pm_domain_off 19842ce8 link 0
That's the question.

---
bod

Could you provide this output ?

index 80a62ba112950..b25b8f6b00be1 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -595,6 +595,9 @@ void vfe_isr_reset_ack(struct vfe_device *vfe)
  */
 void vfe_pm_domain_off(struct vfe_device *vfe)
 {
+dev_info(camss->dev, "%s VFE %d genpd %pK genpd_link %pK\n",
+        __func__, vfe->id, vfe->genpd, vfe->genpd_link);
+
        if (!vfe->genpd)
                return;

@@ -609,7 +612,8 @@ void vfe_pm_domain_off(struct vfe_device *vfe)
 int vfe_pm_domain_on(struct vfe_device *vfe)
 {
        struct camss *camss = vfe->camss;
-
+dev_info(camss->dev, "%s VFE %d genpd %pK genpd_link %pK\n",
+        __func__, vfe->id, vfe->genpd, vfe->genpd_link);
        if (!vfe->genpd)
                return 0;

---
bod
I think logging in pm_domain_on should be placed after device_link_add because only NULL
will be visible.
[   83.040694] qcom-camss 1b00020.camss: vfe_pm_domain_on VFE 1 genpd 000000009bd8355f genpd_link 0000000000000000 [   83.049293] qcom-camss 1b00020.camss: vfe_pm_domain_on VFE 0 genpd 00000000bfb65e7c genpd_link 0000000000000000 [   83.049353] qcom-camss 1b00020.camss: vfe_pm_domain_on VFE 1 genpd 000000009bd8355f genpd_link 00000000ccb0acd9 [   83.049641] qcom-camss 1b00020.camss: vfe_pm_domain_off VFE 0 genpd 00000000bfb65e7c genpd_link 00000000348ac3c1 [   83.049654] qcom-camss 1b00020.camss: vfe_pm_domain_off VFE 1 genpd 000000009bd8355f genpd_link 00000000ccb0acd9 [   83.241498] qcom-camss 1b00020.camss: vfe_pm_domain_off VFE 1 genpd 000000009bd8355f genpd_link 0000000000000000

Could you add

+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -786,7 +786,7 @@ int vfe_get(struct vfe_device *vfe)
        int ret;

        mutex_lock(&vfe->power_lock);
-
+dev_info(vfe->camss->dev, "%s vfe %d power_count %d\n", __func__, vfe->id, vfe->power_count);
        if (vfe->power_count == 0) {
                ret = vfe->res->hw_ops->pm_domain_on(vfe);
                if (ret < 0)
@@ -823,6 +823,7 @@ int vfe_get(struct vfe_device *vfe)

        mutex_unlock(&vfe->power_lock);

+dev_info(camss->vfe->dev, "%s vfe %d err=%d\n", __func__, camss->vfe- >id, 0);
        return 0;

 error_reset:
@@ -835,7 +836,7 @@ int vfe_get(struct vfe_device *vfe)

 error_pm_domain:
        mutex_unlock(&vfe->power_lock);
-
+dev_info(camss->vfe->dev, "%s vfe %d err=%d\n", __func__, camss->vfe- >id, ret);
        return ret;
 }

?

---
bod
I have added little more from the logs because it is only failing in edge cases megapixels-sensorprofile failing by
different reason quickly and trying to release the device.
[   54.719030] qcom-camss 1b00020.camss: vfe_get vfe 0 err=0
[   54.750124] qcom-camss 1b00020.camss: vfe_get vfe 0 power_count 1
[   54.750236] qcom-camss 1b00020.camss: vfe_get vfe 0 err=0
[   54.751270] qcom-camss 1b00020.camss: vfe_pm_domain_on VFE 0 genpd 00000000beaef03c genpd_link 00000000251644d9

[   54.751433] qcom-camss 1b00020.camss: vfe_pm_domain_on VFE 1 genpd 000000007ce2da53 genpd_link 0000000000000000 [   54.755531] qcom-camss 1b00020.camss: vfe_pm_domain_off VFE 1 genpd 000000007ce2da53 genpd_link 0000000058dcd4d6

that's a bug genpd_link should be NULL unless power_count != 0

[  143.922868] qcom-camss 1b00020.camss: vfe_pm_domain_off VFE 1 genpd 000000007ce2da53 genpd_link 00000000d1fcd54b [  144.126535] qcom-camss 1b00020.camss: vfe_pm_domain_off VFE 1 genpd 000000007ce2da53 genpd_link 0000000000000000

this is the corollary of the bug

can you provide the output of the attached please ?
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
index 80a62ba112950..439085de1c9ab 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -774,6 +774,7 @@ static int vfe_check_clock_rates(struct vfe_device *vfe)
 
 	return 0;
 }
+#define vfe_bug_trace(vfe) dev_info(vfe->camss->dev, "%s/%d vfe %d power_count %d\n", __func__, __LINE__, vfe->id, vfe->power_count);
 
 /*
  * vfe_get - Power up and reset VFE module
@@ -786,31 +787,37 @@ int vfe_get(struct vfe_device *vfe)
 	int ret;
 
 	mutex_lock(&vfe->power_lock);
-
 	if (vfe->power_count == 0) {
+		vfe_bug_trace(vfe);
 		ret = vfe->res->hw_ops->pm_domain_on(vfe);
 		if (ret < 0)
 			goto error_pm_domain;
 
+		vfe_bug_trace(vfe);
 		ret = pm_runtime_resume_and_get(vfe->camss->dev);
 		if (ret < 0)
 			goto error_domain_off;
 
+		vfe_bug_trace(vfe);
 		ret = vfe_set_clock_rates(vfe);
 		if (ret < 0)
 			goto error_pm_runtime_get;
 
+		vfe_bug_trace(vfe);
 		ret = camss_enable_clocks(vfe->nclocks, vfe->clock,
 					  vfe->camss->dev);
 		if (ret < 0)
 			goto error_pm_runtime_get;
 
+		vfe_bug_trace(vfe);
 		ret = vfe_reset(vfe);
 		if (ret < 0)
 			goto error_reset;
 
+		vfe_bug_trace(vfe);
 		vfe_reset_output_maps(vfe);
 
+		vfe_bug_trace(vfe);
 		vfe_init_outputs(vfe);
 
 		vfe->res->hw_ops->hw_version(vfe);
@@ -821,6 +828,7 @@ int vfe_get(struct vfe_device *vfe)
 	}
 	vfe->power_count++;
 
+	vfe_bug_trace(vfe);
 	mutex_unlock(&vfe->power_lock);
 
 	return 0;
@@ -835,7 +843,7 @@ int vfe_get(struct vfe_device *vfe)
 
 error_pm_domain:
 	mutex_unlock(&vfe->power_lock);
-
+dev_info(camss->vfe->dev, "%s vfe %d err=%d\n", __func__, camss->vfe->id, ret);
 	return ret;
 }
 
@@ -847,20 +855,32 @@ void vfe_put(struct vfe_device *vfe)
 {
 	mutex_lock(&vfe->power_lock);
 
+	vfe_bug_trace(vfe);
 	if (vfe->power_count == 0) {
+		vfe_bug_trace(vfe);
 		dev_err(vfe->camss->dev, "vfe power off on power_count == 0\n");
 		goto exit;
 	} else if (vfe->power_count == 1) {
+		vfe_bug_trace(vfe);
 		if (vfe->was_streaming) {
+			vfe_bug_trace(vfe);
 			vfe->was_streaming = 0;
+			vfe_bug_trace(vfe);
 			vfe->res->hw_ops->vfe_halt(vfe);
+			vfe_bug_trace(vfe);
 		}
+		vfe_bug_trace(vfe);
 		camss_disable_clocks(vfe->nclocks, vfe->clock);
+		vfe_bug_trace(vfe);
 		pm_runtime_put_sync(vfe->camss->dev);
+		vfe_bug_trace(vfe);
 		vfe->res->hw_ops->pm_domain_off(vfe);
+		vfe_bug_trace(vfe);
 	}
 
+	vfe_bug_trace(vfe);
 	vfe->power_count--;
+	vfe_bug_trace(vfe);
 
 exit:
 	mutex_unlock(&vfe->power_lock);

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux