arch/sim: All cpu core need conform to CONFIG_SIM_WALLTIME behaviour
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
87dbd7d52d
commit
2a7029dd52
@ -94,6 +94,10 @@ ifeq ($(CONFIG_SMP),y)
|
||||
CSRCS += up_smpsignal.c up_cpuidlestack.c
|
||||
REQUIREDOBJS += up_smpsignal$(OBJEXT)
|
||||
HOSTCFLAGS += -DCONFIG_SMP=1 -DCONFIG_SMP_NCPUS=$(CONFIG_SMP_NCPUS)
|
||||
HOSTCFLAGS += -DCONFIG_USEC_PER_TICK=$(CONFIG_USEC_PER_TICK)
|
||||
ifeq ($(CONFIG_SIM_WALLTIME),y)
|
||||
HOSTCFLAGS += -DCONFIG_SIM_WALLTIME=1
|
||||
endif
|
||||
HOSTSRCS += up_simsmp.c
|
||||
STDLIBS += -lpthread
|
||||
endif
|
||||
|
@ -98,6 +98,7 @@ volatile spinlock_t g_cpu_paused[CONFIG_SMP_NCPUS];
|
||||
void nx_start(void);
|
||||
void up_cpu_started(void);
|
||||
int up_cpu_paused(int cpu);
|
||||
void host_sleepuntil(uint64_t nsec);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@ -162,9 +163,18 @@ static void *sim_idle_trampoline(void *arg)
|
||||
|
||||
for (; ; )
|
||||
{
|
||||
#ifdef CONFIG_SIM_WALLTIME
|
||||
uint64_t now = 0;
|
||||
|
||||
/* Wait a bit so that the timing is close to the correct rate. */
|
||||
|
||||
now += 1000 * CONFIG_USEC_PER_TICK;
|
||||
host_sleepuntil(now);
|
||||
#else
|
||||
/* Give other pthreads/CPUs a shot */
|
||||
|
||||
pthread_yield();
|
||||
#endif
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user