[PATCH] Add some traces
From: Eugenio PÃrez
Date: Tue Feb 11 2020 - 04:29:01 EST
---
drivers/vhost/vhost.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index b5a51b1f2e79..60c048eebe4d 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -2239,8 +2239,8 @@ static int fetch_buf(struct vhost_virtqueue *vq)
vq->avail_idx = vhost16_to_cpu(vq, avail_idx);
if (unlikely((u16)(vq->avail_idx - last_avail_idx) > vq->num)) {
- vq_err(vq, "Guest moved used index from %u to %u",
- last_avail_idx, vq->avail_idx);
+ vq_err(vq, "Guest moved vq %p used index from %u to %u",
+ vq, last_avail_idx, vq->avail_idx);
return -EFAULT;
}
@@ -2336,6 +2336,8 @@ static int fetch_descs(struct vhost_virtqueue *vq)
while (!ret && vq->ndescs <= vq->batch_descs)
ret = fetch_buf(vq);
+ pr_debug("[vq=%p][vq->ndescs=%d]", vq, vq->ndescs);
+
return vq->ndescs ? 0 : ret;
}
@@ -2416,6 +2418,8 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq,
}
vq->first_desc = i + 1;
+ pr_debug("[vq=%p][vq->ndescs=%d][vq->first_desc=%d]", vq, vq->ndescs,
+ vq->first_desc);
return ret;
@@ -2459,6 +2463,7 @@ static int __vhost_add_used_n(struct vhost_virtqueue *vq,
start = vq->last_used_idx & (vq->num - 1);
used = vq->used->ring + start;
+ pr_debug("[vq=%p][start=%d][count=%u]", vq, start, count);
if (vhost_put_used(vq, heads, start, count)) {
vq_err(vq, "Failed to write used");
return -EFAULT;
--
2.18.1