soc: qcom: icc-bwmon: drop the bandwidth vote across system suspend
PATCH 1/1 soc: qcom: icc-bwmon: drop the bandwidth vote across system suspend
icc-bwmon has no PM ops: the interconnect vote derived from the last sample stays in place while the system is suspended. On X1E80100 the CPU bwmon was left voting 800 MB/s peak on the DDR path during s2idle, which keeps DDR out of its low power modes (the qcom_stats "ddr" counter never advances).
Disable the monitor, drop the OPP vote on suspend and restart monitoring on resume. With this change DDR reaches its low power mode for >99% of s2idle on a Microsoft Surface Pro 11 (X1E80100).
---
drivers/soc/qcom/icc-bwmon.c +30 -0
@@ -815,6 +815,35 @@free_irq (bwmon->irq, bwmon); } +/* +* The bandwidth vote of the last sample stays in place across system +* suspend and keeps DDR out of its low power modes. Drop it while +* suspended and restart monitoring on resume. +*/ +static int bwmon_suspend (struct device *dev) +{ +struct icc_bwmon *bwmon =dev_get_drvdata (dev); + +disable_irq (bwmon->irq); +bwmon_disable (bwmon); +dev_pm_opp_set_opp (dev,NULL ); + bwmon->current_kbps =0 ; + +return 0 ; +} + +static int bwmon_resume (struct device *dev) +{ +struct icc_bwmon *bwmon =dev_get_drvdata (dev); + +bwmon_start (bwmon); +enable_irq (bwmon->irq); + +return 0 ; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(bwmon_pm_ops, bwmon_suspend, bwmon_resume); +static const struct icc_bwmon_data msm8998_bwmon_data = { .sample_ms =4 , .count_unit_kb =1024 ,
@@ -879,6 +907,7 @@ .driver = { .name = "qcom-bwmon", .of_match_table = bwmon_of_match, + .pm = pm_sleep_ptr(&bwmon_pm_ops), }, };module_platform_driver (bwmon_driver);
Quoted 9 lines · Ramón Jesús Miranda
icc-bwmon has no PM ops: the interconnect vote derived from the last sample stays in place while the system is suspended. On X1E80100 the CPU bwmon was left voting 800 MB/s peak on the DDR path during s2idle, which keeps DDR out of its low power modes (the
qcom_stats"ddr" counter never advances).Disable the monitor, drop the OPP vote on suspend and restart monitoring on resume. With this change DDR reaches its low power mode for >99% of s2idle on a Microsoft Surface Pro 11 (X1E80100).
Have you done a negative test (does reverting this patch alone break ddr collapse for you)? The DT uses ACTIVE_ONLY icc votes for BWMON, so as the CPU subsystem goes to sleep, these votes are removed in hardware.
Konrad
A message that is not in the archive (sent off-list or not yet received): CAP08=V3QB+pq0jd3UcAqzUhffv9D1fLO2UJjEKk6hURFRFfrmQ@mail.gmail.com
Quoted 11 lines · Ramón Jesús Miranda Hernández
Hi Konrad,
Thanks for asking. I have now run the negative test on X1E80100 (Surface Pro 11): kernel 7.2.8-arch1-10 with the icc-bwmon PM ops removed (patch 0002 reverted), then s2idle.
- Duration: 10308 s (2 h 52 min), suspended 14:23 to 17:15 local.
- Residency fromqcom_stats: CXSD 100 %, AOSD 99.8 % (S0ix), DDR 100 %.
- With the patch, earlier runs of 849 s and 880 s: S0ix 99.7 % and 99.9 %.
- No CDSP crash (sleep_statsi) during this boot.
Quoted 6 lines
This contradicts the claim in my commit message that the
qcom_stats"ddr" counter never advances without the patch. In this configuration it does advance, so reverting the PM ops alone does not break DDR collapse on this platform. It is one sample, and the runs differ in duration and conditions, so it is not a controlled comparison. I have not yet read the bwmon votes from the interconnect debugfs before suspend; I can add that if you want it.
No, this is conclusive enough that we can drop this patch.
Konrad
Quoted 1 line · Konrad Dybcio
No, this is conclusive enough that we can drop this patch.
Agreed, please consider it withdrawn. I have dropped it from my tree as well. Thanks for looking at it.
Ramón