2022-07-22 05:36:58

by Naresh Kamboju

[permalink] [raw]
Subject: WARNING: CPU: 4 PID: 326 at drivers/opp/core.c:2471 dev_pm_opp_set_config+0x344/0x620

I have found this warning on db845c while booting Linux next-20220720.
Please find more details in the below link,

Reported-by: Linux Kernel Functional Testing <[email protected]>

[ 9.769688] WARNING: CPU: 4 PID: 326 at drivers/opp/core.c:2471
dev_pm_opp_set_config+0x344/0x620
[ 9.769698] i2c 16-0010: Fixing up cyclic dependency with acb3000.camss
[ 9.810991] msm-mdss ae00000.mdss: Adding to iommu group 15
[ 9.811082] Modules linked in: hci_uart qcom_camss msm(+) videobuf2_dma_sg
[ 9.823435] ath10k_snoc 18800000.wifi: supply vdd-3.3-ch1 not
found, using dummy regulator
[ 9.827664] ath10k_snoc(+) btqca v4l2_fwnode btbcm ath10k_core
venus_core(+) gpu_sched camcc_sdm845 reset_qcom_pdc v4l2_async
v4l2_mem2mem i2c_qcom_geni videobuf2_memops ath drm_dp_aux_bus
drm_display_helper videobuf2_v4l2 bluetooth mac80211 i2c_qcom_cci
videobuf2_common qcom_rng spi_geni_qcom gpi(+) qcom_q6v5_mss xhci_pci
qrtr xhci_pci_renesas cfg80211 rfkill slim_qcom_ngd_ctrl lmh
icc_osm_l3 pdr_interface slimbus qcom_wdt display_connector icc_bwmon
qcom_q6v5_pas qcom_pil_info qcom_q6v5 qcom_sysmon drm_kms_helper
qcom_common qcom_glink_smem qmi_helpers mdt_loader drm socinfo
rmtfs_mem fuse
[ 9.885445] qcom-camss acb3000.camss: Adding to iommu group 16
[ 9.911179] platform ae94000.dsi: Fixing up cyclic dependency with
ae01000.display-controller
[[0;32m OK [0m] Started D-Bus System Message Bus.[ 9.911593]
Bluetooth: hci0: setting up wcn399x
[ 9.928261] CPU: 4 PID: 326 Comm: systemd-udevd Not tainted
5.19.0-rc7-next-20220720 #1

[ 9.928265] Hardware name: Thundercomm Dragonboard 845c (DT)
[ 9.928267] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 9.928269] pc : dev_pm_opp_set_config+0x344/0x620
[ 9.977763] lr : dev_pm_opp_set_config+0x68/0x620
[ 9.982508] sp : ffff8000089337b0
[ 9.985846] x29: ffff8000089337b0 x28: ffff800008933c90 x27: ffff3e2780f9bc10
[ 9.993030] x26: ffffb9048f76dd40 x25: ffffb904d98c8de8 x24: ffff3e278da60080
[ 10.000226] x23: ffff3e2780f9bc10 x22: ffff8000089338b0 x21: ffff3e278eda0d80
[ 10.007416] x20: ffff3e2780f9bc10 x19: ffff3e2786ffe000 x18: ffffffffffffffff
[ 10.014602] x17: 0000000000000000 x16: ffffb904d7d90f50 x15: 6f63713d305f454c
[ 10.021795] x14: ffffb904d9df6a20 x13: 0000000000000040 x12: 0000000000000228
[ 10.028981] x11: 0000000000000000 x10: 0000000000000bd0 x9 : ffffb904d7d905e0
[ 10.036166] x8 : ffff3e27833a8c30 x7 : 0000000000000018 x6 : 0000000000000001
[ 10.043361] x5 : ffffb904d982f000 x4 : ffff3e27833a8000 x3 : ffffb904d9bf2c20
[ 10.043365] x2 : 0000000000000000 x1 : ffff3e2786f70d00 x0 : ffff3e2786ffe060
[ 10.043368] Call trace:
[ 10.043369] dev_pm_opp_set_config+0x344/0x620
[ 10.043373] devm_pm_opp_set_config+0x24/0x80
[ 10.043376] core_get_v4+0x244/0x360 [venus_core]
[ 10.043393] venus_probe+0x100/0x470 [venus_core]
[ 10.043404] platform_probe+0x74/0xf0
[ 10.043410] really_probe+0xc8/0x3e0
[ 10.043413] __driver_probe_device+0x84/0x190
[[0;32m OK [0m] Started Avahi mDNS/DNS-SD Stack.
[ 10.043414] driver_probe_device+0x44/0x100
[ 10.043416] __driver_attach+0xd8/0x210
[ 10.043418] bus_for_each_dev+0x7c/0xe0
[ 10.043420] driver_attach+0x30/0x3c
[ 10.043422] bus_add_driver+0x188/0x244
[ 10.043424] driver_register+0x84/0x140
[ 10.043426] __platform_driver_register+0x34/0x40
[ 10.043428] qcom_venus_driver_init+0x30/0x1000 [venus_core]
[ 10.043440] do_one_initcall+0x50/0x2b0
[ 10.043445] do_init_module+0x50/0x200
[ 10.043448] load_module+0x1b5c/0x1fc4
[ 10.043449] __do_sys_finit_module+0xac/0x12c
[ 10.043451] __arm64_sys_finit_module+0x2c/0x40
[ 10.043453] invoke_syscall+0x50/0x120
[ 10.043457] el0_svc_common.constprop.0+0x104/0x124
[ 10.043460] do_el0_svc+0x3c/0xd0
[ 10.043463] el0_svc+0x30/0x94
[ 10.043467] el0t_64_sync_handler+0xbc/0x140
[ 10.043469] el0t_64_sync+0x18c/0x190
[ 10.043471] ---[ end trace 0000000000000000 ]---

Link:
https://qa-reports.linaro.org/lkft/linux-next-master/build/v5.19-rc6-12429-g4ee7eaa411ee/testrun/10922376/suite/log-parser-test/test/check-kernel-warning-5303907/details/

Build: https://builds.tuxbuild.com/2CD0dD2GUweY5lvh8VnF3rWZWEm/
vmlinux: https://builds.tuxbuild.com/2CD0dD2GUweY5lvh8VnF3rWZWEm/vmlinux.xz
System.map: https://builds.tuxbuild.com/2CD0dD2GUweY5lvh8VnF3rWZWEm/System.map

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


2022-07-25 10:49:40

by Viresh Kumar

[permalink] [raw]
Subject: Re: WARNING: CPU: 4 PID: 326 at drivers/opp/core.c:2471 dev_pm_opp_set_config+0x344/0x620

On 22-07-22, 11:01, Naresh Kamboju wrote:
> I have found this warning on db845c while booting Linux next-20220720.
> Please find more details in the below link,
>
> Reported-by: Linux Kernel Functional Testing <[email protected]>
>
> [ 9.769688] WARNING: CPU: 4 PID: 326 at drivers/opp/core.c:2471
> dev_pm_opp_set_config+0x344/0x620
> [ 9.769698] i2c 16-0010: Fixing up cyclic dependency with acb3000.camss
> [ 9.810991] msm-mdss ae00000.mdss: Adding to iommu group 15
> [ 9.811082] Modules linked in: hci_uart qcom_camss msm(+) videobuf2_dma_sg
> [ 9.823435] ath10k_snoc 18800000.wifi: supply vdd-3.3-ch1 not
> found, using dummy regulator
> [ 9.827664] ath10k_snoc(+) btqca v4l2_fwnode btbcm ath10k_core
> venus_core(+) gpu_sched camcc_sdm845 reset_qcom_pdc v4l2_async
> v4l2_mem2mem i2c_qcom_geni videobuf2_memops ath drm_dp_aux_bus
> drm_display_helper videobuf2_v4l2 bluetooth mac80211 i2c_qcom_cci
> videobuf2_common qcom_rng spi_geni_qcom gpi(+) qcom_q6v5_mss xhci_pci
> qrtr xhci_pci_renesas cfg80211 rfkill slim_qcom_ngd_ctrl lmh
> icc_osm_l3 pdr_interface slimbus qcom_wdt display_connector icc_bwmon
> qcom_q6v5_pas qcom_pil_info qcom_q6v5 qcom_sysmon drm_kms_helper
> qcom_common qcom_glink_smem qmi_helpers mdt_loader drm socinfo
> rmtfs_mem fuse
> [ 9.885445] qcom-camss acb3000.camss: Adding to iommu group 16
> [ 9.911179] platform ae94000.dsi: Fixing up cyclic dependency with
> ae01000.display-controller
> [[0;32m OK [0m] Started D-Bus System Message Bus.[ 9.911593]
> Bluetooth: hci0: setting up wcn399x
> [ 9.928261] CPU: 4 PID: 326 Comm: systemd-udevd Not tainted
> 5.19.0-rc7-next-20220720 #1
>
> [ 9.928265] Hardware name: Thundercomm Dragonboard 845c (DT)
> [ 9.928267] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [ 9.928269] pc : dev_pm_opp_set_config+0x344/0x620
> [ 9.977763] lr : dev_pm_opp_set_config+0x68/0x620
> [ 9.982508] sp : ffff8000089337b0
> [ 9.985846] x29: ffff8000089337b0 x28: ffff800008933c90 x27: ffff3e2780f9bc10
> [ 9.993030] x26: ffffb9048f76dd40 x25: ffffb904d98c8de8 x24: ffff3e278da60080
> [ 10.000226] x23: ffff3e2780f9bc10 x22: ffff8000089338b0 x21: ffff3e278eda0d80
> [ 10.007416] x20: ffff3e2780f9bc10 x19: ffff3e2786ffe000 x18: ffffffffffffffff
> [ 10.014602] x17: 0000000000000000 x16: ffffb904d7d90f50 x15: 6f63713d305f454c
> [ 10.021795] x14: ffffb904d9df6a20 x13: 0000000000000040 x12: 0000000000000228
> [ 10.028981] x11: 0000000000000000 x10: 0000000000000bd0 x9 : ffffb904d7d905e0
> [ 10.036166] x8 : ffff3e27833a8c30 x7 : 0000000000000018 x6 : 0000000000000001
> [ 10.043361] x5 : ffffb904d982f000 x4 : ffff3e27833a8000 x3 : ffffb904d9bf2c20
> [ 10.043365] x2 : 0000000000000000 x1 : ffff3e2786f70d00 x0 : ffff3e2786ffe060
> [ 10.043368] Call trace:
> [ 10.043369] dev_pm_opp_set_config+0x344/0x620
> [ 10.043373] devm_pm_opp_set_config+0x24/0x80
> [ 10.043376] core_get_v4+0x244/0x360 [venus_core]
> [ 10.043393] venus_probe+0x100/0x470 [venus_core]
> [ 10.043404] platform_probe+0x74/0xf0

Stanimir / Bjorn,

The OPP core expects all configuration options to be provided before the OPP
table is added. i.e. (for your case here), we need to call
devm_pm_opp_set_clkname() and devm_pm_opp_attach_genpd(), before calling
devm_pm_opp_of_add_table(). This is a hard requirement, it was a hard
requirement earlier (before the new changes in OPP core came in) too, just that
devm_pm_opp_attach_genpd() was missing the necessary WARN(), which was there in
every other helper.

Can someone from Qcom team reorder things a bit provide a patch to fix this
WARN() ? I will carry that in my tree then.

It may look like this, I don't want to touch code that I don't understand at
all:

diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index cb48c5ff3dee..c93d2906e4c7 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -875,7 +875,7 @@ static int vcodec_domains_get(struct venus_core *core)
}

skip_pmdomains:
- if (!core->has_opp_table)
+ if (!core->res->opp_pmdomain)
return 0;

/* Attach the power domain for setting performance state */
@@ -1007,6 +1007,10 @@ static int core_get_v4(struct venus_core *core)
if (ret)
return ret;

+ ret = vcodec_domains_get(core);
+ if (ret)
+ return ret;
+
if (core->res->opp_pmdomain) {
ret = devm_pm_opp_of_add_table(dev);
if (!ret) {
@@ -1017,10 +1021,6 @@ static int core_get_v4(struct venus_core *core)
}
}

- ret = vcodec_domains_get(core);
- if (ret)
- return ret;
-
return 0;
}

--
viresh

2022-07-25 12:09:20

by Stanimir Varbanov

[permalink] [raw]
Subject: Re: WARNING: CPU: 4 PID: 326 at drivers/opp/core.c:2471 dev_pm_opp_set_config+0x344/0x620

Hi Viresh,

I can take a look and provide a patch to fix that.

But, is this a new warn or it is a consequence of new changes in
opp/core.c ?

On 7/25/22 13:27, Viresh Kumar wrote:
> On 22-07-22, 11:01, Naresh Kamboju wrote:
>> I have found this warning on db845c while booting Linux next-20220720.
>> Please find more details in the below link,
>>
>> Reported-by: Linux Kernel Functional Testing <[email protected]>
>>
>> [ 9.769688] WARNING: CPU: 4 PID: 326 at drivers/opp/core.c:2471
>> dev_pm_opp_set_config+0x344/0x620
>> [ 9.769698] i2c 16-0010: Fixing up cyclic dependency with acb3000.camss
>> [ 9.810991] msm-mdss ae00000.mdss: Adding to iommu group 15
>> [ 9.811082] Modules linked in: hci_uart qcom_camss msm(+) videobuf2_dma_sg
>> [ 9.823435] ath10k_snoc 18800000.wifi: supply vdd-3.3-ch1 not
>> found, using dummy regulator
>> [ 9.827664] ath10k_snoc(+) btqca v4l2_fwnode btbcm ath10k_core
>> venus_core(+) gpu_sched camcc_sdm845 reset_qcom_pdc v4l2_async
>> v4l2_mem2mem i2c_qcom_geni videobuf2_memops ath drm_dp_aux_bus
>> drm_display_helper videobuf2_v4l2 bluetooth mac80211 i2c_qcom_cci
>> videobuf2_common qcom_rng spi_geni_qcom gpi(+) qcom_q6v5_mss xhci_pci
>> qrtr xhci_pci_renesas cfg80211 rfkill slim_qcom_ngd_ctrl lmh
>> icc_osm_l3 pdr_interface slimbus qcom_wdt display_connector icc_bwmon
>> qcom_q6v5_pas qcom_pil_info qcom_q6v5 qcom_sysmon drm_kms_helper
>> qcom_common qcom_glink_smem qmi_helpers mdt_loader drm socinfo
>> rmtfs_mem fuse
>> [ 9.885445] qcom-camss acb3000.camss: Adding to iommu group 16
>> [ 9.911179] platform ae94000.dsi: Fixing up cyclic dependency with
>> ae01000.display-controller
>> [[0;32m OK [0m] Started D-Bus System Message Bus.[ 9.911593]
>> Bluetooth: hci0: setting up wcn399x
>> [ 9.928261] CPU: 4 PID: 326 Comm: systemd-udevd Not tainted
>> 5.19.0-rc7-next-20220720 #1
>>
>> [ 9.928265] Hardware name: Thundercomm Dragonboard 845c (DT)
>> [ 9.928267] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
>> [ 9.928269] pc : dev_pm_opp_set_config+0x344/0x620
>> [ 9.977763] lr : dev_pm_opp_set_config+0x68/0x620
>> [ 9.982508] sp : ffff8000089337b0
>> [ 9.985846] x29: ffff8000089337b0 x28: ffff800008933c90 x27: ffff3e2780f9bc10
>> [ 9.993030] x26: ffffb9048f76dd40 x25: ffffb904d98c8de8 x24: ffff3e278da60080
>> [ 10.000226] x23: ffff3e2780f9bc10 x22: ffff8000089338b0 x21: ffff3e278eda0d80
>> [ 10.007416] x20: ffff3e2780f9bc10 x19: ffff3e2786ffe000 x18: ffffffffffffffff
>> [ 10.014602] x17: 0000000000000000 x16: ffffb904d7d90f50 x15: 6f63713d305f454c
>> [ 10.021795] x14: ffffb904d9df6a20 x13: 0000000000000040 x12: 0000000000000228
>> [ 10.028981] x11: 0000000000000000 x10: 0000000000000bd0 x9 : ffffb904d7d905e0
>> [ 10.036166] x8 : ffff3e27833a8c30 x7 : 0000000000000018 x6 : 0000000000000001
>> [ 10.043361] x5 : ffffb904d982f000 x4 : ffff3e27833a8000 x3 : ffffb904d9bf2c20
>> [ 10.043365] x2 : 0000000000000000 x1 : ffff3e2786f70d00 x0 : ffff3e2786ffe060
>> [ 10.043368] Call trace:
>> [ 10.043369] dev_pm_opp_set_config+0x344/0x620
>> [ 10.043373] devm_pm_opp_set_config+0x24/0x80
>> [ 10.043376] core_get_v4+0x244/0x360 [venus_core]
>> [ 10.043393] venus_probe+0x100/0x470 [venus_core]
>> [ 10.043404] platform_probe+0x74/0xf0
>
> Stanimir / Bjorn,
>
> The OPP core expects all configuration options to be provided before the OPP
> table is added. i.e. (for your case here), we need to call
> devm_pm_opp_set_clkname() and devm_pm_opp_attach_genpd(), before calling
> devm_pm_opp_of_add_table(). This is a hard requirement, it was a hard
> requirement earlier (before the new changes in OPP core came in) too, just that
> devm_pm_opp_attach_genpd() was missing the necessary WARN(), which was there in
> every other helper.
>
> Can someone from Qcom team reorder things a bit provide a patch to fix this
> WARN() ? I will carry that in my tree then.
>
> It may look like this, I don't want to touch code that I don't understand at
> all:
>
> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
> index cb48c5ff3dee..c93d2906e4c7 100644
> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
> @@ -875,7 +875,7 @@ static int vcodec_domains_get(struct venus_core *core)
> }
>
> skip_pmdomains:
> - if (!core->has_opp_table)
> + if (!core->res->opp_pmdomain)
> return 0;
>
> /* Attach the power domain for setting performance state */
> @@ -1007,6 +1007,10 @@ static int core_get_v4(struct venus_core *core)
> if (ret)
> return ret;
>
> + ret = vcodec_domains_get(core);
> + if (ret)
> + return ret;
> +
> if (core->res->opp_pmdomain) {
> ret = devm_pm_opp_of_add_table(dev);
> if (!ret) {
> @@ -1017,10 +1021,6 @@ static int core_get_v4(struct venus_core *core)
> }
> }
>
> - ret = vcodec_domains_get(core);
> - if (ret)
> - return ret;
> -
> return 0;
> }
>

--
regards,
Stan

2022-07-25 12:12:22

by Viresh Kumar

[permalink] [raw]
Subject: Re: WARNING: CPU: 4 PID: 326 at drivers/opp/core.c:2471 dev_pm_opp_set_config+0x344/0x620

On 25-07-22, 14:55, Stanimir Varbanov wrote:
> Hi Viresh,
>
> I can take a look and provide a patch to fix that.
>
> But, is this a new warn or it is a consequence of new changes in
> opp/core.c ?

This WARN was missing earlier (by mistake) and is added now after some
redesigning. You can reproduce it on the OPP tree:

git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git opp/linux-next

--
viresh

2022-08-01 03:29:05

by Viresh Kumar

[permalink] [raw]
Subject: Re: WARNING: CPU: 4 PID: 326 at drivers/opp/core.c:2471 dev_pm_opp_set_config+0x344/0x620

On 25-07-22, 14:55, Stanimir Varbanov wrote:
> Hi Viresh,
>
> I can take a look and provide a patch to fix that.

Any update on this ? I am going to send pull request for 5.20 very soon and it
would have been much better if this was fixed before I send that.

--
viresh

2022-08-01 07:40:16

by Stanimir Varbanov

[permalink] [raw]
Subject: Re: WARNING: CPU: 4 PID: 326 at drivers/opp/core.c:2471 dev_pm_opp_set_config+0x344/0x620

Hi Viresh,

On 8/1/22 05:36, Viresh Kumar wrote:
> On 25-07-22, 14:55, Stanimir Varbanov wrote:
>> Hi Viresh,
>>
>> I can take a look and provide a patch to fix that.
>
> Any update on this ? I am going to send pull request for 5.20 very soon and it
> would have been much better if this was fixed before I send that.
>

I hope, I will finish up this today.


--
regards,
Stan

2022-08-01 11:50:38

by Viresh Kumar

[permalink] [raw]
Subject: Re: WARNING: CPU: 4 PID: 326 at drivers/opp/core.c:2471 dev_pm_opp_set_config+0x344/0x620

On 01-08-22, 14:36, Stanimir Varbanov wrote:
> Viresh,
>
> On 8/1/22 05:36, Viresh Kumar wrote:
> > On 25-07-22, 14:55, Stanimir Varbanov wrote:
> >> Hi Viresh,
> >>
> >> I can take a look and provide a patch to fix that.
> >
> > Any update on this ? I am going to send pull request for 5.20 very soon and it
> > would have been much better if this was fixed before I send that.
> >
>
> I'm trying on next-20220728, but applying [1] gives below errors:
>
> /linux-next/drivers/media/platform/qcom/venus/pm_helpers.c: In function
> ‘core_get_v1’:
> /linux-next/drivers/media/platform/qcom/venus/pm_helpers.c:299:4: error:
> ‘struct dev_pm_opp_config’ has no member named ‘clk_count’
> 299 | .clk_count = 1,
> | ^~~~~~~~~
>
>
> Do you have v3 for Venus driver ?

You don't need to apply anything over linux-next, it has everything you need.
The patch you mention is dropped and we carry separate calls to configure OPP
resources for now.

--
viresh

2022-08-01 11:51:19

by Stanimir Varbanov

[permalink] [raw]
Subject: Re: WARNING: CPU: 4 PID: 326 at drivers/opp/core.c:2471 dev_pm_opp_set_config+0x344/0x620

Viresh,

On 8/1/22 05:36, Viresh Kumar wrote:
> On 25-07-22, 14:55, Stanimir Varbanov wrote:
>> Hi Viresh,
>>
>> I can take a look and provide a patch to fix that.
>
> Any update on this ? I am going to send pull request for 5.20 very soon and it
> would have been much better if this was fixed before I send that.
>

I'm trying on next-20220728, but applying [1] gives below errors:

/linux-next/drivers/media/platform/qcom/venus/pm_helpers.c: In function
‘core_get_v1’:
/linux-next/drivers/media/platform/qcom/venus/pm_helpers.c:299:4: error:
‘struct dev_pm_opp_config’ has no member named ‘clk_count’
299 | .clk_count = 1,
| ^~~~~~~~~


Do you have v3 for Venus driver ?

--
regards,
Stan

[1]
https://patchwork.kernel.org/project/linux-pm/patch/989d085e6ff7ca6196e7076bba3aad8ac8851b00.1656660185.git.viresh.kumar@linaro.org/