venus: fix multiple encoder crash
Subsystems (4)
PATCH v2 1/1 venus: fix multiple encoder crash
Currently we are considering the instances which are available in core->inst list for load calculation in min_loaded_core() function, but this is incorrect because by the time we call decide_core() for second instance, the third instance not filled yet codec_freq_data pointer.
Solve this by considering the instances whose session has started.
---
Changes in V2:
- As per Alex and Jeffrey comments, elaborated problem and addressed review comments.
drivers/media/platform/qcom/venus/pm_helpers.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/platform/qcom/venus/pm_helpers.c +4 -0
@@ -496,6 +496,10 @@ min_loaded_core(struct venus_inst *inst, u32 *min_coreid, u32 *min_load)list_for_each_entry (inst_pos, &core->instances, list) {if (inst_pos == inst)continue ; + +if (inst_pos->state !=INST_START ) +continue ; + vpp_freq = inst_pos->clk_data.codec_freq_data->vpp_freq; coreid = inst_pos->clk_data.core_id;
Signature · 1 line
2.7.4
Hi,
Quoted 9 lines · Mansur Alisha Shaik
Currently we are considering the instances which are available in
core->instlist for load calculation inmin_loaded_core()function, but this is incorrect because by the time we calldecide_core()for second instance, the third instance not filled yetcodec_freq_datapointer.Solve this by considering the instances whose session has started.
Quoted 8 lines
Signed-off-by Mansur Alisha Shaik <[email protected]>---
Changes in V2:
- As per Alex and Jeffrey comments, elaborated problem and addressed review comments.drivers/media/platform/qcom/venus/pm_helpers.c | 4 ++++ 1 file changed, 4 insertions(+)
This fixes the same crash I reported here:
https://lore.kernel.org/r/20200601150314.RFC.1.I1e40623bbe8fa43ff1415fc273cba66503b9b048@changeid
Thus:
I still have the same reservations I expressed in the patch I posed about whether this is truly safe from a locking point of view, but certainly it puts us in a better state than we are today.
-Doug