From 239e63be7d15859c57c34f31dc23551a9aa65779 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 6 Jun 2018 08:33:20 +0900 Subject: [PATCH] copy/ioat: Change the default of IOAT from Enabled to Disabled This patch changes the default setting of IOAT copy engine from Enabled to Disabled. Accordingly this patch changes the config file specification for IOAT copy engine from "Disable Yes/No" to "Enable No/Yes". Subsequent patches will add a new JSON RPC to configure IOAT copy engine dynamically. Change-Id: I754990cbb6ecc096953dd2fb9d34366b91111bf8 Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/410757 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- CHANGELOG.md | 6 ++++++ etc/spdk/iscsi.conf.in | 12 ++++++----- etc/spdk/rocksdb.conf.in | 2 +- etc/spdk/vhost.conf.in | 12 ++++++----- lib/copy/ioat/copy_engine_ioat.c | 29 ++++++++++++++++++--------- test/bdev/bdev.conf.in | 2 +- test/iscsi_tgt/initiator/bdev.conf.in | 2 +- test/vhost/hotplug/vhost.conf.base | 2 +- test/vhost/initiator/bdev.conf | 2 +- test/vhost/initiator/bdev_pci.conf | 2 +- 10 files changed, 46 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faad82f0e..2770a8f75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,12 @@ Results are recorded in the `make.log` file. To enable type: 'git config core.hooksPath .githooks'. To override after configuration use the `git --no-verify` flag. +### IOAT + +IOAT for copy engine is disabled by default. It can be enabled by specifying the Enable +option with "Yes" in `[Ioat]` section of the configuration file. The Disable option is +now deprecated and will be removed in a future release. + ## v18.04: Logical Volume Snapshot/Clone, iSCSI Initiator, Bdev QoS, VPP Userspace TCP/IP ### vhost diff --git a/etc/spdk/iscsi.conf.in b/etc/spdk/iscsi.conf.in index a2b0cd84c..ce731761a 100644 --- a/etc/spdk/iscsi.conf.in +++ b/etc/spdk/iscsi.conf.in @@ -121,9 +121,10 @@ # Users may change this section to create a different number or size of # malloc LUNs. -# If the system has hardware DMA engine, it will use an IOAT -# (i.e. Crystal Beach DMA) channel to do the copy instead of memcpy. -# Of course, users can disable offload even it is available. +# If the system has hardware DMA engine, it can use an IOAT +# (i.e. Crystal Beach DMA) channel to do the copy instead of memcpy +# by specifying "Enable Yes" in [Ioat] section. +# Offload is disabled by default even it is available. [Malloc] # Number of Malloc targets NumberOfLuns 3 @@ -132,11 +133,12 @@ # Block size. Default is 512 bytes. BlockSize 4096 -# Users may not want to use offload even it is available. +# Users can use offload by specifying "Enable Yes" in this section +# if it is available. # Users may use the whitelist to initialize specified devices, IDS # uses BUS:DEVICE.FUNCTION to identify each Ioat channel. [Ioat] - Disable Yes + Enable No Whitelist 00:04.0 Whitelist 00:04.1 diff --git a/etc/spdk/rocksdb.conf.in b/etc/spdk/rocksdb.conf.in index 004609987..928d09788 100644 --- a/etc/spdk/rocksdb.conf.in +++ b/etc/spdk/rocksdb.conf.in @@ -17,6 +17,6 @@ #ReactorMask 0x1 [Ioat] - Disable Yes + Enable No # [Nvme] section will get appended here by scripts/gen_nvme.sh. diff --git a/etc/spdk/vhost.conf.in b/etc/spdk/vhost.conf.in index 8f5e150d9..eff4f77e5 100644 --- a/etc/spdk/vhost.conf.in +++ b/etc/spdk/vhost.conf.in @@ -29,11 +29,12 @@ # Set to 0xFFFFFFFFFFFFFFFF to enable all tracepoint groups. #TpointGroupMask 0x0 -# Users may not want to use offload even it is available. +# Users can use offload by specifying "Enable Yes" in this section +# if it is available. # Users may use the whitelist to initialize specified devices, IDS # uses BUS:DEVICE.FUNCTION to identify each Ioat channel. [Ioat] - Disable Yes + Enable No #Whitelist 00:04.0 #Whitelist 00:04.1 @@ -51,9 +52,10 @@ # Users may change this section to create a different number or size of # malloc LUNs. -# If the system has hardware DMA engine, it will use an IOAT -# (i.e. Crystal Beach DMA) channel to do the copy instead of memcpy. -# Of course, users can disable offload even it is available. +# If the system has hardware DMA engine, it can use an IOAT +# (i.e. Crystal Beach DMA) channel to do the copy instead of memcpy +# by specifying "Enable Yes" in [Ioat] section. +# Offload is disabled by default even it is available. [Malloc] # Number of Malloc targets NumberOfLuns 3 diff --git a/lib/copy/ioat/copy_engine_ioat.c b/lib/copy/ioat/copy_engine_ioat.c index 9c0ea464f..6e1401cde 100644 --- a/lib/copy/ioat/copy_engine_ioat.c +++ b/lib/copy/ioat/copy_engine_ioat.c @@ -44,7 +44,7 @@ #define IOAT_MAX_CHANNELS 64 -static bool g_ioat_disable = false; +static bool g_ioat_enable = false; struct ioat_probe_ctx { int num_whitelist_devices; @@ -282,13 +282,24 @@ static int copy_engine_ioat_init(void) { struct spdk_conf_section *sp = spdk_conf_find_section(NULL, "Ioat"); - const char *pci_bdf; + const char *val, *pci_bdf; int i; if (sp != NULL) { - if (spdk_conf_section_get_boolval(sp, "Disable", false)) { - g_ioat_disable = true; - /* Disable Ioat */ + if (spdk_conf_section_get_boolval(sp, "Enable", false)) { + g_ioat_enable = true; + /* Enable Ioat */ + } + + val = spdk_conf_section_get_val(sp, "Disable"); + if (val != NULL) { + SPDK_WARNLOG("\"Disable\" option is deprecated and will be removed in a future release.\n"); + SPDK_WARNLOG("IOAT is now disabled by default. It may be enabled by \"Enable Yes\"\n"); + + if (g_ioat_enable && (strcasecmp(val, "Yes") == 0)) { + SPDK_ERRLOG("\"Enable Yes\" and \"Disable Yes\" cannot be set at the same time\n"); + return -1; + } } /* Init the whitelist */ @@ -307,7 +318,7 @@ copy_engine_ioat_init(void) } } - if (g_ioat_disable) { + if (!g_ioat_enable) { return 0; } @@ -329,8 +340,8 @@ copy_engine_ioat_init(void) " # Users may use the whitelist to initialize specified devices, IDS\n" \ " # uses BUS:DEVICE.FUNCTION to identify each Ioat channel.\n" -#define COPY_ENGINE_IOAT_DISABLE_TMPL \ -" Disable %s\n" +#define COPY_ENGINE_IOAT_ENABLE_TMPL \ +" Enable %s\n" #define COPY_ENGINE_IOAT_WHITELIST_TMPL \ " Whitelist %.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 "\n" @@ -342,7 +353,7 @@ copy_engine_ioat_config_text(FILE *fp) struct spdk_pci_addr *dev; fprintf(fp, COPY_ENGINE_IOAT_HEADER_TMPL); - fprintf(fp, COPY_ENGINE_IOAT_DISABLE_TMPL, g_ioat_disable ? "Yes" : "No"); + fprintf(fp, COPY_ENGINE_IOAT_ENABLE_TMPL, g_ioat_enable ? "Yes" : "No"); for (i = 0; i < g_probe_ctx.num_whitelist_devices; i++) { dev = &g_probe_ctx.whitelist[i]; diff --git a/test/bdev/bdev.conf.in b/test/bdev/bdev.conf.in index 0c074c585..c59b64fd2 100644 --- a/test/bdev/bdev.conf.in +++ b/test/bdev/bdev.conf.in @@ -19,7 +19,7 @@ AIO /tmp/aiofile AIO1 2048 [Ioat] - Disable Yes + Enable No [QoS] # QoS section defines limitation on performance diff --git a/test/iscsi_tgt/initiator/bdev.conf.in b/test/iscsi_tgt/initiator/bdev.conf.in index f23f7e478..09094ea82 100644 --- a/test/iscsi_tgt/initiator/bdev.conf.in +++ b/test/iscsi_tgt/initiator/bdev.conf.in @@ -1,2 +1,2 @@ [Ioat] - Disable Yes + Enable No diff --git a/test/vhost/hotplug/vhost.conf.base b/test/vhost/hotplug/vhost.conf.base index 5e72d3f54..0b0de7490 100644 --- a/test/vhost/hotplug/vhost.conf.base +++ b/test/vhost/hotplug/vhost.conf.base @@ -1,7 +1,7 @@ [Global] [Ioat] - Disable Yes + Enable No [Nvme] HotplugEnable Yes diff --git a/test/vhost/initiator/bdev.conf b/test/vhost/initiator/bdev.conf index 6622ce284..d9198d088 100644 --- a/test/vhost/initiator/bdev.conf +++ b/test/vhost/initiator/bdev.conf @@ -21,4 +21,4 @@ Queues 8 [Ioat] - Disable Yes + Enable No diff --git a/test/vhost/initiator/bdev_pci.conf b/test/vhost/initiator/bdev_pci.conf index 726f24b26..635891b3f 100644 --- a/test/vhost/initiator/bdev_pci.conf +++ b/test/vhost/initiator/bdev_pci.conf @@ -2,4 +2,4 @@ Enable Yes [Ioat] - Disable Yes + Enable No