From e407385e036014161beab8a2e3f855dfeac00cb4 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 18 Apr 2023 17:56:59 +0000 Subject: [PATCH] env_dpdk: add ERRLOGs to help debug issue #2983 Issue #2983 shows a case where we seem to get a device remove notification from DPDK (via vfio path) after we have already detached the device explicitly by SPDK. This issue has proven difficult to reproduce outside of the one observed failure so far, so adding a couple of ERRLOGs into this path to help confirm the this theory should it happen again. Signed-off-by: Jim Harris Change-Id: I0fda4229fe150ca17417b227e8587cd7fbda6692 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17631 Reviewed-by: Konrad Sztyber Reviewed-by: Aleksey Marchuk Tested-by: SPDK CI Jenkins --- lib/env_dpdk/pci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/env_dpdk/pci.c b/lib/env_dpdk/pci.c index 74859f33a..14e1f0153 100644 --- a/lib/env_dpdk/pci.c +++ b/lib/env_dpdk/pci.c @@ -233,6 +233,13 @@ pci_device_rte_dev_event(const char *device_name, TAILQ_FOREACH(dev, &g_pci_devices, internal.tailq) { struct rte_pci_device *rte_dev = dev->dev_handle; + /* Note: these ERRLOGs are useful for triaging issue #2983. */ + if (dev->internal.pending_removal || dev->internal.removed) { + SPDK_ERRLOG("Received event for device SPDK already tried to remove\n"); + SPDK_ERRLOG("pending_removal=%d removed=%d\n", dev->internal.pending_removal, + dev->internal.removed); + } + if (strcmp(dpdk_pci_device_get_name(rte_dev), device_name) == 0 && !dev->internal.pending_removal) { can_detach = !dev->internal.attached;