mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
arch: sim: Workaround to make the IPI work on macOS
Summary: - I noticed that sim:smp does not work correctly on macOS due to the recent changes - Actually, it can not receive the IPI host signal, so if a new task is scheduled on CPU1/2/3, it hangs. - Finally, I found the issue depends on pthread stack settings and perhaps it might affect the host signal handling. - This commit fixes this issue by just reverting the pthread stack setting only for macOS. Impact: - sim:smp on macOS - Stack usage for CPU1/2/3 IDLE will be incorrect Testing: - Tested with ostest on macOS 11.4 (x86_64) Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
committed by
Alin Jerpelea
parent
a48513ad65
commit
b68fc9eb1d
@@ -212,7 +212,6 @@ int up_cpu_index(void)
|
|||||||
int sim_cpu_start(int cpu, void *stack, size_t size)
|
int sim_cpu_start(int cpu, void *stack, size_t size)
|
||||||
{
|
{
|
||||||
struct sim_cpuinfo_s cpuinfo;
|
struct sim_cpuinfo_s cpuinfo;
|
||||||
pthread_attr_t attr;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Initialize the CPU info */
|
/* Initialize the CPU info */
|
||||||
@@ -227,11 +226,19 @@ int sim_cpu_start(int cpu, void *stack, size_t size)
|
|||||||
* in a multi-CPU hardware model.
|
* in a multi-CPU hardware model.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
/* NOTE: workaround to make IPI work on macOS */
|
||||||
|
|
||||||
|
ret = pthread_create(&g_cpu_thread[cpu],
|
||||||
|
NULL, sim_idle_trampoline, &cpuinfo);
|
||||||
|
#else
|
||||||
|
pthread_attr_t attr;
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setstack(&attr, stack, size);
|
pthread_attr_setstack(&attr, stack, size);
|
||||||
ret = pthread_create(&g_cpu_thread[cpu],
|
ret = pthread_create(&g_cpu_thread[cpu],
|
||||||
&attr, sim_idle_trampoline, &cpuinfo);
|
&attr, sim_idle_trampoline, &cpuinfo);
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
|
#endif
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
goto errout_with_cond;
|
goto errout_with_cond;
|
||||||
|
|||||||
Reference in New Issue
Block a user