aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2022-08-18 10:58:58 +0100
committerGitHub <noreply@github.com>2022-08-18 10:58:58 +0100
commita511dd988f5e05c5eebfadb823ef2ff6fe2d7379 (patch)
tree4403a1edb85b7dd5347beb4e1b051cedd6845382 /lib
parentff0ef3fb1ed7b206d0586071a88778110b245582 (diff)
downloadlibvfio-user-a511dd988f5e05c5eebfadb823ef2ff6fe2d7379.zip
libvfio-user-a511dd988f5e05c5eebfadb823ef2ff6fe2d7379.tar.gz
libvfio-user-a511dd988f5e05c5eebfadb823ef2ff6fe2d7379.tar.bz2
avoid vfu_log() in SGL hot path (#705)
Even though in non-debug, we don't actually log anything here, even assembling the arguments to vfu_log() has a performance impact. Hide them behind a DEBUG_SGL define - even in a DEBUG build, they are particularly noisy and low-value. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/dma.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/dma.h b/lib/dma.h
index 089f973..be64617 100644
--- a/lib/dma.h
+++ b/lib/dma.h
@@ -288,9 +288,13 @@ dma_sgl_get(dma_controller_t *dma, dma_sg_t *sgl, struct iovec *iov, size_t cnt)
return ERROR_INT(EFAULT);
}
+#ifdef DEBUG_SGL
vfu_log(dma->vfu_ctx, LOG_DEBUG, "map %p-%p",
sg->dma_addr + sg->offset,
sg->dma_addr + sg->offset + sg->length);
+
+#endif
+
iov->iov_base = region->info.vaddr + sg->offset;
iov->iov_len = sg->length;
@@ -326,9 +330,12 @@ dma_sgl_mark_dirty(dma_controller_t *dma, dma_sg_t *sgl, size_t cnt)
}
}
+#ifdef DEBUG_SGL
vfu_log(dma->vfu_ctx, LOG_DEBUG, "mark dirty %p-%p",
sg->dma_addr + sg->offset,
sg->dma_addr + sg->offset + sg->length);
+#endif
+
sg++;
} while (--cnt > 0);
}
@@ -358,9 +365,12 @@ dma_sgl_put(dma_controller_t *dma, dma_sg_t *sgl, size_t cnt)
}
}
+#ifdef DEBUG_SGL
vfu_log(dma->vfu_ctx, LOG_DEBUG, "unmap %p-%p",
sg->dma_addr + sg->offset,
sg->dma_addr + sg->offset + sg->length);
+#endif
+
sg++;
} while (--cnt > 0);
}