mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
gk20a_scale_target is called through the target member of a devfreq_profile. It is only called from devfreqs update_devfreq function or through governor_passive. governor_passive is not used for nvgpu. Since update_devfreq already enforce the devfreq limits, gka20_scale_target can be simplified by only checking pm_qos limits and also only if GK20A_PM_QOS is enabled. This also resolves a race between creating devfreq sysfs files and setting 'l->devfreq' in gk20a_scale_init that can lead to accessing a NULL pointer by writing to the sysfs files. Example: Unable to handle kernel NULL pointer dereference at virtual address 00000430 <snip> Call trace: [<000000006aa50d89>] gk20a_scale_target+0x5c/0x120 [nvgpu] [<00000000e5a63f7c>] update_devfreq+0xec/0x22c [<0000000014a13c8a>] max_freq_store+0xa8/0xfc [<0000000072139393>] dev_attr_store+0x48/0x60 [<000000008ec280df>] sysfs_kf_write+0x60/0x70 [<0000000038427ed5>] kernfs_fop_write+0xc4/0x1e0 [<00000000c0b74aa9>] __vfs_write+0x60/0x14c [<0000000078fcebb4>] vfs_write+0xb0/0x1b4 [<000000007720da30>] SyS_write+0x74/0xf0 [<0000000067443e2c>] __sys_trace_return+0x0/0x4 Bug 3910155 Change-Id: I7193cc5ea85454acf0890b3ca8d1c3526ca8517e Signed-off-by: Ken Chang <kenc@nvidia.com> Signed-off-by: Sagar Kamble <skamble@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2828219 Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
10 KiB
10 KiB