Commit a7841227 authored by Changpeng Liu's avatar Changpeng Liu Committed by Tomasz Zawadzki
Browse files

nvmf/vfio-user: use correct syslog level



vsnprintf() is called in the IO processing path if we set LOG_DEBUG
by default, which will impact the performance numbers. See below
perf record:

13.44%  reactor_0  [kernel.kallsyms]   [k] do_syscall_64
 7.59%  reactor_0  [kernel.kallsyms]   [k] syscall_return_via_sysret
 7.18%  reactor_0  libc-2.29.so        [.] __vfprintf_internal
 5.60%  reactor_0  [kernel.kallsyms]   [k] entry_SYSCALL_64
 4.74%  reactor_0  [kernel.kallsyms]   [k] vmx_deliver_posted_interrupt
 4.36%  reactor_0  nvmf_tgt            [.] post_completion

Change-Id: Icc12345c341d870375a1db729412acb7b3cd0211
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9079


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarJohn Levon <levon@movementarian.org>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 01936d2e
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -1725,6 +1725,23 @@ vfio_user_log(vfu_ctx_t *vfu_ctx, int level, char const *msg)
	}
}

static int
vfio_user_get_log_level(void)
{
	int level;

	if (SPDK_DEBUGLOG_FLAG_ENABLED("nvmf_vfio")) {
		return LOG_DEBUG;
	}

	level = spdk_log_to_syslog_level(spdk_log_get_level());
	if (level < 0) {
		return LOG_ERR;
	}

	return level;
}

static void
init_pci_config_space(vfu_pci_config_space_t *p)
{
@@ -2006,7 +2023,7 @@ nvmf_vfio_user_listen(struct spdk_nvmf_transport *transport,
		err = -1;
		goto out;
	}
	vfu_setup_log(endpoint->vfu_ctx, vfio_user_log, LOG_DEBUG);
	vfu_setup_log(endpoint->vfu_ctx, vfio_user_log, vfio_user_get_log_level());

	err = vfio_user_dev_info_fill(vu_transport, endpoint);
	if (err < 0) {