From 345bb2e89df05f4c61526018459539eda770b8c8 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Wed, 17 Feb 2021 11:43:06 -0700 Subject: [PATCH] nvme/identify: submit only one GET_FEATURE at a time This is a workaround for issue #1799 that would require a fix from Google Cloud Platform. GCP NVMe SSDs do not support overlapped GET_FEATURE commands - the cdw0 value on completions get mixed up. On GCP the result is that identify app reports only 1 SQ/CQ supported when in fact it supports 16. We can easily workaround this in the identify app by submitting one GET_FEATURE and then polling for its completion before submitting the next one. We may consider reverting this in the future should GCP provide a fix, but there is really no harm in keeping this patch long term since this isn't an I/O path issue. Signed-off-by: Jim Harris Change-Id: I536033677a8364c955d562226e3feba4dbad0e07 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6454 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker Community-CI: Mellanox Build Bot --- examples/nvme/identify/identify.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/nvme/identify/identify.c b/examples/nvme/identify/identify.c index f12e6cb2a8..b0447ea89f 100644 --- a/examples/nvme/identify/identify.c +++ b/examples/nvme/identify/identify.c @@ -228,7 +228,10 @@ get_features(struct spdk_nvme_ctrlr *ctrlr) SPDK_OCSSD_FEAT_MEDIA_FEEDBACK, }; - /* Submit several GET FEATURES commands and wait for them to complete */ + /* Submit only one GET FEATURES at a time. There is a known issue #1799 + * with Google Cloud Platform NVMe SSDs that do not handle overlapped + * GET FEATURES commands correctly. + */ outstanding_commands = 0; for (i = 0; i < SPDK_COUNTOF(features_to_get); i++) { if (!spdk_nvme_ctrlr_is_ocssd_supported(ctrlr) && @@ -240,11 +243,12 @@ get_features(struct spdk_nvme_ctrlr *ctrlr) } else { printf("get_feature(0x%02X) failed to submit command\n", features_to_get[i]); } + + while (outstanding_commands) { + spdk_nvme_ctrlr_process_admin_completions(ctrlr); + } } - while (outstanding_commands) { - spdk_nvme_ctrlr_process_admin_completions(ctrlr); - } } static int