From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [PATCH 7/7] vhost: improve FD manager logging
Date: Thu, 29 Feb 2024 13:25:02 +0100 [thread overview]
Message-ID: <20240229122502.2572343-8-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20240229122502.2572343-1-maxime.coquelin@redhat.com>
Convert the logging macro to pass the fdset name
as argument.
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
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;
}
--
2.43.2
next prev parent reply other threads:[~2024-02-29 12:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 12:24 [PATCH 0/7] vhost: FD manager improvements Maxime Coquelin
2024-02-29 12:24 ` [PATCH 1/7] vhost: fix VDUSE device destruction failure Maxime Coquelin
2024-02-29 13:31 ` David Marchand
2024-03-04 10:35 ` [PATCH v2] " David Marchand
2024-03-04 15:12 ` Maxime Coquelin
2024-03-05 9:05 ` David Marchand
2024-02-29 12:24 ` [PATCH 2/7] vhost: rename polling mutex Maxime Coquelin
2024-02-29 13:41 ` David Marchand
2024-02-29 12:24 ` [PATCH 3/7] vhost: make use of FD manager init function Maxime Coquelin
2024-02-29 13:42 ` David Marchand
2024-02-29 12:24 ` [PATCH 4/7] vhost: hide synchronization within FD manager Maxime Coquelin
2024-02-29 12:25 ` [PATCH 5/7] vhost: improve fdset initialization Maxime Coquelin
2024-02-29 12:25 ` [PATCH 6/7] vhost: convert fdset sync to eventfd Maxime Coquelin
2024-02-29 12:25 ` Maxime Coquelin [this message]
2024-03-04 10:35 ` [PATCH 0/7] vhost: FD manager improvements David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240229122502.2572343-8-maxime.coquelin@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbox@nvidia.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).