From nobody Tue Feb 10 10:03:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1770371670; cv=none; d=zohomail.com; s=zohoarc; b=lLiAPDQoS6gtq5z/wohK1JCBE205unPBs2DvnDnWWU1xuDHaM0u2yRMVv8I9SqpROutQ4LjTvTVH8rWZxslYojjCliFKOVlKqw7UO1kiNHmAJ8gUOARKixk81pSQaWY1J/WoCxaimx2tc1WQSaESWLx9aKQOpxqD6Ul5hw9f13M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770371670; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ivDRaEBOm7wP0eHS7cSnpxIc/vCVJmQxcbdCPDZnNlU=; b=avHOZAwU8F+ft81cfNxFjftRTfG0o3c71oxfXvmO6NDNLEke4vgyp+LcnrFkLdA3WbLKJ37RZBXlEnJKJ1pD8AzaWIQHA5kyCGeE1GM2XmUTs8aVBdKwyrIW8slqmdx5ZwZmjmPFXcLLMovmTOwYvYwevwT0PgEebSMZFpkeN3Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770371670043895.0305821877239; Fri, 6 Feb 2026 01:54:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1voIXB-0001tY-1V; Fri, 06 Feb 2026 04:53:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1voIWu-0001oF-7V for qemu-devel@nongnu.org; Fri, 06 Feb 2026 04:53:40 -0500 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1voIWr-0000LK-0H for qemu-devel@nongnu.org; Fri, 06 Feb 2026 04:53:34 -0500 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:1593:0:640:6beb:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id B4F3EC01C1; Fri, 06 Feb 2026 12:53:31 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:52d::1:1f]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 2rKPQc0AN0U0-1Mlg13Lz; Fri, 06 Feb 2026 12:53:30 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1770371610; bh=ivDRaEBOm7wP0eHS7cSnpxIc/vCVJmQxcbdCPDZnNlU=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=k46I800ApMJdXsZkCz2PnZFMpnqd/klXjbL5a0eBeUy8cg2TLNumRmEKhV2klc4b8 TqowCtDXjiYcmaSOxh/8KhpAjoFT7rrypGBj9nvhWIgDpa5FNPDRilFLzd/2uDh3kd poFQyMdyZTq7tHvuF+TCWqh9WzAeRWor5tvcbN6A= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com Cc: sgarzare@redhat.com, raphael@enfabrica.net, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, yc-core@yandex-team.ru, d-tatianin@yandex-team.ru, Raphael Norwitz Subject: [PATCH v5 21/23] vhost-user: make trace events more readable Date: Fri, 6 Feb 2026 12:52:55 +0300 Message-ID: <20260206095258.894504-22-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260206095258.894504-1-vsementsov@yandex-team.ru> References: <20260206095258.894504-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1770371673764158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Raphael Norwitz --- hw/virtio/trace-events | 4 +-- hw/virtio/vhost-user.c | 63 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 658cc365e7..aa1ffa5e94 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -25,8 +25,8 @@ vhost_user_set_mem_table_withfd(int index, const char *na= me, uint64_t memory_siz vhost_user_postcopy_waker(const char *rb, uint64_t rb_offset) "%s + 0x%"PR= Ix64 vhost_user_postcopy_waker_found(uint64_t client_addr) "0x%"PRIx64 vhost_user_postcopy_waker_nomatch(const char *rb, uint64_t rb_offset) "%s = + 0x%"PRIx64 -vhost_user_read(uint32_t req, uint32_t flags) "req:%d flags:0x%"PRIx32"" -vhost_user_write(uint32_t req, uint32_t flags) "req:%d flags:0x%"PRIx32"" +vhost_user_read(uint32_t req, const char *req_name, uint32_t flags) "req:%= d (%s) flags:0x%"PRIx32"" +vhost_user_write(uint32_t req, const char *req_name, uint32_t flags) "req:= %d (%s) flags:0x%"PRIx32"" vhost_user_create_notifier(int idx, void *n) "idx:%d n:%p" =20 # vhost-vdpa.c diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 73ecc52a3f..e820c5cb93 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -119,6 +119,63 @@ typedef enum VhostUserBackendRequest { VHOST_USER_BACKEND_MAX } VhostUserBackendRequest; =20 +#define VHOST_USER_CASE(name) \ + case VHOST_USER_##name: \ + return #name; + +static const char *vhost_req_name(VhostUserRequest req) +{ + switch (req) { + VHOST_USER_CASE(NONE) + VHOST_USER_CASE(GET_FEATURES) + VHOST_USER_CASE(SET_FEATURES) + VHOST_USER_CASE(SET_OWNER) + VHOST_USER_CASE(RESET_OWNER) + VHOST_USER_CASE(SET_MEM_TABLE) + VHOST_USER_CASE(SET_LOG_BASE) + VHOST_USER_CASE(SET_LOG_FD) + VHOST_USER_CASE(SET_VRING_NUM) + VHOST_USER_CASE(SET_VRING_ADDR) + VHOST_USER_CASE(SET_VRING_BASE) + VHOST_USER_CASE(GET_VRING_BASE) + VHOST_USER_CASE(SET_VRING_KICK) + VHOST_USER_CASE(SET_VRING_CALL) + VHOST_USER_CASE(SET_VRING_ERR) + VHOST_USER_CASE(GET_PROTOCOL_FEATURES) + VHOST_USER_CASE(SET_PROTOCOL_FEATURES) + VHOST_USER_CASE(GET_QUEUE_NUM) + VHOST_USER_CASE(SET_VRING_ENABLE) + VHOST_USER_CASE(SEND_RARP) + VHOST_USER_CASE(NET_SET_MTU) + VHOST_USER_CASE(SET_BACKEND_REQ_FD) + VHOST_USER_CASE(IOTLB_MSG) + VHOST_USER_CASE(SET_VRING_ENDIAN) + VHOST_USER_CASE(GET_CONFIG) + VHOST_USER_CASE(SET_CONFIG) + VHOST_USER_CASE(CREATE_CRYPTO_SESSION) + VHOST_USER_CASE(CLOSE_CRYPTO_SESSION) + VHOST_USER_CASE(POSTCOPY_ADVISE) + VHOST_USER_CASE(POSTCOPY_LISTEN) + VHOST_USER_CASE(POSTCOPY_END) + VHOST_USER_CASE(GET_INFLIGHT_FD) + VHOST_USER_CASE(SET_INFLIGHT_FD) + VHOST_USER_CASE(GPU_SET_SOCKET) + VHOST_USER_CASE(RESET_DEVICE) + VHOST_USER_CASE(GET_MAX_MEM_SLOTS) + VHOST_USER_CASE(ADD_MEM_REG) + VHOST_USER_CASE(REM_MEM_REG) + VHOST_USER_CASE(SET_STATUS) + VHOST_USER_CASE(GET_STATUS) + VHOST_USER_CASE(GET_SHARED_OBJECT) + VHOST_USER_CASE(SET_DEVICE_STATE_FD) + VHOST_USER_CASE(CHECK_DEVICE_STATE) + default: + return ""; + } +} + +#undef VHOST_USER_CASE + typedef struct VhostUserMemoryRegion { uint64_t guest_phys_addr; uint64_t memory_size; @@ -313,7 +370,8 @@ static int vhost_user_read_header(struct vhost_dev *dev= , VhostUserMsg *msg) return -EPROTO; } =20 - trace_vhost_user_read(msg->hdr.request, msg->hdr.flags); + trace_vhost_user_read(msg->hdr.request, + vhost_req_name(msg->hdr.request), msg->hdr.flags= ); =20 return 0; } @@ -433,7 +491,8 @@ static int vhost_user_write(struct vhost_dev *dev, Vhos= tUserMsg *msg, return ret < 0 ? -saved_errno : -EIO; } =20 - trace_vhost_user_write(msg->hdr.request, msg->hdr.flags); + trace_vhost_user_write(msg->hdr.request, vhost_req_name(msg->hdr.reque= st), + msg->hdr.flags); =20 return 0; } --=20 2.52.0