kernel/thread: Don't clobber arch initialization of switch_handle

The recent synchronization work required that the kernel guarantee
switch_handle is non-null, but it did it in a way that works for ARC
and x86_64 but would clobber the work xtensa had already done to
populate that field.

There's no point: just make this an assert, as it's always been the
arch layer's job.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2020-02-18 12:23:53 -08:00 committed by Anas Nashif
commit a2f6826f9c

View file

@ -517,9 +517,13 @@ void z_setup_new_thread(struct k_thread *new_thread,
arch_new_thread(new_thread, stack, stack_size, entry, p1, p2, p3,
prio, options);
#ifdef CONFIG_SMP
/* switch handle must be non-null except when inside z_swap() */
new_thread->switch_handle = new_thread;
#ifdef CONFIG_USE_SWITCH
/* switch_handle must be non-null except when inside z_swap()
* for synchronization reasons. Historically some notional
* USE_SWITCH architectures have actually ignored the field
*/
__ASSERT(new_thread->switch_handle != NULL,
"arch layer failed to initialize switch_handle");
#endif
#ifdef CONFIG_THREAD_USERSPACE_LOCAL_DATA