From nobody Thu Apr 16 20:01:29 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=1772100202; cv=none; d=zohomail.com; s=zohoarc; b=OxU4Q5QzN8ulNFHZ4gNdg9utkVmt2yXmhMUcmIWF5fA6RT16QsGx1Y86I5icWJhL3psnGejpa84zvWta5fDP95vKKUb3W/AuT/A+N3c2yVFwx3KT/4PpC/k9wKZXV4iDP08vMrWFQKV4l2Ytyz1j4n4VtjQnhIWocNEsCSbxPM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772100202; h=Content-Transfer-Encoding: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:Cc; bh=fAwlq+9xVqaFn5n00aKeNQJ+WKDlqnxMclidobx3qgY=; b=h1KoKEf7YUqWZnqwPGmEFF6j4TJy69kLmjyDjzJpO+Al5or41qk6nGEEdbU+7dV9ilrqMnVeRn/CqE5CxROgeg+0XclnjC714oYKhRpC9BZqaxoNgbamMLn9GXHcPMROsn+cAbX/ute57IFP5YAReExIAX2H6F/VA1uV9STTnN4= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772100202663134.50752444634134; Thu, 26 Feb 2026 02:03:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vvYCn-0003V5-Ta; Thu, 26 Feb 2026 05:02:49 -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 1vvYCl-0003Ta-RY for qemu-devel@nongnu.org; Thu, 26 Feb 2026 05:02:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vvYCk-0000XJ-Ea for qemu-devel@nongnu.org; Thu, 26 Feb 2026 05:02:47 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-676-gY4-yE2BOfaO6S4cdCXSnw-1; Thu, 26 Feb 2026 05:02:44 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1C6E21800465; Thu, 26 Feb 2026 10:02:43 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.44.35.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 021AE1800671; Thu, 26 Feb 2026 10:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772100165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fAwlq+9xVqaFn5n00aKeNQJ+WKDlqnxMclidobx3qgY=; b=Fjm8ixoK9kVuVUeySKHl4oJwjKnM6L/OgltDQw7f49INGs9VNr6dfSk8uJW+IkiWVapxvw 9O5R0XGUqMg+5cKesM74P72uIEuCj6SKfxjPTv75oE4jaCM3bdR9EQo965JSBrqz+5Ah5s KPcI6gXLIoWpO3OMVAFEA8kjT1bXPPI= X-MC-Unique: gY4-yE2BOfaO6S4cdCXSnw-1 X-Mimecast-MFC-AGG-ID: gY4-yE2BOfaO6S4cdCXSnw_1772100163 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, cohuck@redhat.com, sebott@redhat.com, peterx@redhat.com, philmd@linaro.org, alex.bennee@linaro.org Subject: [PATCH 1/5] vmstate: Introduce VMSTATE_VARRAY_INT32_ALLOC Date: Thu, 26 Feb 2026 11:01:29 +0100 Message-ID: <20260226100232.500781-2-eric.auger@redhat.com> In-Reply-To: <20260226100232.500781-1-eric.auger@redhat.com> References: <20260226100232.500781-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.734, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.78, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772100203327158500 Content-Type: text/plain; charset="utf-8" Already existing VMSTATE_VARRAY_INT32 requires an array to be pre-allocated, however there are cases when the size is not known in advance and there is no real need to enforce it. Introduce VMSTATE_VARRAY_INT32_ALLOC as we currently have for UINT32 and UINT16. The first user of this variant will be the target/arm/machine.c cpreg indexes/values arrays. Signed-off-by: Eric Auger Suggested-by: Peter Maydell Reviewed-by: Peter Maydell Reviewed-by: Peter Xu --- include/migration/vmstate.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 89f9f49d20a..62c2abd0c49 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -447,6 +447,16 @@ extern const VMStateInfo vmstate_info_qlist; .offset =3D vmstate_offset_pointer(_state, _field, _type), \ } =20 +#define VMSTATE_VARRAY_INT32_ALLOC(_field, _state, _field_num, _version, _= info, _type) {\ + .name =3D (stringify(_field)), \ + .version_id =3D (_version), \ + .num_offset =3D vmstate_offset_value(_state, _field_num, int32_t), \ + .info =3D &(_info), \ + .size =3D sizeof(_type), \ + .flags =3D VMS_VARRAY_INT32 | VMS_POINTER | VMS_ALLOC, \ + .offset =3D vmstate_offset_pointer(_state, _field, _type), \ +} + #define VMSTATE_VARRAY_UINT32_ALLOC(_field, _state, _field_num, _version, = _info, _type) {\ .name =3D (stringify(_field)), \ .version_id =3D (_version), \ --=20 2.53.0 From nobody Thu Apr 16 20:01:29 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=1772100259; cv=none; d=zohomail.com; s=zohoarc; b=h8iLRrKNar1Q5b7Xg7XpJsnEcvL8YTU6sG7Q5iz1B9NhA5V2aUp5+iA7RnIXD7wXpY5ANUJda5oASWiy5ZHnEuuDskYm44aWkNuZKdBO8UbhNJUKrc1L5K0e/0fcFtA2ETIcQsup9PAh77wbwBdWIBOj/qLKnPv7WHptKLjLsQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772100259; h=Content-Transfer-Encoding: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:Cc; bh=u9Y0uHcGY2M9/Y7Y8tPz+t9U4uOAS3MeY40EsxfBOwI=; b=DTbyYg/N3k6RrL6vav3PSLB+X8oRUf9ezjz2cuTC4O55kZ9iSLaHOvfMnVdOaytmh0pHQ3yvlSrmWhqPv5Z1ARWv0dC8grCocrtMOxoHjhtzXk3R3F9In7IiD8qoB8fmIqWtQQYksSvkghVlD3HXaL9efBU26ZPbQwHTyvQgwrU= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177210025964721.847141998438588; Thu, 26 Feb 2026 02:04:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vvYD0-0003Xd-5v; Thu, 26 Feb 2026 05:03:02 -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 1vvYCs-0003WQ-9K for qemu-devel@nongnu.org; Thu, 26 Feb 2026 05:02:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vvYCq-0000YJ-Nf for qemu-devel@nongnu.org; Thu, 26 Feb 2026 05:02:53 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-412-63pCFaxbOSGqbIZxsD0THw-1; Thu, 26 Feb 2026 05:02:47 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8CB8C19560A6; Thu, 26 Feb 2026 10:02:46 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.44.35.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 91D951800370; Thu, 26 Feb 2026 10:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772100172; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u9Y0uHcGY2M9/Y7Y8tPz+t9U4uOAS3MeY40EsxfBOwI=; b=bbqrWZnNwzaevYu8fa6FP+WHMKkuyh8hyG80EmOPTURRxGh9bQvcAYm5sbvg0kVH2Lnshd KVLPIPkAu/CpVbHiJPfVvSMCxJhDFhBe5I3bHzYK0HouDscxZysjJLMZCrCJzs3NdsYk5n zM2Q8s02o38ydtEq0m8DlPpiyghniMA= X-MC-Unique: 63pCFaxbOSGqbIZxsD0THw-1 X-Mimecast-MFC-AGG-ID: 63pCFaxbOSGqbIZxsD0THw_1772100166 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, cohuck@redhat.com, sebott@redhat.com, peterx@redhat.com, philmd@linaro.org, alex.bennee@linaro.org Subject: [PATCH 2/5] target/arm/machine: Use VMSTATE_VARRAY_INT32_ALLOC for cpreg arrays Date: Thu, 26 Feb 2026 11:01:30 +0100 Message-ID: <20260226100232.500781-3-eric.auger@redhat.com> In-Reply-To: <20260226100232.500781-1-eric.auger@redhat.com> References: <20260226100232.500781-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 27 X-Spam_score: 2.7 X-Spam_bar: ++ X-Spam_report: (2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.734, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.78, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772100261899158500 Content-Type: text/plain; charset="utf-8" This removes the need for explicitly allocating cpreg_vmstate arrays. On post save we simply point to cpreg arrays and set the length accordingly. Remove VMSTATE_VARRAY_INT32 for cpreg_vmstate_array_len as now the array is dynamically allocated. Also add a trace point on post_load to trace potential mismatch between the number of incoming cpregs versus current ones. Signed-off-by: Eric Auger Suggested-by: Peter Maydell --- target/arm/helper.c | 5 ----- target/arm/kvm.c | 5 ----- target/arm/machine.c | 24 +++++++++++++----------- target/arm/trace-events | 3 +++ 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 6bfab90981c..7389f2988c4 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -265,15 +265,10 @@ void arm_init_cpreg_list(ARMCPU *cpu) if (arraylen) { cpu->cpreg_indexes =3D g_new(uint64_t, arraylen); cpu->cpreg_values =3D g_new(uint64_t, arraylen); - cpu->cpreg_vmstate_indexes =3D g_new(uint64_t, arraylen); - cpu->cpreg_vmstate_values =3D g_new(uint64_t, arraylen); } else { cpu->cpreg_indexes =3D NULL; cpu->cpreg_values =3D NULL; - cpu->cpreg_vmstate_indexes =3D NULL; - cpu->cpreg_vmstate_values =3D NULL; } - cpu->cpreg_vmstate_array_len =3D arraylen; cpu->cpreg_array_len =3D 0; =20 g_hash_table_foreach(cpu->cp_regs, add_cpreg_to_list, cpu); diff --git a/target/arm/kvm.c b/target/arm/kvm.c index ded582e0da0..12a75f42e07 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -807,12 +807,7 @@ static int kvm_arm_init_cpreg_list(ARMCPU *cpu) =20 cpu->cpreg_indexes =3D g_renew(uint64_t, cpu->cpreg_indexes, arraylen); cpu->cpreg_values =3D g_renew(uint64_t, cpu->cpreg_values, arraylen); - cpu->cpreg_vmstate_indexes =3D g_renew(uint64_t, cpu->cpreg_vmstate_in= dexes, - arraylen); - cpu->cpreg_vmstate_values =3D g_renew(uint64_t, cpu->cpreg_vmstate_val= ues, - arraylen); cpu->cpreg_array_len =3D arraylen; - cpu->cpreg_vmstate_array_len =3D arraylen; =20 for (i =3D 0, arraylen =3D 0; i < rlp->n; i++) { uint64_t regidx =3D rlp->reg[i]; diff --git a/target/arm/machine.c b/target/arm/machine.c index bbaae344492..214087111bc 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -1,5 +1,6 @@ #include "qemu/osdep.h" #include "cpu.h" +#include "trace.h" #include "qemu/error-report.h" #include "system/kvm.h" #include "system/tcg.h" @@ -984,11 +985,9 @@ static int cpu_pre_save(void *opaque) } } =20 + cpu->cpreg_vmstate_indexes =3D cpu->cpreg_indexes; + cpu->cpreg_vmstate_values =3D cpu->cpreg_values; cpu->cpreg_vmstate_array_len =3D cpu->cpreg_array_len; - memcpy(cpu->cpreg_vmstate_indexes, cpu->cpreg_indexes, - cpu->cpreg_array_len * sizeof(uint64_t)); - memcpy(cpu->cpreg_vmstate_values, cpu->cpreg_values, - cpu->cpreg_array_len * sizeof(uint64_t)); =20 return 0; } @@ -1043,6 +1042,9 @@ static int cpu_post_load(void *opaque, int version_id) CPUARMState *env =3D &cpu->env; int i, v; =20 + trace_cpu_post_load(cpu->cpreg_vmstate_array_len, + cpu->cpreg_array_len); + /* * Handle migration compatibility from old QEMU which didn't * send the irq-line-state subsection. A QEMU without it did not @@ -1170,13 +1172,13 @@ const VMStateDescription vmstate_arm_cpu =3D { /* The length-check must come before the arrays to avoid * incoming data possibly overflowing the array. */ - VMSTATE_INT32_POSITIVE_LE(cpreg_vmstate_array_len, ARMCPU), - VMSTATE_VARRAY_INT32(cpreg_vmstate_indexes, ARMCPU, - cpreg_vmstate_array_len, - 0, vmstate_info_uint64, uint64_t), - VMSTATE_VARRAY_INT32(cpreg_vmstate_values, ARMCPU, - cpreg_vmstate_array_len, - 0, vmstate_info_uint64, uint64_t), + VMSTATE_INT32(cpreg_vmstate_array_len, ARMCPU), + VMSTATE_VARRAY_INT32_ALLOC(cpreg_vmstate_indexes, ARMCPU, + cpreg_vmstate_array_len, + 0, vmstate_info_uint64, uint64_t), + VMSTATE_VARRAY_INT32_ALLOC(cpreg_vmstate_values, ARMCPU, + cpreg_vmstate_array_len, + 0, vmstate_info_uint64, uint64_t), VMSTATE_UINT64(env.exclusive_addr, ARMCPU), VMSTATE_UINT64(env.exclusive_val, ARMCPU), VMSTATE_UINT64(env.exclusive_high, ARMCPU), diff --git a/target/arm/trace-events b/target/arm/trace-events index 676d29fe516..2de0406f784 100644 --- a/target/arm/trace-events +++ b/target/arm/trace-events @@ -26,3 +26,6 @@ arm_powerctl_reset_cpu(uint64_t mp_aff) "cpu %" PRIu64 =20 # tcg/psci.c and hvf/hvf.c arm_psci_call(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint32_t= cpuid) "PSCI Call x0=3D0x%016"PRIx64" x1=3D0x%016"PRIx64" x2=3D0x%016"PRIx= 64" x3=3D0x%016"PRIx64" cpuid=3D0x%x" + +# machine.c +cpu_post_load(uint32_t cpreg_vmstate_array_len, uint32_t cpreg_array_len) = "cpreg_vmstate_array_len=3D%d cpreg_array_len=3D%d" --=20 2.53.0 From nobody Thu Apr 16 20:01:29 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=1772100207; cv=none; d=zohomail.com; s=zohoarc; b=N7+fFVUc/GSLgJuj/W47v3gKRuqusd4JGDQs9mAFfztVji/SKLXGmOmju4S6w7KtsxkiKajYzIoFrB7e9Xod1ETByQF8gQepAqciTxa3DZ0hMTUYUb6mIxJhRRw6t95yfeQBERe7GIe6YUxlT4nCG4U2AyvHoBRCtv/M7NN/Yfc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772100207; h=Content-Transfer-Encoding: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:Cc; bh=UERnRow78tNXZH3PM/1r8gyTmTmba5HczdNX9vA7D/s=; b=PPazErcrTWs6oZofulCrehsnSlFh66fFbl4VtozZ5MS3LeSrlZQNLb/ZzUlCEwN/Gk30V3ncOg2pzAi/R2oXnnAJpaxnpH9SvjgEaYKvCaVv6k5seoAzI8iGC18Evg+HBxBIMaJRdnucVqDzjSCxzcxh5oCvrw6YqvNBJ2CLH/I= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772100207135511.1107052785053; Thu, 26 Feb 2026 02:03:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vvYD7-0003c1-Cr; Thu, 26 Feb 2026 05:03:12 -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 1vvYCx-0003Xb-5i for qemu-devel@nongnu.org; Thu, 26 Feb 2026 05:03:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vvYCv-0000Yz-Si for qemu-devel@nongnu.org; Thu, 26 Feb 2026 05:02:58 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-592-hsHYZnoTMDq2kcVx44mL_w-1; Thu, 26 Feb 2026 05:02:51 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 183A718003F5; Thu, 26 Feb 2026 10:02:50 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.44.35.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0C8FE1800677; Thu, 26 Feb 2026 10:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772100176; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UERnRow78tNXZH3PM/1r8gyTmTmba5HczdNX9vA7D/s=; b=J6SrcUiqZFmNc7CH+GL8DfTs2y8onj+CB8Kxypi/hywUKWlupXWPwBkAM/1+uLeF7xu0ES 560LTEJ2lwdJE+hXYHKlgnKiUEWLqiRRcdp39LRZJMa5jnYwlUP6d8KYaUnAHgx8BMGp5G f3fpTrxOT2eZT0p45glvu8WqpbIAkhg= X-MC-Unique: hsHYZnoTMDq2kcVx44mL_w-1 X-Mimecast-MFC-AGG-ID: hsHYZnoTMDq2kcVx44mL_w_1772100170 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, cohuck@redhat.com, sebott@redhat.com, peterx@redhat.com, philmd@linaro.org, alex.bennee@linaro.org Subject: [PATCH 3/5] target/arm/kvm: Export kvm_print_register_name() Date: Thu, 26 Feb 2026 11:01:31 +0100 Message-ID: <20260226100232.500781-4-eric.auger@redhat.com> In-Reply-To: <20260226100232.500781-1-eric.auger@redhat.com> References: <20260226100232.500781-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.734, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.78, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772100209290158500 Content-Type: text/plain; charset="utf-8" We want to use kvm_print_register_name() in machine.c so let's export the helper and implement a stub when kvm is not enabled. Signed-off-by: Eric Auger --- target/arm/kvm_arm.h | 2 ++ target/arm/kvm-stub.c | 6 ++++++ target/arm/kvm.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index cc0b374254e..b6980e4957a 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -266,4 +266,6 @@ void arm_cpu_kvm_set_irq(void *arm_cpu, int irq, int le= vel); =20 void arm_gic_cap_kvm_probe(GICCapability *v2, GICCapability *v3); =20 +gchar *kvm_print_register_name(uint64_t regidx); + #endif diff --git a/target/arm/kvm-stub.c b/target/arm/kvm-stub.c index ea67deea520..b13bb055e0e 100644 --- a/target/arm/kvm-stub.c +++ b/target/arm/kvm-stub.c @@ -129,3 +129,9 @@ void arm_gic_cap_kvm_probe(GICCapability *v2, GICCapabi= lity *v3) { g_assert_not_reached(); } + +gchar *kvm_print_register_name(uint64_t regidx) +{ + g_assert_not_reached(); + return NULL; +} diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 12a75f42e07..69efa3e8137 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -913,7 +913,7 @@ static gchar *kvm_print_sve_register_name(uint64_t regi= dx) } } =20 -static gchar *kvm_print_register_name(uint64_t regidx) +gchar *kvm_print_register_name(uint64_t regidx) { switch ((regidx & KVM_REG_ARM_COPROC_MASK)) { case KVM_REG_ARM_CORE: --=20 2.53.0 From nobody Thu Apr 16 20:01:29 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=1772100224; cv=none; d=zohomail.com; s=zohoarc; b=O0z6QO5zwedrY61gj2p6UCW8/O3MLQuOwNHrYcuWXz1mvJLMkxrZcti0KbCGqi4gjeazE8Sm1Z17Nxc87E04qoItJiolwpWtmUKIrTJgOIpSThNPNfk4/iPxJV4yAJyJZ1HYbUY2Dn4QESPRZHiMifCvogoY/F52WmS8CKLtO8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772100224; h=Content-Transfer-Encoding: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:Cc; bh=gEDVHW5aAJI4RFRnTs7B3lugYaQlSzUAPsmk9fsVk58=; b=KZDv+HjPceAIr1Gjg+tRi3STmbDWGJVlZQgXUCWp8yMpQBvd/YCChYqql5tFogn/5Fzhp8UcbEdXWi5Ow4SUO0mQySycZU/cS2NePhi9f3J1I67+EDsEDo+XKrvmc+ZpmurM8E29qGrdylbUpRSKvCVwS2+ulGQ8yOIvII6+IXo= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772100224567871.3019027907523; Thu, 26 Feb 2026 02:03:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vvYDB-0003gK-2j; Thu, 26 Feb 2026 05:03:13 -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 1vvYD3-0003YT-BN for qemu-devel@nongnu.org; Thu, 26 Feb 2026 05:03:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vvYCx-0000ZD-2x for qemu-devel@nongnu.org; Thu, 26 Feb 2026 05:03:02 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-624-Y3OFhGldNnWUtH1Z7FRWZQ-1; Thu, 26 Feb 2026 05:02:54 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 86BDE19560B7; Thu, 26 Feb 2026 10:02:53 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.44.35.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8D1A91800676; Thu, 26 Feb 2026 10:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772100178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gEDVHW5aAJI4RFRnTs7B3lugYaQlSzUAPsmk9fsVk58=; b=WLp6/gMYPcFRCwlrvQD2MvG1zPWRgua+hJVziFm9KWWHO+XvLqM+fgY22Eqf5gLjCo3aFL 7qyqfHsjV2MV0Kvynf0mVXrz5zqXyYOb0MdPZWLYqlD0Od8yGTjm63ieEiQJ+4ipMVjwHf DDNgvglxy9ijewVXQ0SIw/r2wAs3YAI= X-MC-Unique: Y3OFhGldNnWUtH1Z7FRWZQ-1 X-Mimecast-MFC-AGG-ID: Y3OFhGldNnWUtH1Z7FRWZQ_1772100173 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, cohuck@redhat.com, sebott@redhat.com, peterx@redhat.com, philmd@linaro.org, alex.bennee@linaro.org Subject: [PATCH 4/5] target/arm/machine: Trace cpreg names which do not match on migration Date: Thu, 26 Feb 2026 11:01:32 +0100 Message-ID: <20260226100232.500781-5-eric.auger@redhat.com> In-Reply-To: <20260226100232.500781-1-eric.auger@redhat.com> References: <20260226100232.500781-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.133.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 27 X-Spam_score: 2.7 X-Spam_bar: ++ X-Spam_report: (2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.734, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.78, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772100225456158500 Content-Type: text/plain; charset="utf-8" Whenever there is a mismatch between cpreg indexes in the incoming stream and cpregs exposed by the destination output the name of the register. We use a print_register_name() wrapper helper. At the moment we are only able to do a nice decoding of the index for KVM regs. Without this patch, the error would be: qemu-system-aarch64: load of migration failed: Operation not permitted: error while loading state for instance 0x0 of device 'cpu': post load hook failed for: cpu, version_id: 22, minimum_version: 22, ret: -1 which is not helpful for the end user to understand the actual issue. This patch adds the actual information about the probme: qemu-system-aarch64: cpu_post_load: op0:3 op1:0 crn:2 crm:0 op2:3 in the incoming stream but unknown on the destination, fail migration Signed-off-by: Eric Auger Reviewed-by: Peter Maydell --- target/arm/machine.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/target/arm/machine.c b/target/arm/machine.c index 214087111bc..ee68e752ea9 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -1,5 +1,6 @@ #include "qemu/osdep.h" #include "cpu.h" +#include "cpregs.h" #include "trace.h" #include "qemu/error-report.h" #include "system/kvm.h" @@ -1036,6 +1037,15 @@ static int cpu_pre_load(void *opaque) return 0; } =20 +static gchar *print_register_name(uint64_t kvm_regidx) +{ + if (kvm_enabled()) { + return kvm_print_register_name(kvm_regidx); + } else { + return g_strdup_printf("0x%x", kvm_to_cpreg_id(kvm_regidx)); + } +} + static int cpu_post_load(void *opaque, int version_id) { ARMCPU *cpu =3D opaque; @@ -1074,11 +1084,18 @@ static int cpu_post_load(void *opaque, int version_= id) for (i =3D 0, v =3D 0; i < cpu->cpreg_array_len && v < cpu->cpreg_vmstate_array_len; i++) { if (cpu->cpreg_vmstate_indexes[v] > cpu->cpreg_indexes[i]) { - /* register in our list but not incoming : skip it */ + g_autofree gchar *name =3D print_register_name(cpu->cpreg_inde= xes[i]); + + warn_report("%s: %s " + "expected by the destination but not in the incomi= ng stream, " + "skip it", __func__, name); continue; } if (cpu->cpreg_vmstate_indexes[v] < cpu->cpreg_indexes[i]) { - /* register in their list but not ours: fail migration */ + g_autofree gchar *name =3D print_register_name(cpu->cpreg_vmst= ate_indexes[v]); + + error_report("%s: %s in the incoming stream but unknown on the= destination, " + "fail migration", __func__, name); return -1; } /* matching register, copy the value over */ --=20 2.53.0 From nobody Thu Apr 16 20:01:29 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=1772100236; cv=none; d=zohomail.com; s=zohoarc; b=BHNqkKgdg0py4C4frN084LpyqSpjrJf+SDl3ZgGszsIslSBvYo7LRSNJlSQiGToup2f502Lv1AgSJD1JAuSKSdAO0KX+4c8Sf+QVp9nfZUHyrCvcOJyRQ24yv+RawyMVa37JmGySb20WdCZIFbYDrICoLJh6Kl17x3Rf6hv3Cb8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772100236; h=Content-Transfer-Encoding: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:Cc; bh=kufE9pPfhEf1yUFIFrxcGPy83C/DSKq8tZO7XjOggeY=; b=esDi+g+HeRv59W1NHMxajVdCKq8O7RkvykXGGZEIjpYN7BSeIUt3+CqCbLPGZiS/3U1mneLQyzZBvUlV+pzd9HSmCvBIWF3qZFcY7LOko17ueoDOO9f+V+q46rSBECHUN4K9avUKQcOew3qFGCgV0bsw6Bp4Pz7Dy5cl9HeagQ8= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772100236321846.8916290925988; Thu, 26 Feb 2026 02:03:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vvYDF-0003jc-Hl; Thu, 26 Feb 2026 05:03:17 -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 1vvYD4-0003c8-KS for qemu-devel@nongnu.org; Thu, 26 Feb 2026 05:03:06 -0500 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 1vvYD3-0000aX-4O for qemu-devel@nongnu.org; Thu, 26 Feb 2026 05:03:06 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-439-cMAhiU7KMwiXJvdxLBxpkw-1; Thu, 26 Feb 2026 05:02:58 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 71EB418003F6; Thu, 26 Feb 2026 10:02:57 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.44.35.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 07DBF1800370; Thu, 26 Feb 2026 10:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772100182; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kufE9pPfhEf1yUFIFrxcGPy83C/DSKq8tZO7XjOggeY=; b=aa/PiFYrsQXFqUGj5iXd1yKy0wmGUYc/FB88IYovRXNPZ0eJQUapa7QvezLk5LSdNEkATV vybVGhfBM2TOcrWCOBNCBp246qfHublp8FRxjl0c5cFzzfVP5cyxbUSYeA2paPK5BY3K/d 16K+1i51WDRdebG8+YFLwbcm41AXBNk= X-MC-Unique: cMAhiU7KMwiXJvdxLBxpkw-1 X-Mimecast-MFC-AGG-ID: cMAhiU7KMwiXJvdxLBxpkw_1772100177 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, cohuck@redhat.com, sebott@redhat.com, peterx@redhat.com, philmd@linaro.org, alex.bennee@linaro.org Subject: [PATCH 5/5] target/arm/machine: Trace all register mismatches Date: Thu, 26 Feb 2026 11:01:33 +0100 Message-ID: <20260226100232.500781-6-eric.auger@redhat.com> In-Reply-To: <20260226100232.500781-1-eric.auger@redhat.com> References: <20260226100232.500781-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.734, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.78, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772100237528158500 Content-Type: text/plain; charset="utf-8" At the moment, cpu_post_load() exists with error on the first catch of unexpected register in the incoming stream. Let the code go further and trace all the issues before exiting. Signed-off-by: Eric Auger Reviewed-by: Peter Maydell --- target/arm/machine.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/target/arm/machine.c b/target/arm/machine.c index ee68e752ea9..7a3b5a87932 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -1050,6 +1050,7 @@ static int cpu_post_load(void *opaque, int version_id) { ARMCPU *cpu =3D opaque; CPUARMState *env =3D &cpu->env; + bool fail =3D false; int i, v; =20 trace_cpu_post_load(cpu->cpreg_vmstate_array_len, @@ -1082,13 +1083,14 @@ static int cpu_post_load(void *opaque, int version_= id) */ =20 for (i =3D 0, v =3D 0; i < cpu->cpreg_array_len - && v < cpu->cpreg_vmstate_array_len; i++) { + && v < cpu->cpreg_vmstate_array_len;) { if (cpu->cpreg_vmstate_indexes[v] > cpu->cpreg_indexes[i]) { g_autofree gchar *name =3D print_register_name(cpu->cpreg_inde= xes[i]); =20 warn_report("%s: %s " "expected by the destination but not in the incomi= ng stream, " "skip it", __func__, name); + i++; continue; } if (cpu->cpreg_vmstate_indexes[v] < cpu->cpreg_indexes[i]) { @@ -1096,12 +1098,18 @@ static int cpu_post_load(void *opaque, int version_= id) =20 error_report("%s: %s in the incoming stream but unknown on the= destination, " "fail migration", __func__, name); - return -1; + v++; + fail =3D true; + continue; } /* matching register, copy the value over */ cpu->cpreg_values[i] =3D cpu->cpreg_vmstate_values[v]; + i++; v++; } + if (fail) { + return -1; + } =20 if (kvm_enabled()) { if (!kvm_arm_cpu_post_load(cpu)) { --=20 2.53.0