You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/04/19 13:51:28 UTC
[incubator-nuttx] branch master updated (87dbd7d -> 3d10f8c)
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.
from 87dbd7d TODO: Remove simulator SMP bug
new 2a7029d arch/sim: All cpu core need conform to CONFIG_SIM_WALLTIME behaviour
new 3d10f8c Fix nxstyle warning
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
arch/sim/src/Makefile | 4 ++++
arch/sim/src/sim/up_simsmp.c | 20 +++++++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
[incubator-nuttx] 02/02: Fix nxstyle warning
Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 3d10f8cf8fad52486d905f5511962570934c102a
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Apr 19 03:24:17 2020 +0800
Fix nxstyle warning
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
arch/sim/src/sim/up_simsmp.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/sim/src/sim/up_simsmp.c b/arch/sim/src/sim/up_simsmp.c
index a775ad1..187c557 100644
--- a/arch/sim/src/sim/up_simsmp.c
+++ b/arch/sim/src/sim/up_simsmp.c
@@ -47,6 +47,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
+
/* Must match definitions in arch/sim/include/spinlock.h */
#define SP_UNLOCKED 0 /* The Un-locked state */
@@ -55,6 +56,7 @@
/****************************************************************************
* Private Types
****************************************************************************/
+
/* Must match definitions in arch/sim/include/spinlock.h. Assuming that
* bool and unsigned char are equivalent.
*/
@@ -132,7 +134,8 @@ static void *sim_idle_trampoline(void *arg)
/* Set the CPU number zero for the CPU thread */
- ret = pthread_setspecific(g_cpukey, (const void *)((uintptr_t)cpuinfo->cpu));
+ ret = pthread_setspecific(g_cpukey,
+ (const void *)((uintptr_t)cpuinfo->cpu));
if (ret != 0)
{
return NULL;
@@ -154,7 +157,7 @@ static void *sim_idle_trampoline(void *arg)
pthread_mutex_unlock(&cpuinfo->mutex);
/* up_cpu_started() is logically a part of this function but needs to be
- * inserted in the path because in needs to access NuttX domain definitions.
+ * inserted in the path because in needs to access NuttX domain definition.
*/
up_cpu_started();
@@ -349,7 +352,8 @@ int up_cpu_start(int cpu)
* in a multi-CPU hardware model.
*/
- ret = pthread_create(&g_sim_cputhread[cpu], NULL, sim_idle_trampoline, &cpuinfo);
+ ret = pthread_create(&g_sim_cputhread[cpu],
+ NULL, sim_idle_trampoline, &cpuinfo);
if (ret != 0)
{
ret = -ret; /* REVISIT: That is a host errno value. */
[incubator-nuttx] 01/02: arch/sim: All cpu core need conform to
CONFIG_SIM_WALLTIME behaviour
Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 2a7029dd529d2390eecb44f2b17d71bb536655c4
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Apr 18 01:04:08 2020 +0800
arch/sim: All cpu core need conform to CONFIG_SIM_WALLTIME behaviour
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
arch/sim/src/Makefile | 4 ++++
arch/sim/src/sim/up_simsmp.c | 10 ++++++++++
2 files changed, 14 insertions(+)
diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile
index f9456ef..6f39c90 100644
--- a/arch/sim/src/Makefile
+++ b/arch/sim/src/Makefile
@@ -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
diff --git a/arch/sim/src/sim/up_simsmp.c b/arch/sim/src/sim/up_simsmp.c
index aa06126..a775ad1 100644
--- a/arch/sim/src/sim/up_simsmp.c
+++ b/arch/sim/src/sim/up_simsmp.c
@@ -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;