log: remove backtrace printing

It was broken since long ago. --enable-log-bt doesn't change
anything. log.c expects SPDK_LOG_BACKTRACE_LVL to be defined
for backtrace to work, but it's not defined anywhere.

Apparently nobody needs this, so remove it.

Change-Id: I2313fd24198b0bf718663f2eafee9b5c6efa0a7f
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2194
Community-CI: Broadcom CI
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Darek Stojaczyk 2020-05-05 11:45:34 +02:00 committed by Tomasz Zawadzki
parent 7ef497012a
commit 922d90c806
13 changed files with 4 additions and 103 deletions

3
CONFIG
View File

@ -43,9 +43,6 @@ CONFIG_CROSS_PREFIX=
# Build with debug logging. Turn off for performance testing and normal usage
CONFIG_DEBUG=n
# Build with support of backtrace printing in log messages. Requires libunwind.
CONFIG_LOG_BACKTRACE=n
# Treat warnings as errors (fail the build on any warning).
CONFIG_WERROR=n

16
configure vendored
View File

@ -24,7 +24,6 @@ function usage()
echo " example: aarch64-linux-gnu"
echo ""
echo " --enable-debug Configure for debug builds"
echo " --enable-log-bt Enable support of backtrace printing in SPDK logs (requires libunwind)."
echo " --enable-werror Treat compiler warnings as errors"
echo " --enable-asan Enable address sanitizer"
echo " --enable-ubsan Enable undefined behavior sanitizer"
@ -211,12 +210,6 @@ for i in "$@"; do
--disable-debug)
CONFIG[DEBUG]=n
;;
--enable-log-bt)
CONFIG[LOG_BACKTRACE]=y
;;
--disable-log-bt)
CONFIG[LOG_BACKTRACE]=n
;;
--enable-asan)
CONFIG[ASAN]=y
;;
@ -759,15 +752,6 @@ if [[ "${CONFIG[ISCSI_INITIATOR]}" = "y" ]]; then
fi
fi
if [[ "${CONFIG[LOG_BACKTRACE]}" = "y" ]]; then
if ! echo -e '#include <libunwind.h>\nint main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -lunwind - 2>/dev/null; then
echo --enable-log-bt requires libunwind.
echo Please install then re-run this script.
exit 1
fi
fi
if [[ "${CONFIG[ASAN]}" = "y" ]]; then
if ! echo -e 'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -fsanitize=address - 2>/dev/null; then

View File

