From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D3CFCAC583 for ; Tue, 9 Sep 2025 12:59:42 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvxw7-0006IQ-KM; Tue, 09 Sep 2025 08:59:03 -0400 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 1uvv1c-00009I-QY; Tue, 09 Sep 2025 05:52:33 -0400 Received: from [115.124.30.110] (helo=out30-110.freemail.mail.aliyun.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvv1W-00033l-8D; Tue, 09 Sep 2025 05:52:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1757411532; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To; bh=nfDetlgS9OsRePzytZ5CrucLP3K8G7i9gm4I1G0/Byk=; b=P1AoaAseYjmxIj90ZthDJvwTs4+ljbi/lDT7bpy9WWPmfzQz0PQP2tYnRpd0727uIrQtA5OwiYYu+7Jsz97rA8sbPbQmtTn7LJYRfDMXVlKUfJ1ga6WBbQMxbGjpvcwotlMR2ttU9UqJW7KKUcDklw9SNhmRnrrsWP2a2cZsR2A= Received: from ea134-sw06.eng.xrvm.cn(mailfrom:lyndra@linux.alibaba.com fp:SMTPD_---0WndQHt0_1757411214 cluster:ay36) by smtp.aliyun-inc.com; Tue, 09 Sep 2025 17:46:56 +0800 From: TANG Tiancheng Subject: [PATCH 0/3] Fix RISC-V timer migration issues Date: Tue, 09 Sep 2025 17:46:43 +0800 Message-Id: <20250909-timers-v1-0-7ee18a9d8f4b@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAIP3v2gC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDI1MDSwNL3ZLM3NSiYl1Di2SjZDPzJMNEo0QloOKCotS0zAqwQdGxtbUALsG GylgAAAA= X-Change-ID: 20250909-timers-18c2c67b1a2a To: qemu-devel@nongnu.org Cc: Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , qemu-riscv@nongnu.org, Peter Xu , Fabiano Rosas , TANG Tiancheng X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757411216; l=1771; i=lyndra@linux.alibaba.com; s=20250909; h=from:subject:message-id; bh=HVJJK3J+yIQsOTHRh99ZN70+zt2BXgCEEmS/CUsqX48=; b=aw+A96Ce3r2a1IjrEZjrZzNOnaXM7MT3VBsIagyNgCDo70ScpWWpdcsDiCCkPOrKFCVpBJJQk oMIibDNQvvxDfUhukUsjnnFsecdQ4EOhPEvNZr/dNhbEAHIPvA5H2Ww X-Developer-Key: i=lyndra@linux.alibaba.com; a=ed25519; pk=GQh4uOSLVucXGkaZfEuQ956CrYS14cn1TA3N8AiIjBw= X-Host-Lookup-Failed: Reverse DNS lookup failed for 115.124.30.110 (deferred) Received-SPF: pass client-ip=115.124.30.110; envelope-from=lyndra@linux.alibaba.com; helo=out30-110.freemail.mail.aliyun.com X-Spam_score_int: -166 X-Spam_score: -16.7 X-Spam_bar: ---------------- X-Spam_report: (-16.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 09 Sep 2025 08:58:43 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This patch set fixes several timer-related migration issues in QEMU's RISC-V implementation that cause timer events to be lost or behave incorrectly after snapshot save/restore or live migration. The problems addressed are: 1. ACLINT mtimer time_delta not migrated: The time_delta field in RISCVAclintMTimerState was missing from vmstate, causing incorrect mtime values after snapshot restore. This resulted in guest time appearing "frozen" until enough virtual time elapsed to compensate for the offset error. 2. ACLINT mtimer timers array not migrated: Active timer events scheduled via riscv_aclint_mtimer_write_timecmp() were not being migrated, causing pending timer interrupts to be lost after restore. 3. CPU stimer/vstimer not migrated: The S-mode and VS-mode timer pointers in CPURISCVState were missing from vmstate_riscv_cpu, causing supervisor-level timer events to be lost. The patch set introduces a new VMSTATE_TIMER_PTR_VARRAY macro to handle migration of variable-length timer pointer arrays, and adds the missing timer fields to the appropriate vmstate structures. Signed-off-by: TANG Tiancheng --- TANG Tiancheng (3): hw/intc: Save time_delta in RISC-V mtimer VMState hw/intc: Save timers array in RISC-V mtimer VMState target/riscv: Save stimer and vstimer in CPU vmstate hw/intc/riscv_aclint.c | 7 +++++-- include/migration/vmstate.h | 14 ++++++++++++++ target/riscv/machine.c | 25 +++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) --- base-commit: 6a9fa5ef3230a7d51e0d953a59ee9ef10af705b8 change-id: 20250909-timers-18c2c67b1a2a Best regards, -- TANG Tiancheng