android_kernel_motorola_sm6375/drivers/devfreq
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Tashfin Shakeer Rhythm 695569241b devfreq: bimc-bwmon: Don't free/reallocate IRQ during suspend/resume
In __resume_bw_hwmon(), request_threaded_irq() tries to make a big allocation
before everything is thawed and oom killer is re-enabled, which triggers an
order-2 memory allocation failure from kthreadd. This causes the devfreq device
to fail to create the IRQ thread, and therefore, it can't resume. At this point,
IRQs like qcom,cpu-cpu-llcc-bwmon, qcom,cpu-llcc-ddr-bwmon, qcom,snoop-l3-bwmon
are not allocated. But __suspend_bw_hwmon() tries to free them anyway, causing
the following series of call traces:

[49231.949317] kthreadd: page allocation failure: order:2, mode:0x400d00(GFP_NOIO|__GFP_ZERO|__GFP_ACCOUNT), nodemask=(null),cpuset=/,mems_allowed=0
[49231.949341] CPU: 2 PID: 2 Comm: kthreadd Not tainted 5.4.278-Scarlet-v1.0-beta8 #1
[49231.949345] Hardware name: redwood based Qualcomm Technologies, Inc. SM7325 (DT)
[49231.949349] Call trace:
[49231.949366] dump_backtrace+0x0/0x1a0
[49231.949373] show_stack+0x14/0x20
[49231.949384] dump_stack+0x8c/0xcc
[49231.949394] warn_alloc+0xec/0x110
[49231.949401] __alloc_pages_slowpath+0xe80/0xf00
[49231.949409] __alloc_pages_nodemask+0x150/0x180
[49231.949421] dup_task_struct+0x90/0x1e0
[49231.949427] copy_process+0x150/0xb30
[49231.949433] _do_fork+0x88/0x350
[49231.949439] kernel_thread+0x48/0x70
[49231.949448] kthreadd+0x1ec/0x280
[49231.949454] ret_from_fork+0x10/0x18
[49231.949470] Mem-Info:
[49231.949488] active_anon:348299 inactive_anon:132548 isolated_anon:0
 active_file:97104 inactive_file:98252 isolated_file:0
 unevictable:61330 dirty:0 writeback:0 unstable:0
 slab_reclaimable:23532 slab_unreclaimable:64025
 mapped:208056 shmem:15179 pagetables:31685 bounce:0
 free:36974 free_pcp:0 free_cma:46
