From patchwork Thu Feb 29 12:25:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 137486 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E733443C36; Thu, 29 Feb 2024 13:25:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 016AF42E3F; Thu, 29 Feb 2024 13:25:25 +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 DF64742DCA for ; Thu, 29 Feb 2024 13:25:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709209520; 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=K6mQQgwdhlpajEZBksW0jmAmhsd0DBYf1QD4SGBzyk4=; b=RBdGeI6a0amtHLzoENdi0HnVJMFReR/pgRhfAd9mPj6CcdqGLCeA0f4hHe8StwypBntFI8 dZ0B+KgDW04UMwLrihgnIO2W5nI/de9EM7X7d2XCHs6TRF2Q2Xx2jaBFpb9XAlUdohnUJK eWtdy9waGuCBNH4IGCv5EUAAZlFzD0s= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-m30Na_ZeOaiveYmbZ8f5Ow-1; Thu, 29 Feb 2024 07:25:17 -0500 X-MC-Unique: m30Na_ZeOaiveYmbZ8f5Ow-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED9C810651E0; Thu, 29 Feb 2024 12:25:16 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B471F1121312; Thu, 29 Feb 2024 12:25:15 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com Cc: Maxime Coquelin Subject: [PATCH 7/7] vhost: improve FD manager logging Date: Thu, 29 Feb 2024 13:25:02 +0100 Message-ID: <20240229122502.2572343-8-maxime.coquelin@redhat.com> In-Reply-To: <20240229122502.2572343-1-maxime.coquelin@redhat.com> References: <20240229122502.2572343-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 Convert the logging macro to pass the fdset name as argument. Signed-off-by: Maxime Coquelin --- lib/vhost/fd_man.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c index 6a5bd74656..18426095b4 100644 --- a/lib/vhost/fd_man.c +++ b/lib/vhost/fd_man.c @@ -19,8 +19,8 @@ RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO); #define RTE_LOGTYPE_VHOST_FDMAN vhost_fdset_logtype -#define VHOST_FDMAN_LOG(level, ...) \ - RTE_LOG_LINE(level, VHOST_FDMAN, "" __VA_ARGS__) +#define VHOST_FDMAN_LOG(prefix, level, fmt, args...) \ + RTE_LOG_LINE(level, VHOST_FDMAN, "(%s) " fmt, prefix, ##args) #define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL) @@ -126,15 +126,13 @@ fdset_sync_init(struct fdset *fdset) fdset->sync_fd = eventfd(0, 0); if (fdset->sync_fd < 0) { - VHOST_FDMAN_LOG(ERR, "failed to create eventfd for %s fdset", fdset->name); + VHOST_FDMAN_LOG(fdset->name, ERR, "failed to create eventfd"); return -1; } ret = fdset_add_no_sync(fdset, fdset->sync_fd, fdset_sync_read_cb, NULL, fdset); if (ret < 0) { - VHOST_FDMAN_LOG(ERR, "failed to add eventfd %d to %s fdset", - fdset->sync_fd, fdset->name); - + VHOST_FDMAN_LOG(fdset->name, ERR, "failed to add eventfd %d", fdset->sync_fd); fdset_sync_uninit(fdset); return -1; } @@ -152,8 +150,8 @@ fdset_sync(struct fdset *fdset) fdset->sync = false; ret = eventfd_write(fdset->sync_fd, (eventfd_t)1); if (ret < 0) { - VHOST_FDMAN_LOG(ERR, "Failed to write sync eventfd for %s fdset: %s", - fdset->name, strerror(errno)); + VHOST_FDMAN_LOG(fdset->name, ERR, "Failed to write sync eventfd: %s", + strerror(errno)); goto out_unlock; } @@ -251,7 +249,7 @@ fdset_init(const char *name) int i; if (name == NULL) { - VHOST_FDMAN_LOG(ERR, "Invalid name"); + VHOST_FDMAN_LOG("fdset", ERR, "Invalid name"); goto err; } @@ -264,7 +262,7 @@ fdset_init(const char *name) fdset = rte_zmalloc(NULL, sizeof(*fdset), 0); if (!fdset) { - VHOST_FDMAN_LOG(ERR, "Failed to alloc fdset %s", name); + VHOST_FDMAN_LOG(name, ERR, "Failed to alloc fdset"); goto err_unlock; } @@ -280,19 +278,18 @@ fdset_init(const char *name) fdset->num = 0; if (fdset_sync_init(fdset)) { - VHOST_FDMAN_LOG(ERR, "Failed to init sync for %s", name); + VHOST_FDMAN_LOG(fdset->name, ERR, "Failed to init sync"); goto err_free; } if (rte_thread_create_internal_control(&fdset->tid, fdset->name, fdset_event_dispatch, fdset)) { - VHOST_FDMAN_LOG(ERR, "Failed to create %s event dispatch thread", - fdset->name); + VHOST_FDMAN_LOG(fdset->name, ERR, "Failed to create event dispatch thread"); goto err_sync; } if (fdset_insert(fdset)) { - VHOST_FDMAN_LOG(ERR, "Failed to insert fdset %s", name); + VHOST_FDMAN_LOG(fdset->name, ERR, "Failed to insert fdset"); goto err_thread; }