You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/07/02 10:02:48 UTC
[incubator-nuttx] 01/04: sim: remove CONFIG_SIM_WALLTIME fast
timing maybe harmful for IOs
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 92cd7628e06f8037fc8acd1b0f4320c9ef2825b9
Author: ligd <li...@xiaomi.com>
AuthorDate: Wed Mar 31 22:11:59 2021 +0800
sim: remove CONFIG_SIM_WALLTIME fast timing maybe harmful for IOs
Change-Id: Ic4ff5ec0aa99d2d229a07c4d1a9a4dae738d3cd9
Signed-off-by: ligd <li...@xiaomi.com>
---
arch/sim/Kconfig | 18 +++---------------
arch/sim/src/Makefile | 3 ---
arch/sim/src/sim/up_simsmp.c | 8 --------
boards/sim/sim/sim/README.txt | 14 +-------------
4 files changed, 4 insertions(+), 39 deletions(-)
diff --git a/arch/sim/Kconfig b/arch/sim/Kconfig
index e0213cc..5222289 100644
--- a/arch/sim/Kconfig
+++ b/arch/sim/Kconfig
@@ -105,11 +105,6 @@ config SIM_X8664_MICROSOFT
endchoice
-config SIM_WALLTIME
- bool "Run the simulation at a fixed cadence in near real-time"
- default y
-
-if SIM_WALLTIME
choice
prompt "Simulation at a fixed cadence in near real-time"
default SIM_WALLTIME_SLEEP
@@ -117,12 +112,7 @@ choice
config SIM_WALLTIME_SLEEP
bool "Execution the simulation in near real-time using host sleep"
---help---
- NOTE: In order to facility fast testing, the sim target's IDLE loop, by default,
- calls the system timer "interrupt handler" as fast as possible. As a result, there
- really are no noticeable delays when a task sleeps. However, the task really does
- sleep -- but the time scale is wrong. If you want behavior that is closer to
- normal timing, then you can define SIM_WALLTIME=y in your configuration
- file. This configuration setting will cause the sim target's IDLE loop to delay
+ NOTE: This configuration setting will cause the sim target's IDLE loop to delay
on each call so that the system "timer interrupt" is called at a rate approximately
correct for the system timer tick rate. With this definition in the configuration,
sleep() behavior is more or less normal.
@@ -137,14 +127,12 @@ config SIM_WALLTIME_SIGNAL
endchoice
-endif
-
config SIM_NETDEV
bool "Simulated Network Device"
default y
select ARCH_HAVE_NETDEV_STATISTICS
select SCHED_LPWORK
- depends on (NET_ETHERNET && SIM_WALLTIME)
+ depends on NET_ETHERNET
---help---
Build in support for a simulated network device.
@@ -537,7 +525,7 @@ config SIM_QSPIFLASH_PAGESIZE
config SIM_HCISOCKET
bool "Attach Host Bluetooth"
default false
- depends on (WIRELESS_BLUETOOTH && HOST_LINUX && SIM_WALLTIME)
+ depends on (WIRELESS_BLUETOOTH && HOST_LINUX)
---help---
Attached the local bluetooth device to the simulation
target via HCI_CHANNEL_USER. This gives NuttX full
diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile
index 56e5741..bd669e8 100644
--- a/arch/sim/src/Makefile
+++ b/arch/sim/src/Makefile
@@ -98,9 +98,6 @@ 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)
-ifeq ($(CONFIG_SIM_WALLTIME),y)
- HOSTCFLAGS += -DCONFIG_SIM_WALLTIME=1
-endif
ifeq ($(CONFIG_SCHED_INSTRUMENTATION),y)
HOSTCFLAGS += -DCONFIG_SCHED_INSTRUMENTATION=1
endif
diff --git a/arch/sim/src/sim/up_simsmp.c b/arch/sim/src/sim/up_simsmp.c
index dcf8501..fd7305c 100644
--- a/arch/sim/src/sim/up_simsmp.c
+++ b/arch/sim/src/sim/up_simsmp.c
@@ -94,9 +94,7 @@ extern uint8_t g_nx_initstate;
static void *sim_idle_trampoline(void *arg)
{
struct sim_cpuinfo_s *cpuinfo = (struct sim_cpuinfo_s *)arg;
-#ifdef CONFIG_SIM_WALLTIME
uint64_t now = 0;
-#endif
int ret;
/* Set the CPU number for the CPU thread */
@@ -131,16 +129,10 @@ static void *sim_idle_trampoline(void *arg)
for (; ; )
{
-#ifdef CONFIG_SIM_WALLTIME
/* 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 */
-
- sched_yield();
-#endif
}
return NULL;
diff --git a/boards/sim/sim/sim/README.txt b/boards/sim/sim/sim/README.txt
index 51520cb..8cfca8e 100644
--- a/boards/sim/sim/sim/README.txt
+++ b/boards/sim/sim/sim/README.txt
@@ -49,13 +49,7 @@ application that I know of.
Timing Fidelity
---------------
-NOTE: In order to facility fast testing, the sim target's IDLE loop, by
-default, calls the system "interrupt handler" as fast as possible. As a
-result, there really are no noticeable delays when a task sleeps. However,
-the task really does sleep -- but the time scale is wrong. If you want
-behavior that is closer to normal timing, then you can define
-CONFIG_SIM_WALLTIME=y in your configuration file. This configuration setting
-will cause the sim target's IDLE loop to delay on each call so that the system
+NOTE: The sim target's IDLE loop to delay on each call so that the system
"timer interrupt" is called at a rate approximately correct for the system
timer tick rate. This option can be enabled with CONFIG_SIM_WALLTIME_SIGNAL
which will drive the entire simulation by using a host timer that ticks at
@@ -316,12 +310,6 @@ SMP
+CONFIG_SMP=y
+CONFIG_SMP_NCPUS=2
- You also must enable near-realtime-performance otherwise even long timeouts
- will expire before a CPU thread even has a chance to execute.
-
- -# CONFIG_SIM_WALLTIME is not set
- +CONFIG_SIM_WALLTIME=y
-
And you can enable some additional debug output with:
-# CONFIG_DEBUG_SCHED is not set