{"id":2225937,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2225937/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260421202110.306051-17-peterx@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.2/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260421202110.306051-17-peterx@redhat.com>","list_archive_url":null,"date":"2026-04-21T20:21:10","name":"[v2,16/16] vfio/migration: Add tracepoints for precopy/stopcopy query ioctls","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d2d42baffffbe9b8c1665131d1595eca5bfda419","submitter":{"id":67717,"url":"http://patchwork.ozlabs.org/api/1.2/people/67717/?format=json","name":"Peter Xu","email":"peterx@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260421202110.306051-17-peterx@redhat.com/mbox/","series":[{"id":500889,"url":"http://patchwork.ozlabs.org/api/1.2/series/500889/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500889","date":"2026-04-21T20:20:55","name":"migration/vfio: Fix a few issues on API misuse or statistic reports","version":2,"mbox":"http://patchwork.ozlabs.org/series/500889/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2225937/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2225937/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=GH4ibqgR;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=A64XHWaX;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0YhH6HsTz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 06:23:11 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wFHbO-00017p-Mk; Tue, 21 Apr 2026 16:21:48 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <peterx@redhat.com>) id 1wFHbM-00014U-UT\n for qemu-devel@nongnu.org; Tue, 21 Apr 2026 16:21:44 -0400","from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <peterx@redhat.com>) id 1wFHbL-0008UI-9i\n for qemu-devel@nongnu.org; Tue, 21 Apr 2026 16:21:44 -0400","from mail-qk1-f197.google.com (mail-qk1-f197.google.com\n [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-172--xusRwE7Nxa80_PQyywIMw-1; Tue, 21 Apr 2026 16:21:41 -0400","by mail-qk1-f197.google.com with SMTP id\n af79cd13be357-8ee454b1b8cso144981785a.0\n for <qemu-devel@nongnu.org>; Tue, 21 Apr 2026 13:21:41 -0700 (PDT)","from x1.local ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id\n 6a1803df08f44-8b02ae5c26csm114343556d6.31.2026.04.21.13.21.37\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 21 Apr 2026 13:21:39 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776802902;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=Z3YojhZNR/NVuUisrNqEPFb2MauGl3eXRbOu4+fMvCA=;\n b=GH4ibqgRV0Rnunv3B+P7DzgP4cu+xh3cgCRVLxwGoLI2sfinNQfzT5xB2CrtehMqcJQhFh\n 5zHuxKGcJ2ehykMDQnIFuAsZPHiYQVd7ZyZewT9FRT62m9l5tWna/JYF2LyP0bN6Pq5DvR\n i5qCgGwDJ5nauB5ZwAcVDpdYdYFHVqs=","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1776802900; x=1777407700; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=Z3YojhZNR/NVuUisrNqEPFb2MauGl3eXRbOu4+fMvCA=;\n b=A64XHWaXUKUk0+6SoxhymE8ri9Jcd3Bf2kWaTrSPjubEx/qHjrgnCkTUnP/pu/7/F/\n o+2Df4e0UIOIhuoDleYgEP3IT7B4fMkTD9PNzxh5iI+vtEK1ZR87qz2vU8T+7Voc3RNf\n /Xbr9f+RY1RCyDAz6VlLRnXKo+I6v3DRQjXoaCz1OhTv2c4i7luCIIhWHBqGqPpOe7lB\n frDT7TdP5S7KMEo3MC0D+1t/K8Twupr37e7jLOefnfV9oxizZEaOuI6NW9aYnixnMFab\n i86w+ndoX9JHGn0i2104wp0skVn9Y+gBi3BVY/9O0hz3BEHooUl0wfdw2FFgMTQKHkOg\n kt9g=="],"X-MC-Unique":"-xusRwE7Nxa80_PQyywIMw-1","X-Mimecast-MFC-AGG-ID":"-xusRwE7Nxa80_PQyywIMw_1776802901","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776802900; x=1777407700;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=Z3YojhZNR/NVuUisrNqEPFb2MauGl3eXRbOu4+fMvCA=;\n b=YdexGFJaedQM9y+Uk0J0lnRpz985a5RhXfeHvNi0PE0MWtKrrwUQQ71UybhZuKHv8Y\n S7xfd5g6o88GaHje4Kow+7CEkcTLAM/AAnEmZp3KwzrmC/Op+VNswPZ/ZN547miH/5i8\n ccL8vxgtomRgwmj9i1M8u19eR+5+w25+iN2Rf9I4nkUAAVixTiBmz0L+eCZmIDAlHM1F\n FW4nciG1yGaIxRn0iCwrr8cRhEt8LfqwnUxZF+xdbvtMJSYn7LvG/3ywF/O1JZ0ks7jT\n 1Ok19QzVkXR3Tqi0eRHdKef7PVi0wvum2P6rQfYtf/ujbwBYI/rDxUb+NN9UVGvp42QZ\n /3Kg==","X-Gm-Message-State":"AOJu0Yxdxb2r7iq8jvC2HxbJUg6bnFgwKwZQS0NT62JznQHrSegJ1puJ\n iAlecBiYhVsyxi/b3MeNyt0A0tzGkvTUntZ68Rz8lSLTHhCtF5FJaVNIxm7BrZWZDlmreProC6J\n ss+vX0OaGEodX/w2DiXI1iWG9nhSYJ2vC5/Jt70ehRtOr7txefGXe15xd5YIPZuZ8UHdd62xFAs\n k5xVar8667fCN8zODBqUtMjcIeGaKazKBIGnmpvA==","X-Gm-Gg":"AeBDietK2Lvmmr98i7YtnqCgKzzeE1vMfSj9NjloY/K4MvGovuh69EjphsAbylh5mpz\n fVKPZjGuXvwBounDtqjTc9A9P6P2wfbmZJM1YGNeyXnRM2UGSyT0Nip09RqoXodYIpfEBO9hQgf\n 3BYRIPASeD5Z9s3U25F+11zfcbc9ck5GXtymxYGwpdajSNr8yy1ov+rnaC1CkE8D1iIfFkXWsgS\n qvp7kSq/QAtF1GDDgbLQl24ZP71Bqbc6QLc2KSOZFf7KnsESVO9iJOMt+EPGosuWG/FiekxwDsi\n M+tjSOieHN+FjeXm9zZjCk6mH1KfboZ3+RVQINLXGyMGHeq7Pkm7ZpWy8kvy+4l3RDMSJ0QAy5E\n 1yJmQE8Rv6MePIyrKiZWUiEEfqnK/gvTPmyOaC4Q9bI/XOk4cZiMGnna3Rw==","X-Received":["by 2002:a05:6214:4345:b0:8ac:adbe:fc8d with SMTP id\n 6a1803df08f44-8b028015007mr303162626d6.8.1776802900470;\n Tue, 21 Apr 2026 13:21:40 -0700 (PDT)","by 2002:a05:6214:4345:b0:8ac:adbe:fc8d with SMTP id\n 6a1803df08f44-8b028015007mr303161776d6.8.1776802899631;\n Tue, 21 Apr 2026 13:21:39 -0700 (PDT)"],"From":"Peter Xu <peterx@redhat.com>","To":"qemu-devel@nongnu.org","Cc":"Joao Martins <joao.m.martins@oracle.com>,\n Markus Armbruster <armbru@redhat.com>,\n =?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@redhat.com>,\n Avihai Horon <avihaih@nvidia.com>,\n =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= <berrange@redhat.com>,\n Fabiano Rosas <farosas@suse.de>, Prasad Pandit <ppandit@redhat.com>,\n Alex Williamson <alex@shazbot.org>, Kirti Wankhede <kwankhede@nvidia.com>,\n Zhiyi Guo <zhguo@redhat.com>, Peter Xu <peterx@redhat.com>,\n \"Maciej S . Szmigiero\" <mail@maciej.szmigiero.name>,\n Juraj Marcin <jmarcin@redhat.com>","Subject":"[PATCH v2 16/16] vfio/migration: Add tracepoints for precopy/stopcopy\n query ioctls","Date":"Tue, 21 Apr 2026 16:21:10 -0400","Message-ID":"<20260421202110.306051-17-peterx@redhat.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260421202110.306051-1-peterx@redhat.com>","References":"<20260421202110.306051-1-peterx@redhat.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001,\n 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","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"Add two tracepoints for both precopy and stopcopy query ioctls.  When at\nit, add one warn_report_once() for each of them when it fails.\n\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n hw/vfio/migration.c  | 33 +++++++++++++++++++++++----------\n hw/vfio/trace-events |  2 ++\n 2 files changed, 25 insertions(+), 10 deletions(-)","diff":"diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c\nindex e6e6a0d53d..04d9f94edb 100644\n--- a/hw/vfio/migration.c\n+++ b/hw/vfio/migration.c\n@@ -329,6 +329,7 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)\n     struct vfio_device_feature_mig_data_size *mig_data_size =\n         (struct vfio_device_feature_mig_data_size *)feature->data;\n     VFIOMigration *migration = vbasedev->migration;\n+    int ret;\n \n     feature->argsz = sizeof(buf);\n     feature->flags =\n@@ -340,12 +341,18 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)\n          * is reported so downtime limit won't be violated.\n          */\n         migration->stopcopy_size = VFIO_MIG_STOP_COPY_SIZE;\n-        return -errno;\n+        ret = -errno;\n+        warn_report_once(\"VFIO device %s ioctl(VFIO_DEVICE_FEATURE) on \"\n+                         \"VFIO_DEVICE_FEATURE_MIG_DATA_SIZE failed (%d)\",\n+                         vbasedev->name, ret);\n+    } else {\n+        migration->stopcopy_size = mig_data_size->stop_copy_length;\n+        ret = 0;\n     }\n \n-    migration->stopcopy_size = mig_data_size->stop_copy_length;\n+    trace_vfio_query_stop_copy_size(migration->stopcopy_size, ret);\n \n-    return 0;\n+    return ret;\n }\n \n static int vfio_query_precopy_size(VFIOMigration *migration)\n@@ -353,18 +360,24 @@ static int vfio_query_precopy_size(VFIOMigration *migration)\n     struct vfio_precopy_info precopy = {\n         .argsz = sizeof(precopy),\n     };\n-\n-    migration->precopy_init_size = 0;\n-    migration->precopy_dirty_size = 0;\n+    int ret;\n \n     if (ioctl(migration->data_fd, VFIO_MIG_GET_PRECOPY_INFO, &precopy)) {\n-        return -errno;\n+        migration->precopy_init_size = 0;\n+        migration->precopy_dirty_size = 0;\n+        ret = -errno;\n+        warn_report_once(\"VFIO device %s ioctl(VFIO_MIG_GET_PRECOPY_INFO) \"\n+                         \"failed (%d)\", migration->vbasedev->name, ret);\n+    } else {\n+        migration->precopy_init_size = precopy.initial_bytes;\n+        migration->precopy_dirty_size = precopy.dirty_bytes;\n+        ret = 0;\n     }\n \n-    migration->precopy_init_size = precopy.initial_bytes;\n-    migration->precopy_dirty_size = precopy.dirty_bytes;\n+    trace_vfio_query_precopy_size(migration->precopy_init_size,\n+                                  migration->precopy_dirty_size, ret);\n \n-    return 0;\n+    return ret;\n }\n \n /* Returns the size of saved data on success and -errno on error */\ndiff --git a/hw/vfio/trace-events b/hw/vfio/trace-events\nindex 287df0b8cb..854a7e4b19 100644\n--- a/hw/vfio/trace-events\n+++ b/hw/vfio/trace-events\n@@ -176,6 +176,8 @@ vfio_save_setup(const char *name, uint64_t data_buffer_size) \" (%s) data buffer\n vfio_state_pending(const char *name, uint64_t stopcopy_size, uint64_t precopy_init_size, uint64_t precopy_dirty_size, bool exact) \" (%s) stopcopy size %\"PRIu64\" precopy initial size %\"PRIu64\" precopy dirty size %\"PRIu64 \" exact %d\"\n vfio_vmstate_change(const char *name, int running, const char *reason, const char *dev_state) \" (%s) running %d reason %s device state %s\"\n vfio_vmstate_change_prepare(const char *name, int running, const char *reason, const char *dev_state) \" (%s) running %d reason %s device state %s\"\n+vfio_query_stop_copy_size(uint64_t size, int ret) \"stopcopy size %\"PRIu64\" ret %d\"\n+vfio_query_precopy_size(uint64_t init_size, uint64_t dirty_size, int ret) \"init %\"PRIu64\" dirty %\"PRIu64\" ret %d\"\n \n #iommufd.c\n \n","prefixes":["v2","16/16"]}