Skip to content

Commit

Permalink
pwm: fan: spinlock bad magic error
Browse files Browse the repository at this point in the history
Fix spinlock bad magic error on enablng debug macro.

 FAN rising trip_level:1 cur_temp:50000 trip_temps[2]:63000
 BUG: spinlock bad magic on CPU#0, kworker/u17:0/1591
  lock: 0xffffffc7d0c07c78, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
 CPU: 0 PID: 1591 Comm: kworker/u17:0 Not tainted 4.9.230-rt148-tegra #1
 Hardware name: Jetson-AGX (DT)
 Workqueue: thermal-fan-est therm_fan_est_work_func
 Call trace:
 [<ffffff800808b318>] dump_backtrace+0x0/0x198
 [<ffffff800808b8d4>] show_stack+0x24/0x30
 [<ffffff800844f69c>] dump_stack+0xa0/0xc4
 [<ffffff80081137d4>] spin_dump+0x84/0xb0
 [<ffffff80081138c4>] do_raw_spin_lock+0xc4/0x100
 [<ffffff8008f60068>] _raw_spin_lock_irqsave+0x38/0x48
 [<ffffff8008f5e744>] rt_mutex_slowlock.constprop.6+0x54/0xd0
 [<ffffff8008f5ea94>] rt_mutex_lock_state+0x5c/0x88
 [<ffffff8008f5eae4>] rt_mutex_lock+0x24/0x30
 [<ffffff8008f608d8>] _mutex_lock+0x20/0x30
 [<ffffff8008b767c4>] fan_update_target_pwm+0x54/0x248
 [<ffffff8008b76fd4>] pwm_fan_set_cur_state+0x174/0x198
 [<ffffff8008b624ec>] thermal_cdev_update+0xa4/0x200
 [<ffffff8008b6ae20>] pid_thermal_gov_throttle+0x2b0/0x3d0
 [<ffffff8008b641bc>] handle_thermal_trip+0x84/0x258
 [<ffffff8008b644cc>] thermal_zone_device_update+0x104/0x220
 [<ffffff80087cca74>] therm_fan_est_work_func+0x344/0x3b0
 [<ffffff80080d0d8c>] process_one_work+0x1cc/0x4b0
 [<ffffff80080d11d0>] worker_thread+0x160/0x510
 [<ffffff80080d79ac>] kthread+0xec/0xf0
 [<ffffff80080830a0>] ret_from_fork+0x10/0x30

Bug 3227296
Bug 200695596

Signed-off-by: Sumit Gupta <[email protected]>
Change-Id: I63d2b6316ccbe5b6843e90bcd377cc4cb16da24b
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2496144
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <[email protected]>
Reviewed-by: mobile promotions <[email protected]>
Reviewed-by: Bibek Basu <[email protected]>
Reviewed-by: svc-mobile-coverity <[email protected]>
  • Loading branch information
Sumit Gupta authored and mobile promotions committed Mar 16, 2021
1 parent f410efb commit 0c09aa1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/thermal/pwm_fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1532,6 +1532,9 @@ static int pwm_fan_probe(struct platform_device *pdev)
}

mutex_init(&fan_data->fan_state_lock);
mutex_init(&fan_data->pwm_set);
spin_lock_init(&fan_data->irq_lock);

fan_data->workqueue = alloc_workqueue(dev_name(&pdev->dev),
WQ_HIGHPRI | WQ_UNBOUND, 1);
if (!fan_data->workqueue) {
Expand Down Expand Up @@ -1595,7 +1598,6 @@ static int pwm_fan_probe(struct platform_device *pdev)
fan_data->rpm_diff_tolerance = (int)value;
dev_info(&pdev->dev,
"Using tachometer rpm feedback control");
mutex_init(&fan_data->pwm_set);
INIT_DELAYED_WORK(
&(fan_data->fan_ramp_rpm_work),
fan_ramping_rpm_work_func);
Expand Down Expand Up @@ -1671,7 +1673,6 @@ static int pwm_fan_probe(struct platform_device *pdev)
fan_data->fan_pwm_polarity ? "inversed" : "normal");
}

spin_lock_init(&fan_data->irq_lock);
atomic_set(&fan_data->tach_enabled, 0);
if (fan_data->tach_gpio != -1) {
/* init fan tach */
Expand Down

0 comments on commit 0c09aa1

Please sign in to comment.