Skip to content

Commit 759c926

Browse files
lyakhkv2019i
authored andcommitted
dp: thread: only grant access to thread when userspace is used
Kernel threads have access to all the memory, no need to additionally grant access to them. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent dc53aaf commit 759c926

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

src/schedule/zephyr_dp_schedule.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ void scheduler_dp_unlock(unsigned int key)
6060

6161
void scheduler_dp_grant(k_tid_t thread_id, uint16_t core)
6262
{
63-
#if CONFIG_USERSPACE
6463
k_thread_access_grant(thread_id, &dp_lock[core]);
65-
#endif
6664
}
6765

6866
/* dummy LL task - to start LL on secondary cores */

src/schedule/zephyr_dp_schedule_thread.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,6 @@ int scheduler_dp_task_init(struct task **task,
269269
stack_size, dp_thread_fn, *task, NULL, NULL,
270270
CONFIG_DP_THREAD_PRIORITY, (*task)->flags, K_FOREVER);
271271

272-
k_thread_access_grant(pdata->thread_id, pdata->event);
273-
scheduler_dp_grant(pdata->thread_id, cpu_get_id());
274-
275272
/* pin the thread to specific core */
276273
ret = k_thread_cpu_pin(pdata->thread_id, core);
277274
if (ret < 0) {
@@ -280,6 +277,9 @@ int scheduler_dp_task_init(struct task **task,
280277
}
281278

282279
#ifdef CONFIG_USERSPACE
280+
k_thread_access_grant(pdata->thread_id, pdata->event);
281+
scheduler_dp_grant(pdata->thread_id, cpu_get_id());
282+
283283
if ((*task)->flags & K_USER) {
284284
ret = user_memory_init_shared(pdata->thread_id, pdata->mod);
285285
if (ret < 0) {

0 commit comments

Comments
 (0)