[49231.949502] Node 0 active_anon:1393196kB inactive_anon:530192kB active_file:388416kB inactive_file:393008kB unevictable:245320kB isolated(anon):0kB isolated(file):0kB mapped:832224kB dirty:0kB writeback:0kB shmem:60716kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no
[49231.949519] Normal free:147896kB min:9312kB low:44784kB high:50268kB active_anon:1393080kB inactive_anon:530372kB active_file:388236kB inactive_file:392776kB unevictable:245320kB writepending:0kB present:5642556kB managed:5484672kB mlocked:244888kB kernel_stack:82704kB pagetables:126740kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:184kB
[49231.949522] lowmem_reserve[]: 0 0
[49231.949530] Normal: 32941*4kB (UMECH) 2020*8kB (UMEH) 35*16kB (H) 7*32kB (H) 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 148708kB
[49231.949568] 257736 total pagecache pages
[49231.949573] 3431 pages in swap cache
[49231.949578] Swap cache stats: add 7482872, delete 7479455, find 338640/3769326
[49231.949581] Free swap  = 2294120kB
[49231.949584] Total swap = 4194300kB
[49231.949588] 1410639 pages RAM
[49231.949591] 0 pages HighMem/MovableOnly
[49231.949594] 39471 pages reserved
[49231.949597] 72704 pages cma reserved
[49231.949606] cma: cma-0 pages: => 579 used of 5120 total pages
[49231.949613] cma: cma-1 pages: => 512 used of 3072 total pages
[49231.949619] cma: cma-2 pages: => 0 used of 4096 total pages
[49231.949627] cma: cma-3 pages: => 826 used of 8192 total pages
[49231.949635] cma: cma-4 pages: => 0 used of 7168 total pages
[49231.949669] cma: cma-5 pages: => 0 used of 35840 total pages
[49231.949676] cma: cma-6 pages: => 0 used of 4096 total pages
[49231.949683] cma: cma-7 pages: => 0 used of 5120 total pages
[49231.949725] bimc-bwmon 90b9100.qcom,snoop-l3-bwmon: Unable to register interrupt handler! (-12)
[49231.949738] devfreq-icc 18590100.qcom,snoop-l3-bw: Unable to start HW monitor! (-12)
[49231.949741] devfreq-icc 18590100.qcom,snoop-l3-bw: Unable to resume BW HW mon governor (-12)
[49231.949744] devfreq 18590100.qcom,snoop-l3-bw: failed to resume devfreq device
[49231.949880] bimc-bwmon 9091000.qcom,cpu-llcc-ddr-bwmon: Unable to register interrupt handler! (-12)
[49231.949884] devfreq-icc soc:qcom,cpu-llcc-ddr-bw: Unable to start HW monitor! (-12)
[49231.949885] devfreq-icc soc:qcom,cpu-llcc-ddr-bw: Unable to resume BW HW mon governor (-12)
[49231.949888] devfreq soc:qcom,cpu-llcc-ddr-bw: failed to resume devfreq device
[49231.950002] bimc-bwmon 90b6400.qcom,cpu-cpu-llcc-bwmon: Unable to register interrupt handler! (-12)
[49231.950004] devfreq-icc soc:qcom,cpu-cpu-llcc-bw: Unable to start HW monitor! (-12)
[49231.950006] devfreq-icc soc:qcom,cpu-cpu-llcc-bw: Unable to resume BW HW mon governor (-12)
[49231.950009] devfreq soc:qcom,cpu-cpu-llcc-bw: failed to resume devfreq device
[49232.171457] Filesystems sync: 0.005 seconds
[49232.398473] Filesystems sync: 0.008 seconds
[49232.417668] ------------[ cut here ]------------
[49232.417674] Trying to free already-free IRQ 53
[49232.417702] WARNING: CPU: 6 PID: 3656 at kernel/irq/manage.c:1765 __free_irq+0x2fc/0x400
[49232.417710] CPU: 6 PID: 3656 Comm: binder:502_7 Not tainted 5.4.278-Scarlet-v1.0-beta8 #1
[49232.417714] Hardware name: redwood based Qualcomm Technologies, Inc. SM7325 (DT)
[49232.417717] pstate: 60000085 (nZCv daIf -PAN -UAO)
[49232.417722] pc : __free_irq+0x2fc/0x400
[49232.417726] lr : __free_irq+0x2f8/0x400
[49232.417728] sp : ffffffaa166669e0
[49232.417731] x29: ffffffaa166669e0 x28: ffffffa9ae80d400
[49232.417735] x27: 0000000000000000 x26: 0000000000000000
[49232.417739] x25: ffffffa91ff3e268 x24: ffffffa9ae80d400
[49232.417742] x23: ffffffaa1948dc40 x22: 0000000000000035
[49232.417746] x21: ffffffa91ff3e2a0 x20: 0000000000000000
[49232.417749] x19: ffffffa91ff3e200 x18: 00000000ffed03ec
[49232.417753] x17: 00000000000d03ec x16: ffffffda6c1a54e8
[49232.417756] x15: 0000000000000000 x14: 0000000000000082
[49232.417759] x13: 0000000000000034 x12: 0000000000000004
[49232.417761] x11: ffffffda6c1a54e0 x10: 00000000ffffffff
[49232.417764] x9 : 115043787f31d900 x8 : 0000000000000000
[49232.417767] x7 : 0000000000000000 x6 : 7420676e69797254
[49232.417770] x5 : ffffffda6c2d5126 x4 : 0000000000000000
[49232.417773] x3 : 0000000000000000 x2 : ffffffffffffc9ff
[49232.417776] x1 : 0000000000000000 x0 : 0000000000000022
[49232.417780] Call trace:
[49232.417785] __free_irq+0x2fc/0x400
[49232.417789] free_irq+0x30/0x90
[49232.417802] suspend_bw_hwmon2+0xb8/0x140
[49232.417809] devfreq_bw_hwmon_ev_handler+0x1b4/0x520
[49232.417820] devfreq_suspend_device+0x58/0xe0
[49232.417825] devfreq_suspend+0x54/0x90
[49232.417838] dpm_suspend+0x2c/0x340
[49232.417841] dpm_suspend_start+0x7c/0xa0
[49232.417846] suspend_devices_and_enter+0xe0/0x5c0
[49232.417849] pm_suspend+0x258/0x280
[49232.417858] state_store+0x100/0x150
[49232.417869] kobj_attr_store+0x14/0x30
[49232.417883] sysfs_kf_write+0x38/0x50
[49232.417888] kernfs_fop_write+0x168/0x290
[49232.417896] __vfs_write+0x34/0x190
[49232.417899] vfs_write+0x11c/0x2d0
[49232.417903] __arm64_sys_write+0x78/0x110
[49232.417910] el0_svc_common+0xb0/0x120
[49232.417913] do_el0_svc+0x18/0x20
[49232.417918] el0_sync_handler+0x148/0x190
[49232.417922] el0_sync+0x140/0x180
[49232.417925] ---[ end trace b44a82c335d29d61 ]---
[49232.417952] ------------[ cut here ]------------
[49232.417954] Trying to free already-free IRQ 52
[49232.417962] WARNING: CPU: 6 PID: 3656 at kernel/irq/manage.c:1765 __free_irq+0x2fc/0x400
[49232.417966] CPU: 6 PID: 3656 Comm: binder:502_7 Tainted: G        W         5.4.278-Scarlet-v1.0-beta8 #1
[49232.417968] Hardware name: redwood based Qualcomm Technologies, Inc. SM7325 (DT)
[49232.417970] pstate: 60000085 (nZCv daIf -PAN -UAO)
[49232.417974] pc : __free_irq+0x2fc/0x400
[49232.417977] lr : __free_irq+0x2f8/0x400
[49232.417979] sp : ffffffaa166669e0
[49232.417980] x29: ffffffaa166669e0 x28: ffffffa9ae80d400
[49232.417984] x27: 0000000000000000 x26: 0000000000000000
[49232.417987] x25: ffffffa91ff3e068 x24: ffffffa9ae80d400
[49232.417990] x23: ffffffaa1948d840 x22: 0000000000000034
[49232.417992] x21: ffffffa91ff3e0a0 x20: 0000000000000000
[49232.417995] x19: ffffffa91ff3e000 x18: 00000000ffecfa44
[49232.417998] x17: 00000000000cfa44 x16: ffffffda6c1a54e8
[49232.418001] x15: 0000000000000000 x14: 0000000000000082
[49232.418004] x13: 0000000000000034 x12: 0000000000000004
[49232.418006] x11: ffffffda6c1a54e0 x10: 00000000ffffffff
[49232.418009] x9 : 115043787f31d900 x8 : 0000000000000000
[49232.418012] x7 : 0000000000000000 x6 : 7420676e69797254
[49232.418015] x5 : ffffffda6c2d5ace x4 : 0000000000000000
[49232.418018] x3 : 0000000000000000 x2 : ffffffffffffc9d0
[49232.418021] x1 : 0000000000000000 x0 : 0000000000000022
[49232.418023] Call trace:
[49232.418027] __free_irq+0x2fc/0x400
[49232.418030] free_irq+0x30/0x90
[49232.418034] suspend_bw_hwmon3+0x94/0x110
[49232.418038] devfreq_bw_hwmon_ev_handler+0x1b4/0x520
[49232.418043] devfreq_suspend_device+0x58/0xe0
[49232.418047] devfreq_suspend+0x54/0x90
[49232.418050] dpm_suspend+0x2c/0x340
[49232.418053] dpm_suspend_start+0x7c/0xa0
[49232.418056] suspend_devices_and_enter+0xe0/0x5c0
[49232.418058] pm_suspend+0x258/0x280
[49232.418062] state_store+0x100/0x150
[49232.418066] kobj_attr_store+0x14/0x30
[49232.418070] sysfs_kf_write+0x38/0x50
[49232.418074] kernfs_fop_write+0x168/0x290
[49232.418077] __vfs_write+0x34/0x190
[49232.418080] vfs_write+0x11c/0x2d0
[49232.418083] __arm64_sys_write+0x78/0x110
[49232.418085] el0_svc_common+0xb0/0x120
[49232.418087] do_el0_svc+0x18/0x20
[49232.418091] el0_sync_handler+0x148/0x190
[49232.418094] el0_sync+0x140/0x180
[49232.418095] ---[ end trace b44a82c335d29d62 ]---
[49232.418112] ------------[ cut here ]------------
[49232.418113] Trying to free already-free IRQ 51
[49232.418120] WARNING: CPU: 6 PID: 3656 at kernel/irq/manage.c:1765 __free_irq+0x2fc/0x400
[49232.418122] CPU: 6 PID: 3656 Comm: binder:502_7 Tainted: G        W         5.4.278-Scarlet-v1.0-beta8 #1
[49232.418124] Hardware name: redwood based Qualcomm Technologies, Inc. SM7325 (DT)
[49232.418126] pstate: 60000085 (nZCv daIf -PAN -UAO)
[49232.418130] pc : __free_irq+0x2fc/0x400
[49232.418133] lr : __free_irq+0x2f8/0x400
[49232.418135] sp : ffffffaa166669e0
[49232.418136] x29: ffffffaa166669e0 x28: ffffffa9ae80d400
[49232.418139] x27: 0000000000000000 x26: 0000000000000000
[49232.418142] x25: ffffffa91ff3de68 x24: ffffffa9ae80d400
[49232.418146] x23: ffffffaa1948d440 x22: 0000000000000033
[49232.418148] x21: ffffffa91ff3dea0 x20: 0000000000000000
[49232.418151] x19: ffffffa91ff3de00 x18: 00000000ffecf08c
[49232.418154] x17: 00000000000cf08c x16: ffffffda6c1a54e8
[49232.418156] x15: 0000000000000000 x14: 0000000000000082
[49232.418159] x13: 0000000000000034 x12: 0000000000000004
[49232.418162] x11: ffffffda6c1a54e0 x10: 00000000ffffffff
[49232.418165] x9 : 115043787f31d900 x8 : 0000000000000000
[49232.418168] x7 : 0000000000000000 x6 : 7420676e69797254
[49232.418171] x5 : ffffffda6c2d6486 x4 : 0000000000000000
[49232.418174] x3 : 0000000000000000 x2 : ffffffffffffc9a1
[49232.418176] x1 : 0000000000000000 x0 : 0000000000000022
[49232.418179] Call trace:
[49232.418182] __free_irq+0x2fc/0x400
[49232.418186] free_irq+0x30/0x90
[49232.418188] suspend_bw_hwmon2+0xb8/0x140
[49232.418192] devfreq_bw_hwmon_ev_handler+0x1b4/0x520
[49232.418197] devfreq_suspend_device+0x58/0xe0
[49232.418201] devfreq_suspend+0x54/0x90
[49232.418204] dpm_suspend+0x2c/0x340
[49232.418207] dpm_suspend_start+0x7c/0xa0
[49232.418209] suspend_devices_and_enter+0xe0/0x5c0
[49232.418212] pm_suspend+0x258/0x280
[49232.418216] state_store+0x100/0x150
[49232.418219] kobj_attr_store+0x14/0x30
[49232.418223] sysfs_kf_write+0x38/0x50
[49232.418227] kernfs_fop_write+0x168/0x290
[49232.418230] __vfs_write+0x34/0x190
[49232.418233] vfs_write+0x11c/0x2d0
[49232.418236] __arm64_sys_write+0x78/0x110
[49232.418238] el0_svc_common+0xb0/0x120
[49232.418240] do_el0_svc+0x18/0x20
[49232.418243] el0_sync_handler+0x148/0x190
[49232.418246] el0_sync+0x140/0x180
[49232.418247] ---[ end trace b44a82c335d29d63 ]---

