From nobody Tue Sep 22 12:01:50 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1778013015; cv=none; d=zohomail.com; s=zohoarc; b=JLfG/w9SKFvRAT0UXPVm6I6VC1iPUaxoskHe/fDEt6CXQEv2m7EoPh2OKVNNckqWam+GjS/b20fICaUW3wTBKX5MSsmCzme0DsoWGvx0mnyBNXrX9xvfvFo69xErEsCYZlyccYlU+hSRmjGmp6r0l+auKQcGPs1tqETcxM/h5Ys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778013015; h=Content-Type: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=ZOv4dkPxbigP2amkOsD1OyD2ureHpWxPWa9Eo8OsVWA=; b=hUmjtI+mSHCK8TOT4ujBA2IL0guaw8QJMtwCR4Pz+UUz3iNhhOHB3md1GcC5cJQ4oA5oD3AArPFFaEfvIfMQU3KB/AXbLUpN6iBVVRL5f7sFeL4JJJeVflj2RICdcFrkGvX8ZF2BhPZMPF9isPs+vPbdeVQtYm+FE3UwHSjClCc= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778013015311219.15517461648562; Tue, 5 May 2026 13:30:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wKMMO-0004c3-2W; Tue, 05 May 2026 16:27:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wKMMK-0004X0-3n for qemu-devel@nongnu.org; Tue, 05 May 2026 16:27:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wKMMH-0002f6-7C for qemu-devel@nongnu.org; Tue, 05 May 2026 16:27:11 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-457-pjZ11YRgOFGhEb71RgYl_A-1; Tue, 05 May 2026 16:27:06 -0400 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-902e1e4f8ccso341009185a.0 for ; Tue, 05 May 2026 13:27:06 -0700 (PDT) Received: from x1.com ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8b53c6b8123sm155283806d6.35.2026.05.05.13.27.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 13:27:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778012827; 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=ZOv4dkPxbigP2amkOsD1OyD2ureHpWxPWa9Eo8OsVWA=; b=c732tGR74BukJZx/YQhdkp/BCRGM60DbD5zLPH0hbWmoKQFtk8lAWNb/j8mn1f7FFgiyZ2 JWuVRpAJH80IKUJrd6eRdePt0Vdgi7kBRBFq1x6c11gEa9yIycUiP9HOeDii9bTPAfPR/1 Kj7l45UZtc5iLGHIQSLdBsmw7jrN5Cg= X-MC-Unique: pjZ11YRgOFGhEb71RgYl_A-1 X-Mimecast-MFC-AGG-ID: pjZ11YRgOFGhEb71RgYl_A_1778012826 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778012825; x=1778617625; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZOv4dkPxbigP2amkOsD1OyD2ureHpWxPWa9Eo8OsVWA=; b=BfCcGKoPXrI/ouYOhelUYpBg+Wf+k1EbRIQgJF/gQXRYyRnmQRG0oA6AdwAee/F6By xoExRXSp9Ash5eR/Ww9SlQUNtSUa8Qfoyidoobx10f30zy2LvLRu1WLGcOD6wLLWUobd 6k/lB5EzPKg1x4FRMcPX80ZrcjK8/osUsM0Z7QGX6uuVS45U13ikGaLYvfd+/GbodBcp kwlXt3an085yOxr1jsFdSiRWZGEg/dnTQhVXEl82IJ0kuVGJMscAMlQQp1nK/pwkFI5X 6et0lheNVdwwTsIvxpGnT5KTIKEqoAxDQz/9mw9R4yiNndYzGT3sdigWSs8xRhkyzsN0 e7MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778012825; x=1778617625; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZOv4dkPxbigP2amkOsD1OyD2ureHpWxPWa9Eo8OsVWA=; b=dxQfmEEyS4YLpH3LwbHFZ2y2LJqhFmf5gkFwVQ/pi/HjL60/ZXWz8+kum9imWSouu5 7xcysXZdbchGSFkOrFSoQCE/0iWuxoDi1+22ddh8jwmEyPk0Iemxh/rJSxYPYhqmFHw0 qj+HvFp0Ac7F2kBJ2fSuM/FrTEXM+WbCyeNTVdZJHt6KdWM9RN0MtMVAWfHeMrSJ3LRG Me3Uw0lHp3wG3+ms8ss7EXqtpWIZzKYTPdCiGLk3sgJF+sfXoJVDBjDyU8wxFztQ8EXx Z0oX1ZA1Ke0RCLj/FUyBuChMboJMLtyB0p1/Q7tQ4aAu7oSftLtp7gdeuAnAhPYpI917 xLtg== X-Gm-Message-State: AOJu0Yzs8sTpMPpYYFiVQ2+3nn2vUICBQHYQT10RhTk6FZr4uPY/zgsJ DMsFJLBs0ICh8kg1Q1XGjopsi/t4mvDjPyXGinyfhM22guIj324HVUL6k0Jm/r3TKJ1cjoggO/1 8XUv2r8P8KD3Ah2o5ohO0KrZi3iFbaw1K4bezU0tT8Bs20bYFQqsMd9S9HTNzfot7YRK7iK9h4T Ja0GArs3EykPv+sNMUSn7/bFy6JKWOexy3HqHuSA== X-Gm-Gg: AeBDievwjsBvO17oJlxVMX7OpQEkGP4SbWLUnri3XqzZbVA0zoKrUkJyiTnXreFwrhW IqkEjemZV9qlsZtikrOS1f21Ih+3h4lcNCuQSmO/5k9rzAOQUvRarjxtr+4IKmpHV7n8zumEJya fbQIy0mTg7A+xSZm2H5koE9KaC79B9E1v8gXm++tndjAgULryjxLtCHY/y4JRSrM0OX1W+j7MXn b4d5wqIpY1cLB2KUJFIGb4P6M9kUIEnpBGYlkrfg6uiTnEkOMwNvgLgpaYs4SI9eKzx0JHrdWMw qOPdUiVj6RyYJPZu6sfgd02LduhOTiDQ5UFENOj8GUwL5D1oOPX9IoaJYRj8t/kEa4f3oaQxooj jbm/Lyypl9JcnJy6cnYNflYYaLuR+89hIZLnHsQt/0H5qMWG4bHNXReo= X-Received: by 2002:a05:620a:280e:b0:8f0:10b0:9e4a with SMTP id af79cd13be357-904d6fcc196mr91062185a.57.1778012825154; Tue, 05 May 2026 13:27:05 -0700 (PDT) X-Received: by 2002:a05:620a:280e:b0:8f0:10b0:9e4a with SMTP id af79cd13be357-904d6fcc196mr91057385a.57.1778012824538; Tue, 05 May 2026 13:27:04 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Paolo Bonzini , Peter Xu , Avihai Horon , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 18/23] vfio/migration: Add tracepoints for precopy/stopcopy query ioctls Date: Tue, 5 May 2026 16:26:35 -0400 Message-ID: <20260505202640.1011006-19-peterx@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260505202640.1011006-1-peterx@redhat.com> References: <20260505202640.1011006-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.443, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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 Precedence: list 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 @redhat.com) X-ZM-MESSAGEID: 1778013016538154100 Add two tracepoints for both precopy and stopcopy query ioctls. When at it, add one warn_report_once() for each of them when it fails. Reviewed-by: Avihai Horon Tested-by: C=C3=A9dric Le Goater Reviewed-by: C=C3=A9dric Le Goater Link: https://lore.kernel.org/r/20260421202110.306051-17-peterx@redhat.com Signed-off-by: Peter Xu --- hw/vfio/migration.c | 35 +++++++++++++++++++++++++---------- hw/vfio/trace-events | 2 ++ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index e6e6a0d53d..150e28656e 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -329,6 +329,7 @@ static int vfio_query_stop_copy_size(VFIODevice *vbased= ev) struct vfio_device_feature_mig_data_size *mig_data_size =3D (struct vfio_device_feature_mig_data_size *)feature->data; VFIOMigration *migration =3D vbasedev->migration; + int ret; =20 feature->argsz =3D sizeof(buf); feature->flags =3D @@ -340,12 +341,19 @@ static int vfio_query_stop_copy_size(VFIODevice *vbas= edev) * is reported so downtime limit won't be violated. */ migration->stopcopy_size =3D VFIO_MIG_STOP_COPY_SIZE; - return -errno; + ret =3D -errno; + warn_report_once("VFIO device %s ioctl(VFIO_DEVICE_FEATURE) on " + "VFIO_DEVICE_FEATURE_MIG_DATA_SIZE failed (%d)", + vbasedev->name, ret); + } else { + migration->stopcopy_size =3D mig_data_size->stop_copy_length; + ret =3D 0; } =20 - migration->stopcopy_size =3D mig_data_size->stop_copy_length; + trace_vfio_query_stop_copy_size(vbasedev->name, + migration->stopcopy_size, ret); =20 - return 0; + return ret; } =20 static int vfio_query_precopy_size(VFIOMigration *migration) @@ -353,18 +361,25 @@ static int vfio_query_precopy_size(VFIOMigration *mig= ration) struct vfio_precopy_info precopy =3D { .argsz =3D sizeof(precopy), }; - - migration->precopy_init_size =3D 0; - migration->precopy_dirty_size =3D 0; + int ret; =20 if (ioctl(migration->data_fd, VFIO_MIG_GET_PRECOPY_INFO, &precopy)) { - return -errno; + migration->precopy_init_size =3D 0; + migration->precopy_dirty_size =3D 0; + ret =3D -errno; + warn_report_once("VFIO device %s ioctl(VFIO_MIG_GET_PRECOPY_INFO) " + "failed (%d)", migration->vbasedev->name, ret); + } else { + migration->precopy_init_size =3D precopy.initial_bytes; + migration->precopy_dirty_size =3D precopy.dirty_bytes; + ret =3D 0; } =20 - migration->precopy_init_size =3D precopy.initial_bytes; - migration->precopy_dirty_size =3D precopy.dirty_bytes; + trace_vfio_query_precopy_size(migration->vbasedev->name, + migration->precopy_init_size, + migration->precopy_dirty_size, ret); =20 - return 0; + return ret; } =20 /* Returns the size of saved data on success and -errno on error */ diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index 287df0b8cb..2049159015 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -162,6 +162,8 @@ vfio_migration_realize(const char *name) " (%s)" vfio_migration_set_device_state(const char *name, const char *state) " (%s= ) state %s" vfio_migration_set_state(const char *name, const char *new_state, const ch= ar *recover_state) " (%s) new state %s, recover state %s" vfio_migration_state_notifier(const char *name, int state) " (%s) state %d" +vfio_query_precopy_size(const char *name, uint64_t init_size, uint64_t dir= ty_size, int ret) " (%s) init %"PRIu64" dirty %"PRIu64" ret %d" +vfio_query_stop_copy_size(const char *name, uint64_t size, int ret) " (%s)= stopcopy size %"PRIu64" ret %d" vfio_save_block(const char *name, int data_size) " (%s) data_size %d" vfio_save_block_precopy_empty_hit(const char *name) " (%s)" vfio_save_cleanup(const char *name) " (%s)" --=20 2.53.0