From f30d131bd979e29b68fb7d9ff515c61a246201f4 Mon Sep 17 00:00:00 2001
From: Lukas Larsson
Date: Tue, 21 Mar 2017 13:40:08 +0100
Subject: erts: Deprecate the non-smp emulators
---
erts/Makefile | 145 +++++++++++++++++++++++++++++++
erts/Makefile.in | 147 --------------------------------
erts/configure.in | 74 +++++++++++++++-
erts/doc/src/erl.xml | 8 +-
erts/emulator/Makefile.in | 35 ++++----
erts/emulator/test/smoke_test_SUITE.erl | 7 --
erts/etc/common/erlexec.c | 42 ++++-----
7 files changed, 261 insertions(+), 197 deletions(-)
create mode 100644 erts/Makefile
delete mode 100644 erts/Makefile.in
(limited to 'erts')
diff --git a/erts/Makefile b/erts/Makefile
new file mode 100644
index 0000000000..3fe567b7d5
--- /dev/null
+++ b/erts/Makefile
@@ -0,0 +1,145 @@
+#
+# %CopyrightBegin%
+#
+# Copyright Ericsson AB 2006-2016. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# %CopyrightEnd%
+#
+
+.NOTPARALLEL:
+
+include $(ERL_TOP)/make/target.mk
+include vsn.mk
+include $(ERL_TOP)/make/$(TARGET)/otp.mk
+
+# ----------------------------------------------------------------------
+
+# Other erts dirs than the emulator dir...
+ERTSDIRS = etc epmd lib_src
+XINSTDIRS = preloaded
+ifeq ($(NO_START_SCRIPTS),)
+ERTSDIRS += start_scripts
+endif
+
+.PHONY: all
+all: $(FLAVORS)
+
+.PHONY: docs
+docs:
+ $(V_at)( cd doc/src && $(MAKE) $@ )
+
+.PHONY: debug opt clean
+debug opt clean:
+ $(V_at)for d in emulator $(ERTSDIRS); do \
+ if test -d $$d; then \
+ ( cd $$d && $(MAKE) $@ FLAVOR=$(FLAVOR) ) || exit $$? ; \
+ fi ; \
+ done
+ (cd preloaded/src && $(MAKE) ../ebin/erts.app)
+
+# ----------------------------------------------------------------------
+# These are "convenience targets", provided as shortcuts for developers
+# - don't use them in scripts or assume they will always stay like this!
+#
+
+.PHONY: $(FLAVORS)
+$(FLAVORS):
+ $(V_at)( $(MAKE) opt FLAVOR=$@ )
+
+# Make erl script and erlc in $(ERL_TOP)/bin which runs the compiled version
+# Note that erlc is not a script and requires extra handling on cygwin.
+# also note that this file is not created by autoconf, that's why @EXEEXT@
+# is not used.
+
+# The copying of beam.dll should be removed when the beam dll need no longer be
+# in the same directory...
+.PHONY: local_setup
+local_setup:
+ @cd start_scripts && $(MAKE)
+ $(V_colon)@echo `ls $(ERL_TOP)/bin/`
+ @rm -f $(ERL_TOP)/bin/erl $(ERL_TOP)/bin/erlc $(ERL_TOP)/bin/cerl \
+ $(ERL_TOP)/bin/erl.exe $(ERL_TOP)/bin/erlc.exe \
+ $(ERL_TOP)/bin/escript $(ERL_TOP)/bin/escript.exe \
+ $(ERL_TOP)/bin/dialyzer $(ERL_TOP)/bin/dialyzer.exe \
+ $(ERL_TOP)/bin/typer $(ERL_TOP)/bin/typer.exe \
+ $(ERL_TOP)/bin/ct_run $(ERL_TOP)/bin/ct_run.exe \
+ $(ERL_TOP)/bin/start*.boot $(ERL_TOP)/bin/start*.script
+ @if [ "X$(TARGET)" = "Xwin32" ]; then \
+ cp $(ERL_TOP)/bin/$(TARGET)/dialyzer.exe $(ERL_TOP)/bin/dialyzer.exe; \
+ cp $(ERL_TOP)/bin/$(TARGET)/typer.exe $(ERL_TOP)/bin/typer.exe; \
+ cp $(ERL_TOP)/bin/$(TARGET)/ct_run.exe $(ERL_TOP)/bin/ct_run.exe; \
+ cp $(ERL_TOP)/bin/$(TARGET)/erlc.exe $(ERL_TOP)/bin/erlc.exe; \
+ cp $(ERL_TOP)/bin/$(TARGET)/erl.exe $(ERL_TOP)/bin/erl.exe; \
+ cp $(ERL_TOP)/bin/$(TARGET)/werl.exe $(ERL_TOP)/bin/werl.exe; \
+ cp $(ERL_TOP)/bin/$(TARGET)/escript.exe $(ERL_TOP)/bin/escript.exe; \
+ chmod 755 $(ERL_TOP)/bin/erl.exe $(ERL_TOP)/bin/erlc.exe \
+ $(ERL_TOP)/bin/werl.exe; \
+ make_local_ini.sh $(ERL_TOP); \
+ cp $(ERL_TOP)/bin/erl.ini $(ERL_TOP)/bin/$(TARGET)/erl.ini; \
+ else \
+ sed -e "s;%FINAL_ROOTDIR%;$(ERL_TOP);" \
+ -e "s;erts-.*/bin;bin/$(TARGET);" \
+ -e "s;EMU=.*;EMU=beam$(TYPEMARKER);" \
+ $(ERL_TOP)/erts/etc/unix/erl.src.src > $(ERL_TOP)/bin/erl; \
+ sed -e "s;%SRC_ROOTDIR%;$(ERL_TOP);" \
+ -e "s;%TARGET%;$(TARGET);" \
+ -e "s;%VSN%;$(VSN);" \
+ $(ERL_TOP)/erts/etc/unix/cerl.src > $(ERL_TOP)/bin/cerl; \
+ cp $(ERL_TOP)/bin/$(TARGET)/dialyzer $(ERL_TOP)/bin/dialyzer; \
+ cp $(ERL_TOP)/bin/$(TARGET)/typer $(ERL_TOP)/bin/typer; \
+ cp $(ERL_TOP)/bin/$(TARGET)/ct_run $(ERL_TOP)/bin/ct_run; \
+ cp $(ERL_TOP)/bin/$(TARGET)/erlc $(ERL_TOP)/bin/erlc; \
+ cp $(ERL_TOP)/bin/$(TARGET)/escript $(ERL_TOP)/bin/escript; \
+ chmod 755 $(ERL_TOP)/bin/erl $(ERL_TOP)/bin/erlc \
+ $(ERL_TOP)/bin/cerl; \
+ fi
+ @cd start_scripts && $(MAKE) $(ERL_TOP)/bin/start.script \
+ $(ERL_TOP)/bin/start_sasl.script \
+ $(ERL_TOP)/bin/start_clean.script \
+ $(ERL_TOP)/bin/no_dot_erlang.script
+
+# Run the configure script
+.PHONY: configure
+configure:
+ @set -e ; cd autoconf && $(MAKE)
+
+# Remake the makefiles, if you already have configured but you have edited
+# a "Makefile.in".
+.PHONY: makefiles
+makefiles:
+ @set -e ; cd autoconf && $(MAKE) $@
+
+# ----------------------------------------------------------------------
+# Release targets
+#
+
+.PHONY: release
+release:
+ $(V_at)for f in $(FLAVORS); do \
+ ( cd emulator && $(MAKE) release FLAVOR=$$f ) \
+ done
+ $(V_at)for d in $(ERTSDIRS) $(XINSTDIRS); do \
+ if test -d $$d; then \
+ ( cd $$d && $(MAKE) $@ ) || exit $$? ; \
+ fi ; \
+ done
+ ( $(MAKE) -f "$(ERL_TOP)/make/otp_released_app.mk" \
+ APP_PWD="$(ERL_TOP)/erts" APP_VSN=VSN APP=erts \
+ TESTROOT="$(TESTROOT)" update) \
+ || exit $$?
+
+.PHONY: release_docs
+release_docs:
+ $(V_at)( cd doc/src && $(MAKE) $@ )
diff --git a/erts/Makefile.in b/erts/Makefile.in
deleted file mode 100644
index 3052dc3065..0000000000
--- a/erts/Makefile.in
+++ /dev/null
@@ -1,147 +0,0 @@
-#
-# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2006-2016. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# %CopyrightEnd%
-#
-
-.NOTPARALLEL:
-
-include $(ERL_TOP)/make/output.mk
-include $(ERL_TOP)/make/target.mk
-include vsn.mk
-
-# ----------------------------------------------------------------------
-
-# Other erts dirs than the emulator dir...
-ERTSDIRS = etc epmd lib_src
-XINSTDIRS = preloaded
-ifeq ($(NO_START_SCRIPTS),)
-ERTSDIRS += start_scripts
-endif
-
-EXTRA_FLAVORS=smp
-
-.PHONY: all
-all: smp opt
-
-.PHONY: docs
-docs:
- $(V_at)( cd doc/src && $(MAKE) $@ )
-
-.PHONY: debug opt clean
-debug opt clean:
- $(V_at)for d in emulator $(ERTSDIRS); do \
- if test -d $$d; then \
- ( cd $$d && $(MAKE) $@ FLAVOR=$(FLAVOR) ) || exit $$? ; \
- fi ; \
- done
- (cd preloaded/src && $(MAKE) ../ebin/erts.app)
-
-# ----------------------------------------------------------------------
-# These are "convenience targets", provided as shortcuts for developers
-# - don't use them in scripts or assume they will always stay like this!
-#
-
-.PHONY: $(EXTRA_FLAVORS)
-$(EXTRA_FLAVORS):
- $(V_at)( cd emulator && $(MAKE) opt FLAVOR=$@ )
-
-# Make erl script and erlc in $(ERL_TOP)/bin which runs the compiled version
-# Note that erlc is not a script and requires extra handling on cygwin.
-# also note that this file is not created by autoconf, that's why @EXEEXT@
-# is not used.
-
-# The copying of beam.dll should be removed when the beam dll need no longer be
-# in the same directory...
-.PHONY: local_setup
-local_setup:
- @cd start_scripts && $(MAKE)
- $(V_colon)@echo `ls $(ERL_TOP)/bin/`
- @rm -f $(ERL_TOP)/bin/erl $(ERL_TOP)/bin/erlc $(ERL_TOP)/bin/cerl \
- $(ERL_TOP)/bin/erl.exe $(ERL_TOP)/bin/erlc.exe \
- $(ERL_TOP)/bin/escript $(ERL_TOP)/bin/escript.exe \
- $(ERL_TOP)/bin/dialyzer $(ERL_TOP)/bin/dialyzer.exe \
- $(ERL_TOP)/bin/typer $(ERL_TOP)/bin/typer.exe \
- $(ERL_TOP)/bin/ct_run $(ERL_TOP)/bin/ct_run.exe \
- $(ERL_TOP)/bin/start*.boot $(ERL_TOP)/bin/start*.script
- @if [ "X$(TARGET)" = "Xwin32" ]; then \
- cp $(ERL_TOP)/bin/$(TARGET)/dialyzer.exe $(ERL_TOP)/bin/dialyzer.exe; \
- cp $(ERL_TOP)/bin/$(TARGET)/typer.exe $(ERL_TOP)/bin/typer.exe; \
- cp $(ERL_TOP)/bin/$(TARGET)/ct_run.exe $(ERL_TOP)/bin/ct_run.exe; \
- cp $(ERL_TOP)/bin/$(TARGET)/erlc.exe $(ERL_TOP)/bin/erlc.exe; \
- cp $(ERL_TOP)/bin/$(TARGET)/erl.exe $(ERL_TOP)/bin/erl.exe; \
- cp $(ERL_TOP)/bin/$(TARGET)/werl.exe $(ERL_TOP)/bin/werl.exe; \
- cp $(ERL_TOP)/bin/$(TARGET)/escript.exe $(ERL_TOP)/bin/escript.exe; \
- chmod 755 $(ERL_TOP)/bin/erl.exe $(ERL_TOP)/bin/erlc.exe \
- $(ERL_TOP)/bin/werl.exe; \
- make_local_ini.sh $(ERL_TOP); \
- cp $(ERL_TOP)/bin/erl.ini $(ERL_TOP)/bin/$(TARGET)/erl.ini; \
- else \
- sed -e "s;%FINAL_ROOTDIR%;$(ERL_TOP);" \
- -e "s;erts-.*/bin;bin/$(TARGET);" \
- -e "s;EMU=.*;EMU=beam$(TYPEMARKER);" \
- $(ERL_TOP)/erts/etc/unix/erl.src.src > $(ERL_TOP)/bin/erl; \
- sed -e "s;%SRC_ROOTDIR%;$(ERL_TOP);" \
- -e "s;%TARGET%;$(TARGET);" \
- -e "s;%VSN%;$(VSN);" \
- $(ERL_TOP)/erts/etc/unix/cerl.src > $(ERL_TOP)/bin/cerl; \
- cp $(ERL_TOP)/bin/$(TARGET)/dialyzer $(ERL_TOP)/bin/dialyzer; \
- cp $(ERL_TOP)/bin/$(TARGET)/typer $(ERL_TOP)/bin/typer; \
- cp $(ERL_TOP)/bin/$(TARGET)/ct_run $(ERL_TOP)/bin/ct_run; \
- cp $(ERL_TOP)/bin/$(TARGET)/erlc $(ERL_TOP)/bin/erlc; \
- cp $(ERL_TOP)/bin/$(TARGET)/escript $(ERL_TOP)/bin/escript; \
- chmod 755 $(ERL_TOP)/bin/erl $(ERL_TOP)/bin/erlc \
- $(ERL_TOP)/bin/cerl; \
- fi
- @cd start_scripts && $(MAKE) $(ERL_TOP)/bin/start.script \
- $(ERL_TOP)/bin/start_sasl.script \
- $(ERL_TOP)/bin/start_clean.script \
- $(ERL_TOP)/bin/no_dot_erlang.script
-
-# Run the configure script
-.PHONY: configure
-configure:
- @set -e ; cd autoconf && $(MAKE)
-
-# Remake the makefiles, if you already have configured but you have edited
-# a "Makefile.in".
-.PHONY: makefiles
-makefiles:
- @set -e ; cd autoconf && $(MAKE) $@
-
-# ----------------------------------------------------------------------
-# Release targets
-#
-
-.PHONY: release
-release:
- $(V_at)for f in plain $(EXTRA_FLAVORS) ; do \
- ( cd emulator && $(MAKE) release FLAVOR=$$f ) \
- done
- $(V_at)for d in $(ERTSDIRS) $(XINSTDIRS); do \
- if test -d $$d; then \
- ( cd $$d && $(MAKE) $@ ) || exit $$? ; \
- fi ; \
- done
- ( $(MAKE) -f "$(ERL_TOP)/make/otp_released_app.mk" \
- APP_PWD="$(ERL_TOP)/erts" APP_VSN=VSN APP=erts \
- TESTROOT="$(TESTROOT)" update) \
- || exit $$?
-
-.PHONY: release_docs
-release_docs:
- $(V_at)( cd doc/src && $(MAKE) $@ )
diff --git a/erts/configure.in b/erts/configure.in
index b488ba9171..9ab5b4cfd2 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -154,6 +154,14 @@ AS_HELP_STRING([--disable-smp-support], [disable smp support]),
*) enable_smp_support=yes ;;
esac ], enable_smp_support=unknown)
+AC_ARG_ENABLE(plain-emulator,
+AS_HELP_STRING([--enable-plain-emulator], [enable plain emulator])
+AS_HELP_STRING([--disable-plain-emulator], [disable plain emulator]),
+[ case "$enableval" in
+ no) enable_plain_emulator=no ;;
+ *) enable_plain_emulator=yes ;;
+ esac ], enable_plain_emulator=unknown)
+
AC_ARG_ENABLE(smp-require-native-atomics,
AS_HELP_STRING([--disable-smp-require-native-atomics],
[disable the SMP requirement of a native atomic implementation]),
@@ -993,7 +1001,7 @@ else
found_threads=yes
fi
-
+FLAVORS=
ERTS_BUILD_SMP_EMU=$enable_smp_support
AC_MSG_CHECKING(whether an emulator with smp support should be built)
case $ERTS_BUILD_SMP_EMU in
@@ -1078,6 +1086,9 @@ EOF
if test $ERTS_BUILD_SMP_EMU = yes; then
+ DEFAULT_FLAVOR=smp
+ FLAVORS="$FLAVORS smp"
+
if test $found_threads = no; then
AC_MSG_ERROR([cannot build smp enabled emulator since no thread library was found])
fi
@@ -1153,6 +1164,66 @@ fi
AC_SUBST(ERTS_BUILD_SMP_EMU)
+ERTS_BUILD_PLAIN_EMU=$enable_plain_emulator
+AC_MSG_CHECKING(whether an emulator without smp support should be built)
+case $ERTS_BUILD_PLAIN_EMU in
+ yes)
+ AC_MSG_RESULT(yes; enabled by user)
+ ;;
+ no)
+ AC_MSG_RESULT(no; disabled by user)
+ ;;
+ unknown)
+ case "$enable_threads-$ERTS_BUILD_SMP_EMU" in
+ no-*)
+ ERTS_BUILD_PLAIN_EMU=yes
+ AC_MSG_RESULT(yes)
+ ;;
+ *-no)
+ ERTS_BUILD_PLAIN_EMU=yes
+ AC_MSG_RESULT(yes; enabled as smp emulator was disabled)
+ ;;
+ *)
+ ERTS_BUILD_PLAIN_EMU=no
+ AC_MSG_RESULT(no)
+ ;;
+ esac
+ ;;
+esac
+
+case $ERTS_BUILD_PLAIN_EMU in
+ yes)
+ AC_DEFINE(ERTS_HAVE_PLAIN_EMU, 1, [Define if the non-smp emulator is built])
+ FLAVORS="$FLAVORS plain"
+ test -f "$ERL_TOP/erts/CONF_INFO" || echo "" > "$ERL_TOP/erts/CONF_INFO"
+ cat >> $ERL_TOP/erts/CONF_INFO <-smp auto starts
the Erlang runtime system with SMP support enabled if it is
available and more than one logical processor is detected.
- -smp disable starts a runtime system without SMP support.
+ -smp disable starts a runtime system without SMP support.
+ The runtime system without SMP support is deprecated and will
+ be removed in a future major release.
- The runtime system with SMP support is not available on all
- supported platforms. See also flag
- +S.
+ See also flag+S.
(emulator flag)
diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in
index 7ea0111e59..227aabcf1e 100644
--- a/erts/emulator/Makefile.in
+++ b/erts/emulator/Makefile.in
@@ -175,7 +175,23 @@ endif
# NOTE: When adding a new type update ERL_BUILD_TYPE_MARKER in sys/unix/sys.c
#
-ifeq ($(FLAVOR),smp)
+FLAVOR=$(DEFAULT_FLAVOR)
+
+ifeq ($(FLAVOR),plain)
+
+DS_SUPPORT=no
+DS_TEST=no
+
+FLAVOR_MARKER=
+FLAVOR_FLAGS=
+ENABLE_ALLOC_TYPE_VARS += nofrag
+M4FLAGS +=
+
+else # FLAVOR
+
+# If flavor isn't one of the above, it *is* smp flavor...
+override FLAVOR=smp
+
FLAVOR_MARKER=.smp
FLAVOR_FLAGS=-DERTS_SMP
ENABLE_ALLOC_TYPE_VARS += smp nofrag
@@ -196,30 +212,15 @@ DS_SUPPORT=no
DS_TEST=no
endif # DIRTY_SCHEDULER_SUPPORT
-else # FLAVOR
-
-DS_SUPPORT=no
-DS_TEST=no
-
-# If flavor isn't one of the above, it *is* plain flavor...
-override FLAVOR=plain
-FLAVOR_MARKER=
-FLAVOR_FLAGS=
-ENABLE_ALLOC_TYPE_VARS += nofrag
-M4FLAGS +=
-endif
+endif # FLAVOR
TF_MARKER=$(TYPEMARKER)$(FLAVOR_MARKER)
-ifeq ($(FLAVOR)-@ERTS_BUILD_SMP_EMU@,smp-no)
-VOID_EMULATOR = '*** SMP emulator disabled by configure'
-else
ifeq ($(TYPE)-@HAVE_VALGRIND@,valgrind-no)
VOID_EMULATOR = '*** valgrind emulator disabled by configure'
else
VOID_EMULATOR =
endif
-endif
OPSYS=@OPSYS@
sol2CFLAGS=
diff --git a/erts/emulator/test/smoke_test_SUITE.erl b/erts/emulator/test/smoke_test_SUITE.erl
index 5eccdc562b..45b28b28a5 100644
--- a/erts/emulator/test/smoke_test_SUITE.erl
+++ b/erts/emulator/test/smoke_test_SUITE.erl
@@ -66,17 +66,10 @@ boot_combo(Config) when is_list(Config) ->
ok
end
end,
- SMPDisable = fun () -> false = erlang:system_info(smp_support) end,
try
chk_boot(Config, "+Ktrue", NOOP),
chk_boot(Config, "+A42", A42),
- chk_boot(Config, "-smp disable", SMPDisable),
chk_boot(Config, "+Ktrue +A42", A42),
- chk_boot(Config, "-smp disable +A42",
- fun () -> SMPDisable(), A42() end),
- chk_boot(Config, "-smp disable +Ktrue", SMPDisable),
- chk_boot(Config, "-smp disable +Ktrue +A42",
- fun () -> SMPDisable(), A42() end),
%% A lot more combos could be implemented...
ok
after
diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c
index ee59759940..b29190e4d9 100644
--- a/erts/etc/common/erlexec.c
+++ b/erts/etc/common/erlexec.c
@@ -203,8 +203,8 @@ void error(char* format, ...);
* Local functions.
*/
-#if !defined(ERTS_HAVE_SMP_EMU)
-static void usage_notsup(const char *switchname);
+#if !defined(ERTS_HAVE_SMP_EMU) || !defined(ERTS_HAVE_PLAIN_EMU)
+static void usage_notsup(const char *switchname, const char *alt);
#endif
static char **build_args_from_env(char *env_var);
static char **build_args_from_string(char *env_var);
@@ -487,8 +487,7 @@ int main(int argc, char **argv)
cpuinfo = erts_cpu_info_create();
/* '-smp auto' is default */
#ifdef ERTS_HAVE_SMP_EMU
- if (erts_get_cpu_configured(cpuinfo) > 1)
- emu_type |= EMU_TYPE_SMP;
+ emu_type |= EMU_TYPE_SMP;
#endif
#if defined(__WIN32__) && defined(WIN32_ALWAYS_DEBUG)
@@ -520,12 +519,11 @@ int main(int argc, char **argv)
i++;
smp_auto:
emu_type_passed |= EMU_TYPE_SMP;
-#ifdef ERTS_HAVE_SMP_EMU
- if (erts_get_cpu_configured(cpuinfo) > 1)
- emu_type |= EMU_TYPE_SMP;
- else
+#if defined(ERTS_HAVE_PLAIN_EMU) && !defined(ERTS_HAVE_SMP_EMU)
+ emu_type &= ~EMU_TYPE_SMP;
+#else
+ emu_type |= EMU_TYPE_SMP;
#endif
- emu_type &= ~EMU_TYPE_SMP;
}
else if (strcmp(argv[i+1], "enable") == 0) {
i++;
@@ -534,14 +532,18 @@ int main(int argc, char **argv)
#ifdef ERTS_HAVE_SMP_EMU
emu_type |= EMU_TYPE_SMP;
#else
- usage_notsup("-smp enable");
+ usage_notsup("-smp enable", "");
#endif
}
else if (strcmp(argv[i+1], "disable") == 0) {
i++;
smp_disable:
- emu_type_passed |= EMU_TYPE_SMP;
+ emu_type_passed &= ~EMU_TYPE_SMP;
+#ifdef ERTS_HAVE_PLAIN_EMU
emu_type &= ~EMU_TYPE_SMP;
+#else
+ usage_notsup("-smp disable", " Use \"+S 1\" instead.");
+#endif
}
else {
smp:
@@ -550,7 +552,7 @@ int main(int argc, char **argv)
#ifdef ERTS_HAVE_SMP_EMU
emu_type |= EMU_TYPE_SMP;
#else
- usage_notsup("-smp");
+ usage_notsup("-smp", "");
#endif
}
} else if (strcmp(argv[i], "-smpenable") == 0) {
@@ -1183,14 +1185,14 @@ usage_aux(void)
#ifdef __WIN32__
"[-start_erl [datafile]] "
#endif
- "[-smp "
+ "[-smp [auto"
#ifdef ERTS_HAVE_SMP_EMU
- "[enable|"
+ "|enable"
#endif
- "auto|disable"
-#ifdef ERTS_HAVE_SMP_EMU
- "]"
+#ifdef ERTS_HAVE_PLAIN_EMU
+ "|disable"
#endif
+ "]"
"] "
"[-make] [-man [manopts] MANPAGE] [-x] [-emu_args] [-start_epmd BOOLEAN] "
"[-args_file FILENAME] [+A THREADS] [+a SIZE] [+B[c|d|i]] [+c [BOOLEAN]] "
@@ -1212,11 +1214,11 @@ usage(const char *switchname)
usage_aux();
}
-#if !defined(ERTS_HAVE_SMP_EMU)
+#if !defined(ERTS_HAVE_SMP_EMU) || !defined(ERTS_HAVE_PLAIN_EMU)
static void
-usage_notsup(const char *switchname)
+usage_notsup(const char *switchname, const char *alt)
{
- fprintf(stderr, "Argument \'%s\' not supported.\n", switchname);
+ fprintf(stderr, "Argument \'%s\' not supported.%s\n", switchname, alt);
usage_aux();
}
#endif
--
cgit v1.2.3
From 8434b76e48b4ad1fe47b1d38dc3cac0b50d7d52d Mon Sep 17 00:00:00 2001
From: Lukas Larsson
Date: Mon, 10 Apr 2017 09:41:46 +0200
Subject: erts: Fix testcases for smp +S 1:1
---
erts/emulator/test/scheduler_SUITE.erl | 16 ++++------------
erts/emulator/test/statistics_SUITE.erl | 4 ++--
2 files changed, 6 insertions(+), 14 deletions(-)
(limited to 'erts')
diff --git a/erts/emulator/test/scheduler_SUITE.erl b/erts/emulator/test/scheduler_SUITE.erl
index 885298ce34..64e51e7d7c 100644
--- a/erts/emulator/test/scheduler_SUITE.erl
+++ b/erts/emulator/test/scheduler_SUITE.erl
@@ -1087,12 +1087,8 @@ scheduler_threads(Config) when is_list(Config) ->
{Sched, SchedOnln, _} = get_sstate(Config, ""),
%% Configure half the number of both the scheduler threads and
%% the scheduler threads online.
- {HalfSched, HalfSchedOnln} = case SmpSupport of
- false -> {1,1};
- true ->
- {Sched div 2,
- SchedOnln div 2}
- end,
+ {HalfSched, HalfSchedOnln} = {lists:max([1,Sched div 2]),
+ lists:max([1,SchedOnln div 2])},
{HalfSched, HalfSchedOnln, _} = get_sstate(Config, "+SP 50:50"),
%% Use +S to configure 4x the number of scheduler threads and
%% 4x the number of scheduler threads online, but alter that
@@ -1149,12 +1145,8 @@ dirty_scheduler_threads(Config) when is_list(Config) ->
dirty_scheduler_threads_test(Config) ->
SmpSupport = erlang:system_info(smp_support),
{Sched, SchedOnln, _} = get_dsstate(Config, ""),
- {HalfSched, HalfSchedOnln} = case SmpSupport of
- false -> {1,1};
- true ->
- {Sched div 2,
- SchedOnln div 2}
- end,
+ {HalfSched, HalfSchedOnln} = {lists:max([1,Sched div 2]),
+ lists:max([1,SchedOnln div 2])},
Cmd1 = "+SDcpu "++integer_to_list(HalfSched)++":"++
integer_to_list(HalfSchedOnln),
{HalfSched, HalfSchedOnln, _} = get_dsstate(Config, Cmd1),
diff --git a/erts/emulator/test/statistics_SUITE.erl b/erts/emulator/test/statistics_SUITE.erl
index f51244485b..729e86cb4f 100644
--- a/erts/emulator/test/statistics_SUITE.erl
+++ b/erts/emulator/test/statistics_SUITE.erl
@@ -329,9 +329,9 @@ scheduler_wall_time_test(Type) ->
%% 50% load
HalfHogs = [StartHog() || _ <- lists:seq(1, (Schedulers-1) div 2)],
HalfDirtyCPUHogs = [StartDirtyHog(dirty_cpu)
- || _ <- lists:seq(1, DirtyCPUSchedulers div 2)],
+ || _ <- lists:seq(1, lists:max([1,DirtyCPUSchedulers div 2]))],
HalfDirtyIOHogs = [StartDirtyHog(dirty_io)
- || _ <- lists:seq(1, DirtyIOSchedulers div 2)],
+ || _ <- lists:seq(1, lists:max([1,DirtyIOSchedulers div 2]))],
HalfLoad = lists:sum(get_load(Type)) div TotLoadSchedulers,
if Schedulers < 2, HalfLoad > 80 -> ok; %% Ok only one scheduler online and one hog
%% We want roughly 50% load
--
cgit v1.2.3