void mali_gp_scheduler_oom(struct mali_group *group, struct mali_gp_job *job) { _mali_uk_gp_job_suspended_s * jobres; _mali_osk_notification_t * notification; mali_gp_scheduler_lock(); notification = job->oom_notification; job->oom_notification = NULL; slot.returned_cookie = mali_gp_job_get_id(job); jobres = (_mali_uk_gp_job_suspended_s *)notification->result_buffer; jobres->user_job_ptr = mali_gp_job_get_user_id(job); jobres->cookie = mali_gp_job_get_id(job); mali_gp_scheduler_unlock(); jobres->reason = _MALIGP_JOB_SUSPENDED_OUT_OF_MEMORY; mali_session_send_notification(mali_gp_job_get_session(job), notification); /* * If this function failed, then we could return the job to user space right away, * but there is a job timer anyway that will do that eventually. * This is not exactly a common case anyway. */ }
static void mali_gp_scheduler_return_job_to_user(struct mali_gp_job *job, mali_bool success) { _mali_osk_notification_t *notobj = _mali_osk_notification_create(_MALI_NOTIFICATION_GP_FINISHED, sizeof(_mali_uk_gp_job_finished_s)); if (NULL != notobj) { _mali_uk_gp_job_finished_s *jobres = notobj->result_buffer; _mali_osk_memset(jobres, 0, sizeof(_mali_uk_gp_job_finished_s)); /* @@@@ can be removed once we initialize all members in this struct */ jobres->user_job_ptr = mali_gp_job_get_user_id(job); if (MALI_TRUE == success) { jobres->status = _MALI_UK_JOB_STATUS_END_SUCCESS; } else { jobres->status = _MALI_UK_JOB_STATUS_END_UNKNOWN_ERR; } jobres->heap_current_addr = mali_gp_job_get_current_heap_addr(job); jobres->perf_counter0 = mali_gp_job_get_perf_counter_value0(job); jobres->perf_counter1 = mali_gp_job_get_perf_counter_value1(job); mali_session_send_notification(mali_gp_job_get_session(job), notobj); } else { MALI_PRINT_ERROR(("Mali GP scheduler: Unable to allocate notification object\n")); } mali_gp_job_delete(job); }
void mali_gp_scheduler_oom(struct mali_group *group, struct mali_gp_job *job) { _mali_osk_notification_t *notobj; notobj = _mali_osk_notification_create(_MALI_NOTIFICATION_GP_STALLED, sizeof(_mali_uk_gp_job_suspended_s)); if (NULL != notobj) { _mali_uk_gp_job_suspended_s * jobres; mali_gp_scheduler_lock(); jobres = (_mali_uk_gp_job_suspended_s *)notobj->result_buffer; jobres->user_job_ptr = mali_gp_job_get_user_id(job); jobres->reason = _MALIGP_JOB_SUSPENDED_OUT_OF_MEMORY; jobres->cookie = mali_gp_job_get_id(job); slot.returned_cookie = jobres->cookie; mali_session_send_notification(mali_gp_job_get_session(job), notobj); mali_gp_scheduler_unlock(); } /* * If this function failed, then we could return the job to user space right away, * but there is a job timer anyway that will do that eventually. * This is not exactly a common case anyway. */ }
int mali_dump_memory_notify(_mali_uk_memory_usage_dumped_s __user *arg) { struct mali_session_data *session, *tmp; _mali_osk_notification_t * notification; mali_session_lock(); MALI_SESSION_FOREACH(session, tmp, link) { notification = _mali_osk_notification_create(_MALI_NOTIFCATION_MEMORY_USAGE_DUMP, sizeof(_mali_uk_memory_usage_dumped_s)); if (NULL == notification) { MALI_PRINT_ERROR( ("Failed to create notification object\n")); mali_session_unlock(); return -ENOMEM; } if (0 != copy_from_user(notification->result_buffer, arg, sizeof(_mali_uk_memory_usage_dumped_s))) { _mali_osk_notification_delete(notification); mali_session_unlock(); return -EFAULT; } mali_session_send_notification(session, notification); }
void mali_gp_scheduler_oom(struct mali_group *group, struct mali_gp_job *job) { _mali_osk_notification_t *notobj; notobj = _mali_osk_notification_create(_MALI_NOTIFICATION_GP_STALLED, sizeof(_mali_uk_gp_job_suspended_s)); if (NULL != notobj) { _mali_uk_gp_job_suspended_s * jobres; mali_gp_scheduler_lock(); jobres = (_mali_uk_gp_job_suspended_s *)notobj->result_buffer; jobres->user_job_ptr = mali_gp_job_get_user_id(job); jobres->reason = _MALIGP_JOB_SUSPENDED_OUT_OF_MEMORY; jobres->cookie = mali_gp_job_get_id(job); slot.returned_cookie = jobres->cookie; mali_session_send_notification(mali_gp_job_get_session(job), notobj); mali_gp_scheduler_unlock(); } }
static void mali_soft_job_send_activated_notification(struct mali_soft_job *job) { if (NULL != job->activated_notification) { _mali_uk_soft_job_activated_s *res = job->activated_notification->result_buffer; res->user_job = job->user_job; mali_session_send_notification(job->system->session, job->activated_notification); } job->activated_notification = NULL; }
static void mali_user_settings_notify(_mali_uk_user_setting_t setting, u32 value) { struct mali_session_data *session, *tmp; mali_session_lock(); MALI_SESSION_FOREACH(session, tmp, link) { _mali_osk_notification_t *notobj = _mali_osk_notification_create(_MALI_NOTIFICATION_SETTINGS_CHANGED, sizeof(_mali_uk_settings_changed_s)); _mali_uk_settings_changed_s *data = notobj->result_buffer; data->setting = setting; data->value = value; mali_session_send_notification(session, notobj); }
static void mali_pp_scheduler_return_job_to_user(struct mali_pp_job *job) { if (MALI_FALSE == mali_pp_job_use_no_notification(job)) { _mali_osk_notification_t *notobj = _mali_osk_notification_create(_MALI_NOTIFICATION_PP_FINISHED, sizeof(_mali_uk_pp_job_finished_s)); if (NULL != notobj) { u32 i; u32 sub_jobs = mali_pp_job_get_sub_job_count(job); mali_bool success = mali_pp_job_was_success(job); _mali_uk_pp_job_finished_s *jobres = notobj->result_buffer; _mali_osk_memset(jobres, 0, sizeof(_mali_uk_pp_job_finished_s)); /* @@@@ can be removed once we initialize all members in this struct */ jobres->user_job_ptr = mali_pp_job_get_user_id(job); if (MALI_TRUE == success) { jobres->status = _MALI_UK_JOB_STATUS_END_SUCCESS; } else { jobres->status = _MALI_UK_JOB_STATUS_END_UNKNOWN_ERR; } for (i = 0; i < sub_jobs; i++) { jobres->perf_counter0[i] = mali_pp_job_get_perf_counter_value0(job, i); jobres->perf_counter1[i] = mali_pp_job_get_perf_counter_value1(job, i); } mali_session_send_notification(mali_pp_job_get_session(job), notobj); } else { MALI_PRINT_ERROR(("Mali PP scheduler: Unable to allocate notification object\n")); } } mali_pp_job_delete(job); }
static void mali_gp_scheduler_return_job_to_user(struct mali_gp_job *job, mali_bool success) { _mali_uk_gp_job_finished_s *jobres = job->finished_notification->result_buffer; _mali_osk_memset(jobres, 0, sizeof(_mali_uk_gp_job_finished_s)); /* @@@@ can be removed once we initialize all members in this struct */ jobres->user_job_ptr = mali_gp_job_get_user_id(job); if (MALI_TRUE == success) { jobres->status = _MALI_UK_JOB_STATUS_END_SUCCESS; } else { jobres->status = _MALI_UK_JOB_STATUS_END_UNKNOWN_ERR; } jobres->heap_current_addr = mali_gp_job_get_current_heap_addr(job); jobres->perf_counter0 = mali_gp_job_get_perf_counter_value0(job); jobres->perf_counter1 = mali_gp_job_get_perf_counter_value1(job); mali_session_send_notification(mali_gp_job_get_session(job), job->finished_notification); job->finished_notification = NULL; mali_gp_job_delete(job); }
static void mali_user_settings_notify(_mali_uk_user_setting_t setting, u32 value) { mali_bool done = MALI_FALSE; /* * This function gets a bit complicated because we can't hold the session lock while * allocating notification objects. */ while (!done) { u32 i; u32 num_sessions_alloc; u32 num_sessions_with_lock; u32 used_notification_objects = 0; _mali_osk_notification_t **notobjs; /* Pre allocate the number of notifications objects we need right now (might change after lock has been taken) */ num_sessions_alloc = mali_session_get_count(); if (0 == num_sessions_alloc) { /* No sessions to report to */ return; } notobjs = (_mali_osk_notification_t **)_mali_osk_malloc(sizeof(_mali_osk_notification_t *) * num_sessions_alloc); if (NULL == notobjs) { MALI_PRINT_ERROR(("Failed to notify user space session about num PP core change (alloc failure)\n")); return; } for (i = 0; i < num_sessions_alloc; i++) { notobjs[i] = _mali_osk_notification_create(_MALI_NOTIFICATION_SETTINGS_CHANGED, sizeof(_mali_uk_settings_changed_s)); if (NULL != notobjs[i]) { _mali_uk_settings_changed_s *data; data = notobjs[i]->result_buffer; data->setting = setting; data->value = value; } else { MALI_PRINT_ERROR(("Failed to notify user space session about setting change (alloc failure %u)\n", i)); } } mali_session_lock(); /* number of sessions will not change while we hold the lock */ num_sessions_with_lock = mali_session_get_count(); if (num_sessions_alloc >= num_sessions_with_lock) { /* We have allocated enough notification objects for all the sessions atm */ struct mali_session_data *session, *tmp; MALI_SESSION_FOREACH(session, tmp, link) { MALI_DEBUG_ASSERT(used_notification_objects < num_sessions_alloc); if (NULL != notobjs[used_notification_objects]) { mali_session_send_notification(session, notobjs[used_notification_objects]); notobjs[used_notification_objects] = NULL; /* Don't track this notification object any more */ } used_notification_objects++; } done = MALI_TRUE; } mali_session_unlock(); /* Delete any remaining/unused notification objects */ for (; used_notification_objects < num_sessions_alloc; used_notification_objects++) { if (NULL != notobjs[used_notification_objects]) { _mali_osk_notification_delete(notobjs[used_notification_objects]); } } _mali_osk_free(notobjs); }