Skip to content

Commit

Permalink
CHROMIUM: thermal: mediatek: Move pm_qos_request into mtk_thermal struct
Browse files Browse the repository at this point in the history
Since pm_qos_add_request() creates a work queue, the pm_qos_request
argument should be heap allocated. Otherwise, the following warning will
be logged when the CONFIG_DEBUG_OBJECTS config option is enabled:

[    3.456876] ODEBUG: object 0000000004de3844 is on stack 000000004553414d, but NOT annotated.
[    3.457101] ------------[ cut here ]------------
[    3.457142] WARNING: CPU: 2 PID: 1 at lib/debugobjects.c:368 __debug_object_init+0x374/0x4c8
[    3.457150] Modules linked in:
[    3.457162] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.19.139 torvalds#146
[    3.457169] Hardware name: Google Elm (DT)
[    3.457178] pstate: 60000085 (nZCv daIf -PAN -UAO)
[    3.457187] pc : __debug_object_init+0x374/0x4c8
[    3.457195] lr : __debug_object_init+0x374/0x4c8
[    3.457202] sp : ffffffc0daf2f770
[    3.457210] x29: ffffffc0daf2f780 x28: ffffff900a4b0000
[    3.457219] x27: ffffff900a4ae0c8 x26: dead000000000100
[    3.457228] x25: ffffff9009691000 x24: ffffffc0d1b4e7b0
[    3.457237] x23: 0000000000000000 x22: ffffff900a4ae0d0
[    3.457246] x21: 0000000000000000 x20: ffffffc0daf2f8b0
[    3.457254] x19: ffffff9009642d68 x18: 0000000000000000
[    3.457262] x17: ffffff9009649000 x16: 0000000000000000
[    3.457271] x15: ffffff90085412b8 x14: 0000000000000001
[    3.457279] x13: 0000000000000000 x12: 00000000000c0001
[    3.457287] x11: 0000000000000000 x10: 0000000000000000
[    3.457296] x9 : 0f00a3cfd965a500 x8 : 0f00a3cfd965a500
[    3.457304] x7 : ffffff900817190c x6 : 0000000000000000
[    3.457313] x5 : 0000000000000080 x4 : 0000000000000001
[    3.457321] x3 : ffffffc0daf2f474 x2 : 0000000000000002
[    3.457329] x1 : 0000000000000002 x0 : 0000000000000024
[    3.457338] Call trace:
[    3.457347]  __debug_object_init+0x374/0x4c8
[    3.457355]  debug_object_init+0x1c/0x24
[    3.457365]  __init_work+0x34/0x40
[    3.457373]  pm_qos_add_request+0x58/0x23c
[    3.457383]  mtk_svs_late_init+0x220/0x664
[    3.457391]  do_one_initcall+0x1d8/0x40c
[    3.457401]  do_initcall_level+0x1f0/0x244
[    3.457408]  do_basic_setup+0x64/0x7c
[    3.457416]  kernel_init_freeable+0x110/0x198
[    3.457425]  kernel_init+0x14/0x100
[    3.457433]  ret_from_fork+0x10/0x18

BUG=b:160960149
TEST=Boot elm with USE=debug, warning not seen in dmesg

Change-Id: Ice6cd351ead586ad3393d6be83b52be3a8b190da
Signed-off-by: Anand K Mistry <[email protected]>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2366252
Reviewed-by: Hsin-Yi Wang <[email protected]>
Commit-Queue: Anand K Mistry <[email protected]>
Tested-by: Anand K Mistry <[email protected]>
  • Loading branch information
akmistry authored and Commit Bot committed Aug 20, 2020
1 parent 0069ddd commit 10ae582
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/thermal/mtk_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ struct mtk_thermal {

const struct mtk_thermal_data *conf;
struct mtk_thermal_bank banks[MAX_NUM_ZONES];
struct pm_qos_request qos_request;
};

/* MT8183 thermal sensor data */
Expand Down Expand Up @@ -1526,7 +1527,6 @@ static int mtk_svs_hw_init(struct mtk_thermal *mt)
unsigned long timeout;
struct mtk_svs_bank *svs;
struct cpufreq_policy policy;
struct pm_qos_request qos_request = {{0}};
int i, j, ret, vboot_uV;

parent = clk_get_parent(mt->svs_mux);
Expand All @@ -1542,7 +1542,7 @@ static int mtk_svs_hw_init(struct mtk_thermal *mt)
* working at 1.0 volt. Add a pm_qos request to prevent CPUs from
* entering CPU off idle state.
*/
pm_qos_add_request(&qos_request, PM_QOS_CPU_DMA_LATENCY, 1);
pm_qos_add_request(&mt->qos_request, PM_QOS_CPU_DMA_LATENCY, 1);

for (i = 0; i < MT8173_NUM_SVS_BANKS; i++) {
svs = &svs_banks[i];
Expand All @@ -1551,7 +1551,7 @@ static int mtk_svs_hw_init(struct mtk_thermal *mt)
ret = cpufreq_get_policy(&policy, svs->cpu_dev_id);
if (ret) {
dev_err(svs->dev, "cpufreq is not ready.\n");
pm_qos_remove_request(&qos_request);
pm_qos_remove_request(&mt->qos_request);
clk_set_parent(mt->svs_mux, parent);
return ret;
}
Expand Down Expand Up @@ -1639,7 +1639,7 @@ static int mtk_svs_hw_init(struct mtk_thermal *mt)
schedule_work(&svs->work);
}

pm_qos_remove_request(&qos_request);
pm_qos_remove_request(&mt->qos_request);

ret = clk_set_parent(mt->svs_mux, parent);
if (ret) {
Expand Down

0 comments on commit 10ae582

Please sign in to comment.