From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3B014A0352; Tue, 25 Jan 2022 12:25:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A580426E1; Tue, 25 Jan 2022 12:25:51 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 249BD426D8 for ; Tue, 25 Jan 2022 12:25:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643109948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ckuDlPOK8rf/BtDKG+9bEAY4+BnsuzyxF87NuLoBOG4=; b=CFBpp3w8J1iW6RpLlvxwH8cUStxsCkJnNn5XBb6CoZ63BGl6sZMckQrbrxFOM+ydyDT/if ButgGml5HmSBjkO4SzX8LeoNAjvCVfWRGOhJuFEoeUXAa6Prn+Gx+yDbucBZP0X01zbZbK /MrMY8z0Up6ju59bUJvyDYWwxiJLkq0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-669-q3MmGbPGM1CTyK1YBlKL1Q-1; Tue, 25 Jan 2022 06:25:45 -0500 X-MC-Unique: q3MmGbPGM1CTyK1YBlKL1Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62AFD8519E2; Tue, 25 Jan 2022 11:25:44 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC7F666E1B; Tue, 25 Jan 2022 11:25:32 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com Cc: Maxime Coquelin Subject: [PATCH v2 1/9] vhost: improve IOTLB logs Date: Tue, 25 Jan 2022 12:24:49 +0100 Message-Id: <20220125112457.166434-2-maxime.coquelin@redhat.com> In-Reply-To: <20220125112457.166434-1-maxime.coquelin@redhat.com> References: <20220125112457.166434-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- lib/vhost/iotlb.c | 26 +++++++++++++++----------- lib/vhost/iotlb.h | 10 +++++----- lib/vhost/vhost.c | 2 +- lib/vhost/vhost_user.c | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/lib/vhost/iotlb.c b/lib/vhost/iotlb.c index 82bdb84526..afa86d7c2b 100644 --- a/lib/vhost/iotlb.c +++ b/lib/vhost/iotlb.c @@ -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; } diff --git a/lib/vhost/iotlb.h b/lib/vhost/iotlb.h index b6e0757ad6..8d0ff7473b 100644 --- a/lib/vhost/iotlb.h +++ b/lib/vhost/iotlb.h @@ -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); diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 13a9bb9dd1..e52d7f7bb6 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -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", diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 5eb1dd6812..6aaac6a316 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -2563,7 +2563,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)) -- 2.34.1