]> git.droids-corp.org - dpdk.git/commitdiff
vhost: improve IOTLB logs
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Wed, 26 Jan 2022 09:55:02 +0000 (10:55 +0100)
committerChenbo Xia <chenbo.xia@intel.com>
Thu, 27 Jan 2022 08:44:31 +0000 (09:44 +0100)
This patch adds IOTLB mempool name when logging debug
or error messages, and also prepends the socket path.
to all the logs.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
lib/vhost/iotlb.c
lib/vhost/iotlb.h
lib/vhost/vhost.c
lib/vhost/vhost_user.c

index 82bdb84526ea29c9b3d5b785870e70125b7826e5..afa86d7c2bb46ab40ed95704aaa4c714e0753482 100644 (file)
@@ -62,7 +62,7 @@ vhost_user_iotlb_pending_miss(struct vhost_virtqueue *vq, uint64_t iova,
 }
 
 void
-vhost_user_iotlb_pending_insert(struct vhost_virtqueue *vq,
+vhost_user_iotlb_pending_insert(struct virtio_net *dev, struct vhost_virtqueue *vq,
                                uint64_t iova, uint8_t perm)
 {
        struct vhost_iotlb_entry *node;
@@ -70,14 +70,16 @@ vhost_user_iotlb_pending_insert(struct vhost_virtqueue *vq,
 
        ret = rte_mempool_get(vq->iotlb_pool, (void **)&node);
        if (ret) {
-               VHOST_LOG_CONFIG(DEBUG, "IOTLB pool empty, clear entries\n");
+               VHOST_LOG_CONFIG(DEBUG, "(%s) IOTLB pool %s empty, clear entries\n",
+                               dev->ifname, vq->iotlb_pool->name);
                if (!TAILQ_EMPTY(&vq->iotlb_pending_list))
                        vhost_user_iotlb_pending_remove_all(vq);
                else
                        vhost_user_iotlb_cache_random_evict(vq);
                ret = rte_mempool_get(vq->iotlb_pool, (void **)&node);
                if (ret) {
-                       VHOST_LOG_CONFIG(ERR, "IOTLB pool still empty, failure\n");
+                       VHOST_LOG_CONFIG(ERR, "(%s) IOTLB pool %s still empty, failure\n",
+                                       dev->ifname, vq->iotlb_pool->name);
                        return;
                }
        }
@@ -156,22 +158,25 @@ vhost_user_iotlb_cache_random_evict(struct vhost_virtqueue *vq)
 }
 
 void
-vhost_user_iotlb_cache_insert(struct vhost_virtqueue *vq, uint64_t iova,
-                               uint64_t uaddr, uint64_t size, uint8_t perm)
+vhost_user_iotlb_cache_insert(struct virtio_net *dev, struct vhost_virtqueue *vq,
+                               uint64_t iova, uint64_t uaddr,
+                               uint64_t size, uint8_t perm)
 {
        struct vhost_iotlb_entry *node, *new_node;
        int ret;
 
        ret = rte_mempool_get(vq->iotlb_pool, (void **)&new_node);
        if (ret) {
-               VHOST_LOG_CONFIG(DEBUG, "IOTLB pool empty, clear entries\n");
+               VHOST_LOG_CONFIG(DEBUG, "(%s) IOTLB pool %s empty, clear entries\n",
+                               dev->ifname, vq->iotlb_pool->name);
                if (!TAILQ_EMPTY(&vq->iotlb_list))
                        vhost_user_iotlb_cache_random_evict(vq);
                else
                        vhost_user_iotlb_pending_remove_all(vq);
                ret = rte_mempool_get(vq->iotlb_pool, (void **)&new_node);
                if (ret) {
-                       VHOST_LOG_CONFIG(ERR, "IOTLB pool still empty, failure\n");
+                       VHOST_LOG_CONFIG(ERR, "(%s) IOTLB pool %s still empty, failure\n",
+                                       dev->ifname, vq->iotlb_pool->name);
                        return;
                }
        }
@@ -311,7 +316,7 @@ vhost_user_iotlb_init(struct virtio_net *dev, int vq_index)
 
        snprintf(pool_name, sizeof(pool_name), "iotlb_%u_%d_%d",
                        getpid(), dev->vid, vq_index);
-       VHOST_LOG_CONFIG(DEBUG, "IOTLB cache name: %s\n", pool_name);
+       VHOST_LOG_CONFIG(DEBUG, "(%s) IOTLB cache name: %s\n", dev->ifname, pool_name);
 
        /* If already created, free it and recreate */
        vq->iotlb_pool = rte_mempool_lookup(pool_name);
@@ -324,9 +329,8 @@ vhost_user_iotlb_init(struct virtio_net *dev, int vq_index)
                        RTE_MEMPOOL_F_NO_CACHE_ALIGN |
                        RTE_MEMPOOL_F_SP_PUT);
        if (!vq->iotlb_pool) {
-               VHOST_LOG_CONFIG(ERR,
-                               "Failed to create IOTLB cache pool (%s)\n",
-                               pool_name);
+               VHOST_LOG_CONFIG(ERR, "(%s) Failed to create IOTLB cache pool %s\n",
+                               dev->ifname, pool_name);
                return -1;
        }
 
index b6e0757ad6c998731ed76d1b9edde989e2e39aa4..8d0ff7473b3e74760e4bd25986726826968a4cdd 100644 (file)
@@ -33,17 +33,17 @@ vhost_user_iotlb_wr_unlock(struct vhost_virtqueue *vq)
        rte_rwlock_write_unlock(&vq->iotlb_lock);
 }
 
-void vhost_user_iotlb_cache_insert(struct vhost_virtqueue *vq, uint64_t iova,
-                                       uint64_t uaddr, uint64_t size,
-                                       uint8_t perm);
+void vhost_user_iotlb_cache_insert(struct virtio_net *dev, struct vhost_virtqueue *vq,
+                                       uint64_t iova, uint64_t uaddr,
+                                       uint64_t size, uint8_t perm);
 void vhost_user_iotlb_cache_remove(struct vhost_virtqueue *vq,
                                        uint64_t iova, uint64_t size);
 uint64_t vhost_user_iotlb_cache_find(struct vhost_virtqueue *vq, uint64_t iova,
                                        uint64_t *size, uint8_t perm);
 bool vhost_user_iotlb_pending_miss(struct vhost_virtqueue *vq, uint64_t iova,
                                                uint8_t perm);
-void vhost_user_iotlb_pending_insert(struct vhost_virtqueue *vq, uint64_t iova,
-                                               uint8_t perm);
+void vhost_user_iotlb_pending_insert(struct virtio_net *dev, struct vhost_virtqueue *vq,
+                                               uint64_t iova, uint8_t perm);
 void vhost_user_iotlb_pending_remove(struct vhost_virtqueue *vq, uint64_t iova,
                                                uint64_t size, uint8_t perm);
 void vhost_user_iotlb_flush_all(struct vhost_virtqueue *vq);
index 13a9bb9dd1769a3b3e5e7898ec3acb661c6b28c8..e52d7f7bb6aff997b3991d48d7f23f883e82d468 100644 (file)
@@ -56,7 +56,7 @@ __vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq,
                 */
                vhost_user_iotlb_rd_unlock(vq);
 
-               vhost_user_iotlb_pending_insert(vq, iova, perm);
+               vhost_user_iotlb_pending_insert(dev, vq, iova, perm);
                if (vhost_user_iotlb_miss(dev, iova, perm)) {
                        VHOST_LOG_CONFIG(ERR,
                                "IOTLB miss req failed for IOVA 0x%" PRIx64 "\n",
index f99692bdc1d3d8f89cdfda0090069daa5897fa90..533f85411da3388e48db0e638b65c7eb5d63ecb2 100644 (file)
@@ -2568,7 +2568,7 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg,
                        if (!vq)
                                continue;
 
-                       vhost_user_iotlb_cache_insert(vq, imsg->iova, vva,
+                       vhost_user_iotlb_cache_insert(dev, vq, imsg->iova, vva,
                                        len, imsg->perm);
 
                        if (is_vring_iotlb(dev, vq, imsg))