There is no need to reallocate and free the IRQs during suspend and resume.
Replace IRQ thread creation with a simpler [enable|disable]_irq() approach
to fix the issue.

Co-authored-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: Ia12b8d24feddaef75792988ea55a6e8e29bf687a
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
2026-05-07 14:20:06 +00:00
..
event PM / devfreq: exynos-ppmu: Fix refcount leak in of_get_devfreq_events 2022-07-07 17:36:49 +02:00
arm-memlat-mon.c devfreq: memlat: Change number of array elements for holding core_stats 2022-12-27 04:12:36 -08:00
bimc-bwmon.c devfreq: bimc-bwmon: Don't free/reallocate IRQ during suspend/resume 2026-05-07 14:20:06 +00:00
devfreq-event.c
devfreq.c Merge android11-5.4.259+ (81334f2) into msm-5.4 2023-12-18 15:40:18 +05:30
devfreq_icc.c
devfreq_qcom_qoslat.c
devfreq_simple_dev.c
exynos-bus.c
governor.h
governor_bw_hwmon.c
governor_bw_hwmon.h
governor_cache_hwmon.c
governor_cache_hwmon.h
governor_cpufreq.c
governor_memlat.c
governor_memlat.h
governor_passive.c
governor_performance.c
governor_powersave.c
governor_simpleondemand.c
governor_userspace.c PM/devfreq: governor: Add a private governor_data for governor 2023-01-18 11:41:52 +01:00
Kconfig
Makefile
rk3399_dmc.c PM / devfreq: rk3399_dmc: Disable edev on remove() 2022-06-14 18:11:29 +02:00
tegra20-devfreq.c
tegra30-devfreq.c