@ -47,7 +47,6 @@
#define SPDK_APP_DEFAULT_LOG_LEVEL SPDK_LOG_NOTICE
#define SPDK_APP_DEFAULT_LOG_PRINT_LEVEL SPDK_LOG_INFO
#define SPDK_APP_DEFAULT_BACKTRACE_LOG_LEVEL SPDK_LOG_ERROR
#define SPDK_APP_DEFAULT_NUM_TRACE_ENTRIES SPDK_DEFAULT_NUM_TRACE_ENTRIES
#define SPDK_APP_DPDK_DEFAULT_MEM_SIZE -1
@ -636,7 +635,6 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_msg_fn start_fn,
g_spdk_app.rc = 0;
spdk_log_set_level(SPDK_APP_DEFAULT_LOG_LEVEL);
spdk_log_set_backtrace_level(SPDK_APP_DEFAULT_BACKTRACE_LOG_LEVEL);
if (app_setup_env(opts) < 0) {
return 1;

View File

@ -34,14 +34,12 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 2
SO_MINOR := 1
SO_VER := 3
SO_MINOR := 0
SO_SUFFIX := $(SO_VER).$(SO_MINOR)
C_SRCS = log.c log_flags.c
LIBNAME = log
ifeq ($(CONFIG_LOG_BACKTRACE),y)
LOCAL_SYS_LIBS += -lunwind
endif
SPDK_MAP_FILE = $(abspath $(CURDIR)/spdk_log.map)

View File

@ -35,11 +35,6 @@
#include "spdk_internal/log.h"
#ifdef SPDK_LOG_BACKTRACE_LVL
#define UNW_LOCAL_ONLY
#include <libunwind.h>
#endif
static const char *const spdk_level_names[] = {
[SPDK_LOG_ERROR] = "ERROR",
[SPDK_LOG_WARN] = "WARNING",
@ -70,44 +65,6 @@ spdk_log_close(void)
}
}
#ifdef SPDK_LOG_BACKTRACE_LVL
static void
log_unwind_stack(FILE *fp, enum spdk_log_level level)
{
unw_error_t err;
unw_cursor_t cursor;
unw_context_t uc;
unw_word_t ip;
unw_word_t offp;
char f_name[64];
int frame;
if (level > g_spdk_log_backtrace_level) {
return;
}
unw_getcontext(&uc);
unw_init_local(&cursor, &uc);
fprintf(fp, "*%s*: === BACKTRACE START ===\n", spdk_level_names[level]);
unw_step(&cursor);
for (frame = 1; unw_step(&cursor) > 0; frame++) {
unw_get_reg(&cursor, UNW_REG_IP, &ip);
err = unw_get_proc_name(&cursor, f_name, sizeof(f_name), &offp);
if (err || strcmp(f_name, "main") == 0) {
break;
}
fprintf(fp, "*%s*: %3d: %*s%s() at %#lx\n", spdk_level_names[level], frame, frame - 1, "", f_name,
(unsigned long)ip);
}
fprintf(fp, "*%s*: === BACKTRACE END ===\n", spdk_level_names[level]);
}
#else
#define log_unwind_stack(fp, lvl)
#endif
static void
get_timestamp_prefix(char *buf, int buf_size)
{
@ -176,7 +133,6 @@ spdk_vlog(enum spdk_log_level level, const char *file, const int line, const cha
get_timestamp_prefix(timestamp, sizeof(timestamp));
if (file) {
fprintf(stderr, "%s%s:%4d:%s: *%s*: %s", timestamp, file, line, func, spdk_level_names[level], buf);
log_unwind_stack(stderr, level);
} else {
fprintf(stderr, "%s%s", timestamp, buf);
}

View File

@ -39,7 +39,6 @@ static TAILQ_HEAD(, spdk_log_flag) g_log_flags = TAILQ_HEAD_INITIALIZER(g_log_fl
enum spdk_log_level g_spdk_log_level = SPDK_LOG_NOTICE;
enum spdk_log_level g_spdk_log_print_level = SPDK_LOG_NOTICE;
enum spdk_log_level g_spdk_log_backtrace_level = SPDK_LOG_DISABLED;
SPDK_LOG_REGISTER_COMPONENT("log", SPDK_LOG_LOG)
@ -71,19 +70,6 @@ spdk_log_get_print_level(void) {
return g_spdk_log_print_level;
}
void
spdk_log_set_backtrace_level(enum spdk_log_level level)
{
assert(level >= SPDK_LOG_DISABLED);
assert(level <= SPDK_LOG_DEBUG);
g_spdk_log_backtrace_level = level;
}
enum spdk_log_level
spdk_log_get_backtrace_level(void) {
return g_spdk_log_backtrace_level;
}
static struct spdk_log_flag *
get_log_flag(const char *name)
{

View File

@ -6,8 +6,6 @@
spdk_log_close;
spdk_log_set_level;
spdk_log_get_level;
spdk_log_set_backtrace_level;
spdk_log_get_backtrace_level;
spdk_log_set_print_level;
spdk_log_get_print_level;
spdk_log;

View File

@ -226,9 +226,6 @@ CXXFLAGS += $(COMMON_CFLAGS)
SYS_LIBS += -lrt
SYS_LIBS += -luuid
SYS_LIBS += -lcrypto
ifeq ($(CONFIG_LOG_BACKTRACE),y)
SYS_LIBS += -lunwind
endif
ifneq ($(CONFIG_NVME_CUSE)$(CONFIG_FUSE),nn)
SYS_LIBS += -lfuse3

View File

@ -14,8 +14,6 @@ if [[ $INSTALL_DEV_TOOLS == "true" ]]; then
# Tools for developers
pacman -Sy --needed --noconfirm git astyle autopep8 \
clang sg3_utils pciutils shellcheck
# Additional (optional) dependencies for showing backtrace in logs
pacman -Sy --needed --noconfirm libunwind
#fakeroot needed to instal via makepkg
pacman -Sy --needed --noconfirm fakeroot
su - $SUDO_USER -c "pushd /tmp;

View File

@ -26,8 +26,6 @@ if [[ $INSTALL_DEV_TOOLS == "true" ]]; then
apt-get install -y git astyle pep8 lcov clang sg3-utils pciutils shellcheck
# Additional python style checker not available on ubuntu 16.04 or earlier.
apt-get install -y pycodestyle || true
# Additional (optional) dependencies for showing backtrace in logs
apt-get install -y libunwind-dev || true
# Additional dependecies for nvmf performance test script
apt-get install -y python3-paramiko
install_shfmt

View File

@ -30,7 +30,7 @@ yum install -y numactl-devel nasm
if [[ $INSTALL_DEV_TOOLS == "true" ]]; then
# Tools for developers
# Includes Fedora, CentOS 7, RHEL 7
# Add EPEL repository for CUnit-devel and libunwind-devel
# Add EPEL repository for CUnit-devel
if echo "$ID $VERSION_ID" | grep -E -q 'rhel 7|centos 7|centos 8'; then
if ! rpm --quiet -q epel-release; then
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
@ -49,8 +49,6 @@ if [[ $INSTALL_DEV_TOOLS == "true" ]]; then
yum install -y python-pycodestyle lcov ShellCheck
fi
yum install -y git astyle sg3_utils pciutils
# Additional (optional) dependencies for showing backtrace in logs
yum install -y libunwind-devel || true
install_shfmt
fi
if [[ $INSTALL_PMEM == "true" ]]; then

View File

@ -11,8 +11,6 @@ if [[ $INSTALL_DEV_TOOLS == "true" ]]; then
# Tools for developers
zypper install -y git-core lcov python-pycodestyle sg3_utils \
pciutils ShellCheck
# Additional (optional) dependencies for showing backtrace in logs
zypper install libunwind-devel || true
install_shfmt
fi
if [[ $INSTALL_PMEM == "true" ]]; then

View File

@ -314,11 +314,6 @@ function get_config_params() {
xtrace_disable
config_params='--enable-debug --enable-werror'
if echo -e "#include <libunwind.h>\nint main(int argc, char *argv[]) {return 0;}\n" \
| gcc -o /dev/null -lunwind -x c - 2> /dev/null; then
config_params+=' --enable-log-bt'
fi
# for options with dependencies but no test flag, set them here
if [ -f /usr/include/infiniband/verbs.h ]; then
config_params+=' --with-rdma'