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 C93BCA0352; Tue, 25 Jan 2022 12:26:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DF5542990; Tue, 25 Jan 2022 12:26:13 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 4AF2D42989 for ; Tue, 25 Jan 2022 12:26:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643109970; 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=gpoVy7p6o1sBOWfPczPdAzFDGkpXpIi0izDycKCOCi8=; b=CadfodhZ5HVTLQ5E9KEunfOvUlrRMyW/i5OLDFEv1Gk0xfJ5GjLaep64NDf3DDHsiwPAyg s8gHeG2TtwwBKly5CiH69ufOxq6qWjGD+vdeiPeXgZZ7BqnLlkdV8AHDpbXoS6c1DUx9w/ k587VH+GOIAk210Hn80ZV57g1ppXMmA= 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-570-dMDQG9K4MJaxIJXCK92YBQ-1; Tue, 25 Jan 2022 06:26:07 -0500 X-MC-Unique: dMDQG9K4MJaxIJXCK92YBQ-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 AB1588519E0; Tue, 25 Jan 2022 11:26:06 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7097966E14; Tue, 25 Jan 2022 11:26:05 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com Cc: Maxime Coquelin Subject: [PATCH v2 7/9] vhost: remove multi-line logs Date: Tue, 25 Jan 2022 12:24:55 +0100 Message-Id: <20220125112457.166434-8-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 replaces multi-lines logs in multiple single- line logs in order to ease logs filtering based on their socket path. Signed-off-by: Maxime Coquelin --- lib/vhost/socket.c | 10 ++-- lib/vhost/vhost.c | 8 ++-- lib/vhost/vhost_user.c | 106 +++++++++++++++++++---------------------- 3 files changed, 60 insertions(+), 64 deletions(-) diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index ad3471d6a9..c2f8013cd5 100644 --- a/lib/vhost/socket.c +++ b/lib/vhost/socket.c @@ -868,8 +868,8 @@ rte_vhost_driver_register(const char *path, uint64_t flags) if (vsocket->async_copy && (flags & (RTE_VHOST_USER_IOMMU_SUPPORT | RTE_VHOST_USER_POSTCOPY_SUPPORT))) { - VHOST_LOG_CONFIG(ERR, "(%s) enabling async copy and IOMMU " - "or post-copy feature simultaneously is not supported\n", path); + VHOST_LOG_CONFIG(ERR, "(%s) async copy with IOMMU or post-copy not supported\n", + path); goto out_mutex; } @@ -908,8 +908,10 @@ rte_vhost_driver_register(const char *path, uint64_t flags) (1ULL << VIRTIO_NET_F_HOST_TSO6) | (1ULL << VIRTIO_NET_F_HOST_UFO); - VHOST_LOG_CONFIG(INFO, "(%s) Linear buffers requested without external buffers, " - "disabling host segmentation offloading support\n", path); + VHOST_LOG_CONFIG(INFO, "(%s) Linear buffers requested without external buffers,\n", + path); + VHOST_LOG_CONFIG(INFO, "(%s) disabling host segmentation offloading support\n", + path); vsocket->supported_features &= ~seg_offload_features; vsocket->features &= ~seg_offload_features; } diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 3b05f17a50..cd62dc238b 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -1786,8 +1786,8 @@ rte_vhost_async_channel_unregister(int vid, uint16_t queue_id) } if (vq->async->pkts_inflight_n) { - VHOST_LOG_CONFIG(ERR, "(%s) failed to unregister async channel. " - "async inflight packets must be completed before unregistration.\n", + VHOST_LOG_CONFIG(ERR, "(%s) failed to unregister async channel.\n", dev->ifname); + VHOST_LOG_CONFIG(ERR, "(%s) inflight packets must be completed before unregistration.\n", dev->ifname); ret = -1; goto out; @@ -1821,8 +1821,8 @@ rte_vhost_async_channel_unregister_thread_unsafe(int vid, uint16_t queue_id) return 0; if (vq->async->pkts_inflight_n) { - VHOST_LOG_CONFIG(ERR, "(%s) failed to unregister async channel. " - "async inflight packets must be completed before unregistration.\n", + VHOST_LOG_CONFIG(ERR, "(%s) failed to unregister async channel.\n", dev->ifname); + VHOST_LOG_CONFIG(ERR, "(%s) inflight packets must be completed before unregistration.\n", dev->ifname); return -1; } diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index e207ace426..3a3f9723cc 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -872,13 +872,13 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) } if (vq->last_used_idx != vq->used->idx) { - VHOST_LOG_CONFIG(WARNING, - "(%s) last_used_idx (%u) and vq->used->idx (%u) mismatches; " - "some packets maybe resent for Tx and dropped for Rx\n", + VHOST_LOG_CONFIG(WARNING, "(%s) last_used_idx (%u) and vq->used->idx (%u) mismatches;\n", dev->ifname, vq->last_used_idx, vq->used->idx); vq->last_used_idx = vq->used->idx; vq->last_avail_idx = vq->used->idx; + VHOST_LOG_CONFIG(WARNING, "(%s) some packets maybe resent for Tx and dropped for Rx\n", + dev->ifname); } vq->access_ok = true; @@ -1066,15 +1066,14 @@ dump_guest_pages(struct virtio_net *dev) for (i = 0; i < dev->nr_guest_pages; i++) { page = &dev->guest_pages[i]; - VHOST_LOG_CONFIG(INFO, - "(%s) guest physical page region %u\n" - "\t guest_phys_addr: %" PRIx64 "\n" - "\t host_phys_addr : %" PRIx64 "\n" - "\t size : %" PRIx64 "\n", - dev->ifname, i, - page->guest_phys_addr, - page->host_phys_addr, - page->size); + VHOST_LOG_CONFIG(INFO, "(%s) guest physical page region %u\n", + dev->ifname, i); + VHOST_LOG_CONFIG(INFO, "(%s)\tguest_phys_addr: %" PRIx64 "\n", + dev->ifname, page->guest_phys_addr); + VHOST_LOG_CONFIG(INFO, "(%s)\thost_phys_addr : %" PRIx64 "\n", + dev->ifname, page->host_phys_addr); + VHOST_LOG_CONFIG(INFO, "(%s)\tsize : %" PRIx64 "\n", + dev->ifname, page->size); } } #else @@ -1122,8 +1121,7 @@ vhost_user_postcopy_region_register(struct virtio_net *dev, if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, ®_struct)) { - VHOST_LOG_CONFIG(ERR, "(%s) failed to register ufd for region " - "%" PRIx64 " - %" PRIx64 " (ufd = %d) %s\n", + VHOST_LOG_CONFIG(ERR, "(%s) failed to register ufd for region %" PRIx64 " - %" PRIx64 " (ufd = %d) %s\n", dev->ifname, (uint64_t)reg_struct.range.start, (uint64_t)reg_struct.range.start + @@ -1133,7 +1131,8 @@ vhost_user_postcopy_region_register(struct virtio_net *dev, return -1; } - VHOST_LOG_CONFIG(INFO, "(%s)\t userfaultfd registered for range : %" PRIx64 " - %" PRIx64 "\n", + VHOST_LOG_CONFIG(INFO, + "(%s)\t userfaultfd registered for range : %" PRIx64 " - %" PRIx64 "\n", dev->ifname, (uint64_t)reg_struct.range.start, (uint64_t)reg_struct.range.start + @@ -1218,8 +1217,7 @@ vhost_user_mmap_region(struct virtio_net *dev, /* Check for memory_size + mmap_offset overflow */ if (mmap_offset >= -region->size) { - VHOST_LOG_CONFIG(ERR, "(%s) mmap_offset (%#"PRIx64") and memory_size " - "(%#"PRIx64") overflow\n", + VHOST_LOG_CONFIG(ERR, "(%s) mmap_offset (%#"PRIx64") and memory_size (%#"PRIx64") overflow\n", dev->ifname, mmap_offset, region->size); return -1; } @@ -1248,8 +1246,7 @@ vhost_user_mmap_region(struct virtio_net *dev, * mmap() kernel implementation would return an error, but * better catch it before and provide useful info in the logs. */ - VHOST_LOG_CONFIG(ERR, "(%s) mmap size (0x%" PRIx64 ") " - "or alignment (0x%" PRIx64 ") is invalid\n", + VHOST_LOG_CONFIG(ERR, "(%s) mmap size (0x%" PRIx64 ") or alignment (0x%" PRIx64 ") is invalid\n", dev->ifname, region->size + mmap_offset, alignment); return -1; } @@ -1285,24 +1282,22 @@ vhost_user_mmap_region(struct virtio_net *dev, } } - VHOST_LOG_CONFIG(INFO, - "(%s) guest memory region size: 0x%" PRIx64 "\n" - "\t guest physical addr: 0x%" PRIx64 "\n" - "\t guest virtual addr: 0x%" PRIx64 "\n" - "\t host virtual addr: 0x%" PRIx64 "\n" - "\t mmap addr : 0x%" PRIx64 "\n" - "\t mmap size : 0x%" PRIx64 "\n" - "\t mmap align: 0x%" PRIx64 "\n" - "\t mmap off : 0x%" PRIx64 "\n", - dev->ifname, - region->size, - region->guest_phys_addr, - region->guest_user_addr, - region->host_user_addr, - (uint64_t)(uintptr_t)mmap_addr, - mmap_size, - alignment, - mmap_offset); + VHOST_LOG_CONFIG(INFO, "(%s) guest memory region size: 0x%" PRIx64 "\n", + dev->ifname, region->size); + VHOST_LOG_CONFIG(INFO, "(%s)\t guest physical addr: 0x%" PRIx64 "\n", + dev->ifname, region->guest_phys_addr); + VHOST_LOG_CONFIG(INFO, "(%s)\t guest virtual addr: 0x%" PRIx64 "\n", + dev->ifname, region->guest_user_addr); + VHOST_LOG_CONFIG(INFO, "(%s)\t host virtual addr: 0x%" PRIx64 "\n", + dev->ifname, region->host_user_addr); + VHOST_LOG_CONFIG(INFO, "(%s)\t mmap addr : 0x%" PRIx64 "\n", + dev->ifname, (uint64_t)(uintptr_t)mmap_addr); + VHOST_LOG_CONFIG(INFO, "(%s)\t mmap size : 0x%" PRIx64 "\n", + dev->ifname, mmap_size); + VHOST_LOG_CONFIG(INFO, "(%s)\t mmap align: 0x%" PRIx64 "\n", + dev->ifname, alignment); + VHOST_LOG_CONFIG(INFO, "(%s)\t mmap off : 0x%" PRIx64 "\n", + dev->ifname, mmap_offset); return 0; } @@ -2201,9 +2196,9 @@ vhost_user_set_vring_enable(struct virtio_net **pdev, if (enable && dev->virtqueue[index]->async) { if (dev->virtqueue[index]->async->pkts_inflight_n) { - VHOST_LOG_CONFIG(ERR, "(%s) failed to enable vring. " - "async inflight packets must be completed first\n", - dev->ifname); + VHOST_LOG_CONFIG(ERR, + "(%s) failed to enable vring. Inflight packets must be completed first\n", + dev->ifname); return RTE_VHOST_MSG_RESULT_ERR; } } @@ -2709,22 +2704,21 @@ vhost_user_set_status(struct virtio_net **pdev, struct VhostUserMsg *msg, dev->status &= ~VIRTIO_DEVICE_STATUS_FEATURES_OK; } - VHOST_LOG_CONFIG(INFO, "(%s) new device status(0x%08x):\n" - "\t-RESET: %u\n" - "\t-ACKNOWLEDGE: %u\n" - "\t-DRIVER: %u\n" - "\t-FEATURES_OK: %u\n" - "\t-DRIVER_OK: %u\n" - "\t-DEVICE_NEED_RESET: %u\n" - "\t-FAILED: %u\n", - dev->ifname, - dev->status, - (dev->status == VIRTIO_DEVICE_STATUS_RESET), - !!(dev->status & VIRTIO_DEVICE_STATUS_ACK), - !!(dev->status & VIRTIO_DEVICE_STATUS_DRIVER), - !!(dev->status & VIRTIO_DEVICE_STATUS_FEATURES_OK), - !!(dev->status & VIRTIO_DEVICE_STATUS_DRIVER_OK), - !!(dev->status & VIRTIO_DEVICE_STATUS_DEV_NEED_RESET), + VHOST_LOG_CONFIG(INFO, "(%s) new device status(0x%08x):\n", dev->ifname, + dev->status); + VHOST_LOG_CONFIG(INFO, "(%s)\t-RESET: %u\n", dev->ifname, + (dev->status == VIRTIO_DEVICE_STATUS_RESET)); + VHOST_LOG_CONFIG(INFO, "(%s)\t-ACKNOWLEDGE: %u\n", dev->ifname, + !!(dev->status & VIRTIO_DEVICE_STATUS_ACK)); + VHOST_LOG_CONFIG(INFO, "(%s)\t-DRIVER: %u\n", dev->ifname, + !!(dev->status & VIRTIO_DEVICE_STATUS_DRIVER)); + VHOST_LOG_CONFIG(INFO, "(%s)\t-FEATURES_OK: %u\n", dev->ifname, + !!(dev->status & VIRTIO_DEVICE_STATUS_FEATURES_OK)); + VHOST_LOG_CONFIG(INFO, "(%s)\t-DRIVER_OK: %u\n", dev->ifname, + !!(dev->status & VIRTIO_DEVICE_STATUS_DRIVER_OK)); + VHOST_LOG_CONFIG(INFO, "(%s)\t-DEVICE_NEED_RESET: %u\n", dev->ifname, + !!(dev->status & VIRTIO_DEVICE_STATUS_DEV_NEED_RESET)); + VHOST_LOG_CONFIG(INFO, "(%s)\t-FAILED: %u\n", dev->ifname, !!(dev->status & VIRTIO_DEVICE_STATUS_FAILED)); return RTE_VHOST_MSG_RESULT_OK; -- 2.34.1