From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710178973; cv=none; d=zohomail.com; s=zohoarc; b=SzMEXcDidW0GaOU5A8GSe2R2LB/lq/C+MhtxUP8CLI01e6janac/6YeE/FmYP+LGHLs0r7jkaXCXqXTExwuyWhqgxGZrxwoD636GfIFmrxZMTe08om5hJGeYyfN/fUchj284NQAUZZi5JbLsT6MMJIqDj4bW5EFQtMKtOgJMA+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710178973; 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=kHni6ZJIfTKQTizI7ELdR6+vUEfkW9RnizQcyJ2jZu8=; b=M9D1nOLLI7bQ+g27/a1/uEvqjGOIWLgPyMnpn8YBg9JfkXFR9Xbf8xaHYUl5Pnv9VULg+UHRLEVXy0cHDVK5FFByhH/m1RaF/hrCNl4KYD5OG0xx4lHXc/RJcbPzyuihDsGIynDsjelwuYEMt8HRiGJU5ICkwh7HN49PdAFMiG8= 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 1710178973780595.846172655107; Mon, 11 Mar 2024 10:42:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjdq-0002Qd-6W; Mon, 11 Mar 2024 13:40:50 -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 1rjjdm-0002Pu-ON for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:40:46 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjdk-0007Ck-KH for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:40:46 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6e6082eab17so4248050b3a.1 for ; Mon, 11 Mar 2024 10:40:44 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.40.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178843; x=1710783643; 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=kHni6ZJIfTKQTizI7ELdR6+vUEfkW9RnizQcyJ2jZu8=; b=nOEa1NF6dEm/3tt2jw6rmEbQyScgAPj0ZP1s8dPRBvCcdAwSmX36n1/PeNAowBJ8t2 zQkH2JtSIis+1RMVFFAn4hANmolDVGSnZfhWCQx2UiDGHSsIgajc7+XqU8emMOoL4nvd 2Uqf/FbNO0FIy9W6QYHYgKTBE3AVoLnPvkSXa7631C+elA5ThVc5qkFzYpISHI+LtpPt Qk9uUfDS9E5qH/K1nmPuSHBY2Sx0/KWLIHwWHMMpKp05qvNS6tZavBHsOwv73yrdZ73k uQ4J48yAPd02pF8ZDVRx8zu4eY7WTfnnO0n2NE+Rn9zFPJsH1rUvuZJykKmkJqp/8bpa lkwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178843; x=1710783643; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kHni6ZJIfTKQTizI7ELdR6+vUEfkW9RnizQcyJ2jZu8=; b=C71RZSVD87Srjj59BU2qkJGe+HRXZs6w5V7i9s4XovhUfYVEEvxnCOozwvXrLeXBl0 u/UtYhYRR7vh3p89qSmOU+uMN6FRrtbi9Ruyei1+r96YUZ2mke2uKRmRTDc5xHnAwAzS FdObgnzhz9YhmdKV7w2NZsO47DD47bzEqz0kCJj6W6DMHucvefoAIJ8sApcRXJ1L6+Di RnCPbfVvsw6hODK/ySK8iPvsMa3wUB6yRcc1u/2ZYgjWBOaj75jo4R3S4NLlXrQl5Qom hHLhyeB9Ew5cgjk3Q2s9OPpAIgxFNu1/JdQ3TWEZBkqjqyG6aEewk7YBuHunVsBukjE6 7Uhg== X-Gm-Message-State: AOJu0YyXaFyUoolzULtjHVoMGa5r1vyeJHpSh0uuVLPs+Aey+0Oyjlt5 BubSufeuPCJNTl5uIsvzcag7egaWRhv4I8hu5LeuS8C2WQEahRl9Mqz5pmrywZA= X-Google-Smtp-Source: AGHT+IFRFW+WGkkROeuTCCTWWBP5ynplXlGgLmz3rqn0zqMol7H9AQnQwrDbbrt5naEpIpJgHJR7AA== X-Received: by 2002:a05:6a20:2d06:b0:1a0:a438:f161 with SMTP id g6-20020a056a202d0600b001a0a438f161mr1291588pzl.25.1710178843077; Mon, 11 Mar 2024 10:40:43 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 01/24] scripts/replay-dump.py: Update to current rr record format Date: Tue, 12 Mar 2024 03:40:03 +1000 Message-ID: <20240311174026.2177152-2-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.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=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=npiggin@gmail.com; helo=mail-pf1-x435.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710178974560100002 The v12 format support for replay-dump has a few issues still. This fixes async decoding; adds event, shutdown, and end decoding; fixes audio in / out events, fixes checkpoint checking of following async events. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Nicholas Piggin --- scripts/replay-dump.py | 127 ++++++++++++++++++++++++++++++----------- 1 file changed, 93 insertions(+), 34 deletions(-) diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py index d668193e79..419ee3257b 100755 --- a/scripts/replay-dump.py +++ b/scripts/replay-dump.py @@ -20,6 +20,7 @@ =20 import argparse import struct +import os from collections import namedtuple from os import path =20 @@ -134,6 +135,17 @@ def swallow_async_qword(eid, name, dumpfile): print(" %s(%d) @ %d" % (name, eid, step_id)) return True =20 +def swallow_bytes(eid, name, dumpfile, nr): + """Swallow nr bytes of data without looking at it""" + dumpfile.seek(nr, os.SEEK_CUR) + +def decode_exception(eid, name, dumpfile): + print_event(eid, name) + return True + +# v12 does away with the additional event byte and encodes it in the main = type +# Between v8 and v9, REPLAY_ASYNC_BH_ONESHOT was added, but we don't decode +# those versions so leave it out. async_decode_table =3D [ Decoder(0, "REPLAY_ASYNC_EVENT_BH", swallow_async= _qword), Decoder(1, "REPLAY_ASYNC_INPUT", decode_unimp), Decoder(2, "REPLAY_ASYNC_INPUT_SYNC", decode_unimp), @@ -142,8 +154,8 @@ def swallow_async_qword(eid, name, dumpfile): Decoder(5, "REPLAY_ASYNC_EVENT_NET", decode_unimp), ] # See replay_read_events/replay_read_event -def decode_async(eid, name, dumpfile): - """Decode an ASYNC event""" +def decode_async_old(eid, name, dumpfile): + """Decode an ASYNC event (pre-v8)""" =20 print_event(eid, name) =20 @@ -157,6 +169,35 @@ def decode_async(eid, name, dumpfile): =20 return call_decode(async_decode_table, async_event_kind, dumpfile) =20 +def decode_async_bh(eid, name, dumpfile): + op_id =3D read_qword(dumpfile) + print_event(eid, name) + return True + +def decode_async_bh_oneshot(eid, name, dumpfile): + op_id =3D read_qword(dumpfile) + print_event(eid, name) + return True + +def decode_async_char_read(eid, name, dumpfile): + char_id =3D read_byte(dumpfile) + size =3D read_dword(dumpfile) + print_event(eid, name, "device:%x chars:%s" % (char_id, dumpfile.read(= size))) + return True + +def decode_async_block(eid, name, dumpfile): + op_id =3D read_qword(dumpfile) + print_event(eid, name) + return True + +def decode_async_net(eid, name, dumpfile): + net_id =3D read_byte(dumpfile) + flags =3D read_dword(dumpfile) + size =3D read_dword(dumpfile) + swallow_bytes(eid, name, dumpfile, size) + print_event(eid, name, "net:%x flags:%x bytes:%d" % (net_id, flags, si= ze)) + return True + total_insns =3D 0 =20 def decode_instruction(eid, name, dumpfile): @@ -166,6 +207,10 @@ def decode_instruction(eid, name, dumpfile): print_event(eid, name, "+ %d -> %d" % (ins_diff, total_insns)) return True =20 +def decode_shutdown(eid, name, dumpfile): + print_event(eid, name) + return True + def decode_char_write(eid, name, dumpfile): res =3D read_dword(dumpfile) offset =3D read_dword(dumpfile) @@ -177,7 +222,7 @@ def decode_audio_out(eid, name, dumpfile): print_event(eid, name, "%d" % (audio_data)) return True =20 -def decode_checkpoint(eid, name, dumpfile): +def __decode_checkpoint(eid, name, dumpfile, old): """Decode a checkpoint. =20 Checkpoints contain a series of async events with their own specific d= ata. @@ -189,14 +234,20 @@ def decode_checkpoint(eid, name, dumpfile): =20 # if the next event is EVENT_ASYNC there are a bunch of # async events to read, otherwise we are done - if next_event !=3D 3: - print_event(eid, name, "no additional data", event_number) - else: + if (old and next_event =3D=3D 3) or (not old and next_event >=3D 3 and= next_event <=3D 9): print_event(eid, name, "more data follows", event_number) + else: + print_event(eid, name, "no additional data", event_number) =20 replay_state.reuse_event(next_event) return True =20 +def decode_checkpoint_old(eid, name, dumpfile): + return __decode_checkpoint(eid, name, dumpfile, False) + +def decode_checkpoint(eid, name, dumpfile): + return __decode_checkpoint(eid, name, dumpfile, True) + def decode_checkpoint_init(eid, name, dumpfile): print_event(eid, name) return True @@ -212,15 +263,23 @@ def decode_clock(eid, name, dumpfile): =20 def decode_random(eid, name, dumpfile): ret =3D read_dword(dumpfile) - data =3D read_array(dumpfile) - print_event(eid, "%d bytes of random data" % len(data)) + size =3D read_dword(dumpfile) + swallow_bytes(eid, name, dumpfile, size) + if (ret): + print_event(eid, name, "%d bytes (getrandom failed)" % (size)) + else: + print_event(eid, name, "%d bytes" % (size)) return True =20 +def decode_end(eid, name, dumpfile): + print_event(eid, name) + return False + # pre-MTTCG merge v5_event_table =3D [Decoder(0, "EVENT_INSTRUCTION", decode_instruction), Decoder(1, "EVENT_INTERRUPT", decode_interrupt), Decoder(2, "EVENT_EXCEPTION", decode_plain), - Decoder(3, "EVENT_ASYNC", decode_async), + Decoder(3, "EVENT_ASYNC", decode_async_old), Decoder(4, "EVENT_SHUTDOWN", decode_unimp), Decoder(5, "EVENT_CHAR_WRITE", decode_char_write), Decoder(6, "EVENT_CHAR_READ_ALL", decode_unimp), @@ -242,7 +301,7 @@ def decode_random(eid, name, dumpfile): v6_event_table =3D [Decoder(0, "EVENT_INSTRUCTION", decode_instruction), Decoder(1, "EVENT_INTERRUPT", decode_interrupt), Decoder(2, "EVENT_EXCEPTION", decode_plain), - Decoder(3, "EVENT_ASYNC", decode_async), + Decoder(3, "EVENT_ASYNC", decode_async_old), Decoder(4, "EVENT_SHUTDOWN", decode_unimp), Decoder(5, "EVENT_CHAR_WRITE", decode_char_write), Decoder(6, "EVENT_CHAR_READ_ALL", decode_unimp), @@ -266,7 +325,7 @@ def decode_random(eid, name, dumpfile): v7_event_table =3D [Decoder(0, "EVENT_INSTRUCTION", decode_instruction), Decoder(1, "EVENT_INTERRUPT", decode_interrupt), Decoder(2, "EVENT_EXCEPTION", decode_unimp), - Decoder(3, "EVENT_ASYNC", decode_async), + Decoder(3, "EVENT_ASYNC", decode_async_old), Decoder(4, "EVENT_SHUTDOWN", decode_unimp), Decoder(5, "EVENT_SHUTDOWN_HOST_ERR", decode_unimp), Decoder(6, "EVENT_SHUTDOWN_HOST_QMP", decode_unimp), @@ -296,32 +355,31 @@ def decode_random(eid, name, dumpfile): =20 v12_event_table =3D [Decoder(0, "EVENT_INSTRUCTION", decode_instruction), Decoder(1, "EVENT_INTERRUPT", decode_interrupt), - Decoder(2, "EVENT_EXCEPTION", decode_plain), - Decoder(3, "EVENT_ASYNC", decode_async), - Decoder(4, "EVENT_ASYNC", decode_async), - Decoder(5, "EVENT_ASYNC", decode_async), - Decoder(6, "EVENT_ASYNC", decode_async), - Decoder(6, "EVENT_ASYNC", decode_async), - Decoder(8, "EVENT_ASYNC", decode_async), - Decoder(9, "EVENT_ASYNC", decode_async), - Decoder(10, "EVENT_ASYNC", decode_async), - Decoder(11, "EVENT_SHUTDOWN", decode_unimp), - Decoder(12, "EVENT_SHUTDOWN_HOST_ERR", decode_unimp), - Decoder(13, "EVENT_SHUTDOWN_HOST_QMP_QUIT", decode_unimp= ), - Decoder(14, "EVENT_SHUTDOWN_HOST_QMP_RESET", decode_unim= p), - Decoder(14, "EVENT_SHUTDOWN_HOST_SIGNAL", decode_unimp), - Decoder(15, "EVENT_SHUTDOWN_HOST_UI", decode_unimp), - Decoder(16, "EVENT_SHUTDOWN_GUEST_SHUTDOWN", decode_unim= p), - Decoder(17, "EVENT_SHUTDOWN_GUEST_RESET", decode_unimp), - Decoder(18, "EVENT_SHUTDOWN_GUEST_PANIC", decode_unimp), - Decoder(19, "EVENT_SHUTDOWN_GUEST_SUBSYSTEM_RESET", deco= de_unimp), - Decoder(20, "EVENT_SHUTDOWN_GUEST_SNAPSHOT_LOAD", decode= _unimp), - Decoder(21, "EVENT_SHUTDOWN___MAX", decode_unimp), + Decoder(2, "EVENT_EXCEPTION", decode_exception), + Decoder(3, "EVENT_ASYNC_BH", decode_async_bh), + Decoder(4, "EVENT_ASYNC_BH_ONESHOT", decode_async_bh_one= shot), + Decoder(5, "EVENT_ASYNC_INPUT", decode_unimp), + Decoder(6, "EVENT_ASYNC_INPUT_SYNC", decode_unimp), + Decoder(7, "EVENT_ASYNC_CHAR_READ", decode_async_char_re= ad), + Decoder(8, "EVENT_ASYNC_BLOCK", decode_async_block), + Decoder(9, "EVENT_ASYNC_NET", decode_async_net), + Decoder(10, "EVENT_SHUTDOWN", decode_shutdown), + Decoder(11, "EVENT_SHUTDOWN_HOST_ERR", decode_shutdown), + Decoder(12, "EVENT_SHUTDOWN_HOST_QMP_QUIT", decode_shutd= own), + Decoder(13, "EVENT_SHUTDOWN_HOST_QMP_RESET", decode_shut= down), + Decoder(14, "EVENT_SHUTDOWN_HOST_SIGNAL", decode_shutdow= n), + Decoder(15, "EVENT_SHUTDOWN_HOST_UI", decode_shutdown), + Decoder(16, "EVENT_SHUTDOWN_GUEST_SHUTDOWN", decode_shut= down), + Decoder(17, "EVENT_SHUTDOWN_GUEST_RESET", decode_shutdow= n), + Decoder(18, "EVENT_SHUTDOWN_GUEST_PANIC", decode_shutdow= n), + Decoder(19, "EVENT_SHUTDOWN_SUBSYS_RESET", decode_shutdo= wn), + Decoder(20, "EVENT_SHUTDOWN_SNAPSHOT_LOAD", decode_shutd= own), + Decoder(21, "EVENT_SHUTDOWN___MAX", decode_shutdown), Decoder(22, "EVENT_CHAR_WRITE", decode_char_write), Decoder(23, "EVENT_CHAR_READ_ALL", decode_unimp), Decoder(24, "EVENT_CHAR_READ_ALL_ERROR", decode_unimp), - Decoder(25, "EVENT_AUDIO_IN", decode_unimp), - Decoder(26, "EVENT_AUDIO_OUT", decode_audio_out), + Decoder(25, "EVENT_AUDIO_OUT", decode_audio_out), + Decoder(26, "EVENT_AUDIO_IN", decode_unimp), Decoder(27, "EVENT_RANDOM", decode_random), Decoder(28, "EVENT_CLOCK_HOST", decode_clock), Decoder(29, "EVENT_CLOCK_VIRTUAL_RT", decode_clock), @@ -334,6 +392,7 @@ def decode_random(eid, name, dumpfile): Decoder(36, "EVENT_CP_CLOCK_VIRTUAL_RT", decode_checkpoi= nt), Decoder(37, "EVENT_CP_INIT", decode_checkpoint_init), Decoder(38, "EVENT_CP_RESET", decode_checkpoint), + Decoder(39, "EVENT_END", decode_end), ] =20 def parse_arguments(): --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710178939; cv=none; d=zohomail.com; s=zohoarc; b=VB6cz9zvhasiq4theiWZOvPV0qvvuwY7EriaTK0w0CV1j4wDoLFCZX0EAKBt/nX0Xpe1NuZ7WG1Bmdke6YfIv+0afWytoKbeVgN1+ILJcAUZyH00HxWQ0ewoMpJ7xnI30EzOmJMY3+vxjUE1Iq9PykGNz41aFeqz6qZEDJSE5+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710178939; 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=SLLsOmMfH6Hic0UmOy3GbMHG10bAawMzfOEyo9niiZA=; b=Hhm3aNoTUzAIVIQ7PGTcRmjhk7imnHS8NFQQ/IHtaT490mFTadzoR9dVwP0obanZxn8hZ/YGwpANRvycsHizJNddsHg2AGC8IhfUMwb5hQz2JqDx9k1QRPMV8JCdC3Mx+/GYG/dyAQN2SqPg9AkN26NxjhggGMjwDZvh9gztFWA= 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 1710178939088744.3919035896882; Mon, 11 Mar 2024 10:42:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjje6-0002RQ-Us; Mon, 11 Mar 2024 13:41:07 -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 1rjjdr-0002Qr-ON for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:40:55 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjdq-0007Em-2V for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:40:51 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6e617b39877so3315635b3a.3 for ; Mon, 11 Mar 2024 10:40:49 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:40:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178848; x=1710783648; 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=SLLsOmMfH6Hic0UmOy3GbMHG10bAawMzfOEyo9niiZA=; b=cN8XEqtXy53TKbiqAz9A4LdMOxqZ4fWU+Kble8POdw8i4HXZv8ISZG2ahxZxJPoMIy lJa3P4j1CNthpLl9UNqF1YjQ46jhr0Riz4yD0MMRFhiLsB81Ocxb3mq6TfO45wG13gH5 y898Oc3yB0F4g4yCxRDFmAvKRscF6WstS/Ih+tQAR3/O0LWMHWhVf0C7rUwg+0DHM/lV 6PpHVy1jrBKVWoYgvllS0+bAO3ScXE+q6LA9boICELxxOOaOmVuz6ryodQrgcABZf1EO hj8JQWG6tOGdT04avO32/1/lgBR98ga0pSqjs0gdmmkH7fVvOJeoQyLeMPQNI/2c171S z0jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178848; x=1710783648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SLLsOmMfH6Hic0UmOy3GbMHG10bAawMzfOEyo9niiZA=; b=ul9ryb8rqUgxBabSimYM5UOiRyoWZ4qp6Qbm5i/X6QcK+U8w6QcxZKwsVzhDcju1kt gmeqrPC1Vu9Lqg0KRv7hppDl+ck3ZZgZ9T5Ec1DvgyYJc697+FuPTwwklb+ggkkeMX0a USbGuwiJPix2w5VBnnGt0xM+99qixw2uCFK3v4l0zdgTlJrESvB9cnqk1IhGt8ygiTTQ CbMzQ3hXCfu7Iy64nA2hs35T9NbO6vCFh7hA3RdK5PjRm5cTneWVEwXda5ggns9vs6g1 cdu5RozNc+05G5U+IUx9MS6FxS7GNRMvPPVr72nmiD1/MtZY0NMeZmiRojIkN+ZgNIqM gG1g== X-Gm-Message-State: AOJu0YwtPmIKkryQOkH2yiICGRtC7JplcNBB7aGZr4GWpbtsqahxVCoY RPfdFjWzPRxe8U/fq+cT6J4Iz21g+FQSAiWPSbhEp5eTC8VYTyKlYIprIk9h8+s= X-Google-Smtp-Source: AGHT+IHDM362me8XuQ5UtEkx6swaUt2CjXepH7skR6Fvw1xUz7/hB84F3jlJID+WEBOiEailxWB7Tw== X-Received: by 2002:a05:6a20:729c:b0:1a3:1595:d3dc with SMTP id o28-20020a056a20729c00b001a31595d3dcmr3265715pzk.46.1710178848307; Mon, 11 Mar 2024 10:40:48 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 02/24] scripts/replay-dump.py: rejig decoders in event number order Date: Tue, 12 Mar 2024 03:40:04 +1000 Message-ID: <20240311174026.2177152-3-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.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=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=npiggin@gmail.com; helo=mail-pf1-x433.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710178940426100009 Sort decoder functions to be ascending in order of event number, same as the decoder tables. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Nicholas Piggin --- scripts/replay-dump.py | 56 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py index 419ee3257b..b82659cfb6 100755 --- a/scripts/replay-dump.py +++ b/scripts/replay-dump.py @@ -139,6 +139,19 @@ def swallow_bytes(eid, name, dumpfile, nr): """Swallow nr bytes of data without looking at it""" dumpfile.seek(nr, os.SEEK_CUR) =20 +total_insns =3D 0 + +def decode_instruction(eid, name, dumpfile): + global total_insns + ins_diff =3D read_dword(dumpfile) + total_insns +=3D ins_diff + print_event(eid, name, "+ %d -> %d" % (ins_diff, total_insns)) + return True + +def decode_interrupt(eid, name, dumpfile): + print_event(eid, name) + return True + def decode_exception(eid, name, dumpfile): print_event(eid, name) return True @@ -198,15 +211,6 @@ def decode_async_net(eid, name, dumpfile): print_event(eid, name, "net:%x flags:%x bytes:%d" % (net_id, flags, si= ze)) return True =20 -total_insns =3D 0 - -def decode_instruction(eid, name, dumpfile): - global total_insns - ins_diff =3D read_dword(dumpfile) - total_insns +=3D ins_diff - print_event(eid, name, "+ %d -> %d" % (ins_diff, total_insns)) - return True - def decode_shutdown(eid, name, dumpfile): print_event(eid, name) return True @@ -222,6 +226,21 @@ def decode_audio_out(eid, name, dumpfile): print_event(eid, name, "%d" % (audio_data)) return True =20 +def decode_random(eid, name, dumpfile): + ret =3D read_dword(dumpfile) + size =3D read_dword(dumpfile) + swallow_bytes(eid, name, dumpfile, size) + if (ret): + print_event(eid, name, "%d bytes (getrandom failed)" % (size)) + else: + print_event(eid, name, "%d bytes" % (size)) + return True + +def decode_clock(eid, name, dumpfile): + clock_data =3D read_qword(dumpfile) + print_event(eid, name, "0x%x" % (clock_data)) + return True + def __decode_checkpoint(eid, name, dumpfile, old): """Decode a checkpoint. =20 @@ -252,25 +271,6 @@ def decode_checkpoint_init(eid, name, dumpfile): print_event(eid, name) return True =20 -def decode_interrupt(eid, name, dumpfile): - print_event(eid, name) - return True - -def decode_clock(eid, name, dumpfile): - clock_data =3D read_qword(dumpfile) - print_event(eid, name, "0x%x" % (clock_data)) - return True - -def decode_random(eid, name, dumpfile): - ret =3D read_dword(dumpfile) - size =3D read_dword(dumpfile) - swallow_bytes(eid, name, dumpfile, size) - if (ret): - print_event(eid, name, "%d bytes (getrandom failed)" % (size)) - else: - print_event(eid, name, "%d bytes" % (size)) - return True - def decode_end(eid, name, dumpfile): print_event(eid, name) return False --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179216; cv=none; d=zohomail.com; s=zohoarc; b=SJtXTq5ctZ5/WZVBLOcxWJEsy6viEi2/1YJm0nSqANFci5VNZoA94xX93hjjBQb9TqFnPWRm5Ge6vucHbCPT/g2bcELG2utbxkLpyCExMIFNiJXo7wq0ghYKBXlvwZ/g6ASw814Z2mQVnnJ8dJxTH42ULRubByjPo6uteUG1hAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179216; 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=t8pTdHOu/KkX0pwRoNGA2mZXJ19/ldsaYMuXilqmIPg=; b=K7GP9CPUtVVxBvQDoXNhb7HiQLPIqrZKxNeJAah89aSysy1keAl9hkrM/ahTNSelBYH9W6MFI6xRyZx2TjpfhayKThyUL3QlBv+FL/LAhZITDOyn0RZftvYtfvKGA7kzt2ZgQ6KfR1D6DDLYn0PL34EuO1uzxOiSRTFpXk0yf8c= 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 171017921657023.793082166245767; Mon, 11 Mar 2024 10:46:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjeA-0002T0-Kf; Mon, 11 Mar 2024 13:41:10 -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 1rjjdy-0002Rd-SG for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:04 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjdv-0007Gi-Dz for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:40:56 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6e5760eeb7aso3333514b3a.1 for ; Mon, 11 Mar 2024 10:40:55 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:40:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178854; x=1710783654; 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=t8pTdHOu/KkX0pwRoNGA2mZXJ19/ldsaYMuXilqmIPg=; b=JelzcW+ML4w6Uiiftu3se+PVGmF1mQhgmO6nyYYe5fis0fUrfzECcEFsR3voqU8ryh 1x6ubPqRRv8LJ8PqG81ecfOMIRzoWDJN3/2H5c8FTpIqofk6yvNlKQmuNKpDkfMb0m2P 1QI3Vym/Vhrzu/9XPhdvsqNmd/2EeO8n+RrSmRS3ftjj0BQgt42cl9JeoPqENC7qW3rO 6HGiJAXpSjrHILolduFsGFbqMMOCMzjPYt+wapnyaejHKJWKAEu8QRkNLSeu21yup9zz sa1JhH9mdcAUG2ux6ToS71H9qKyqE+WZ2Zv8twr+fFjwdQYO0zs0ocstnJyrFxgnS1w6 /Hpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178854; x=1710783654; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t8pTdHOu/KkX0pwRoNGA2mZXJ19/ldsaYMuXilqmIPg=; b=sb67ZqeuKclQM63cO1ZQC6qjtSmhuvluE+JC58UVCP0QKL0sclfapAiSy7UWpEalMd o5FcGMlvrJwEn9goE+UNnDAEv0zar2/rj6m6OVcXnzbsMbaTss1WaDBfSxMNBx/ghOHU K+XH6Tqm6zHsUQrV1j4oLu3RHue8xVZ57ljTrFGxldBh0gI1vOVc7d1W/up61QydreEj 2Mt5S17F6Z+NYic6YZjd50Rv1vlD0nMLwQN3H9xSsQNyah1gKpjOlX4fU1A65rdYDLFF IWUQcB1TbHwxBsHxCGqARdba6Z4A9VSM/bPeudsjSguNA1YJ+PqLGRrefpsK5WM0ntb8 sqUA== X-Gm-Message-State: AOJu0Ywa59yma8Uq94jeXcK4ywnnQShFKndJfdSA/Db112Q94HlXub7M exxiu2PE0A1rxe8Fvnn2GO3ONGmhUWEur79tnz6GkIgZvl5vvFXi3+nJoUsotws= X-Google-Smtp-Source: AGHT+IGh2TZiYexDEXrWEPDhN2KGU3JWtYh+3S9FbRP4OEpZ3EaImwFAwix38Ra+7QCfRql1bNKRAQ== X-Received: by 2002:a05:6a21:1a0:b0:1a1:8c28:c4a0 with SMTP id le32-20020a056a2101a000b001a18c28c4a0mr8694629pzb.30.1710178853701; Mon, 11 Mar 2024 10:40:53 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 03/24] tests/avocado: excercise scripts/replay-dump.py in replay tests Date: Tue, 12 Mar 2024 03:40:05 +1000 Message-ID: <20240311174026.2177152-4-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42c; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42c.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179217401100001 Content-Type: text/plain; charset="utf-8" This runs replay-dump.py after recording a trace, and fails the test if the script fails. replay-dump.py is modified to exit with non-zero if an error is encountered while parsing, to support this. Reviewed-by: Pavel Dovgalyuk Signed-off-by: Nicholas Piggin Reviewed-by: Alex Benn=C3=A9e --- scripts/replay-dump.py | 6 ++++-- tests/avocado/replay_kernel.py | 11 +++++++++++ tests/avocado/replay_linux.py | 10 ++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py index b82659cfb6..4ce7ff51cc 100755 --- a/scripts/replay-dump.py +++ b/scripts/replay-dump.py @@ -21,6 +21,7 @@ import argparse import struct import os +import sys from collections import namedtuple from os import path =20 @@ -100,7 +101,7 @@ def call_decode(table, index, dumpfile): print("Could not decode index: %d" % (index)) print("Entry is: %s" % (decoder)) print("Decode Table is:\n%s" % (table)) - return False + raise(Exception("unknown event")) else: return decoder.fn(decoder.eid, decoder.name, dumpfile) =20 @@ -121,7 +122,7 @@ def print_event(eid, name, string=3DNone, event_count= =3DNone): def decode_unimp(eid, name, _unused_dumpfile): "Unimplemented decoder, will trigger exit" print("%s not handled - will now stop" % (name)) - return False + raise(Exception("unhandled event")) =20 def decode_plain(eid, name, _unused_dumpfile): "Plain events without additional data" @@ -434,6 +435,7 @@ def decode_file(filename): dumpfile) except Exception as inst: print(f"error {inst}") + sys.exit(1) =20 finally: print(f"Reached {dumpfile.tell()} of {dumpsize} bytes") diff --git a/tests/avocado/replay_kernel.py b/tests/avocado/replay_kernel.py index 10d99403a4..2b61ed21d8 100644 --- a/tests/avocado/replay_kernel.py +++ b/tests/avocado/replay_kernel.py @@ -13,6 +13,7 @@ import shutil import logging import time +import subprocess =20 from avocado import skip from avocado import skipUnless @@ -63,6 +64,8 @@ def run_vm(self, kernel_path, kernel_command_line, consol= e_pattern, vm.shutdown() logger.info('finished the recording with log size %s bytes' % os.path.getsize(replay_path)) + self.run_replay_dump(replay_path) + logger.info('successfully tested replay-dump.py') else: vm.wait() logger.info('successfully finished the replay') @@ -70,6 +73,14 @@ def run_vm(self, kernel_path, kernel_command_line, conso= le_pattern, logger.info('elapsed time %.2f sec' % elapsed) return elapsed =20 + def run_replay_dump(self, replay_path): + try: + subprocess.check_call(["./scripts/replay-dump.py", + "-f", replay_path], + stdout=3Dsubprocess.DEVNULL) + except subprocess.CalledProcessError: + self.fail('replay-dump.py failed') + def run_rr(self, kernel_path, kernel_command_line, console_pattern, shift=3D7, args=3DNone): replay_path =3D os.path.join(self.workdir, 'replay.bin') diff --git a/tests/avocado/replay_linux.py b/tests/avocado/replay_linux.py index f3a43dc98c..b3b91ddd9a 100644 --- a/tests/avocado/replay_linux.py +++ b/tests/avocado/replay_linux.py @@ -94,6 +94,8 @@ def launch_and_wait(self, record, args, shift): vm.shutdown() logger.info('finished the recording with log size %s bytes' % os.path.getsize(replay_path)) + self.run_replay_dump(replay_path) + logger.info('successfully tested replay-dump.py') else: vm.event_wait('SHUTDOWN', self.timeout) vm.wait() @@ -108,6 +110,14 @@ def run_rr(self, args=3DNone, shift=3D7): logger =3D logging.getLogger('replay') logger.info('replay overhead {:.2%}'.format(t2 / t1 - 1)) =20 + def run_replay_dump(self, replay_path): + try: + subprocess.check_call(["./scripts/replay-dump.py", + "-f", replay_path], + stdout=3Dsubprocess.DEVNULL) + except subprocess.CalledProcessError: + self.fail('replay-dump.py failed') + @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout') class ReplayLinuxX8664(ReplayLinux): """ --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710178935; cv=none; d=zohomail.com; s=zohoarc; b=W00zigmkRCUgU9nX+yfZg07lfL86kjjX8kEpVM+Qx3xeK7RdD51umkK3GIs8811e8GmP50AHB7iZi0Lnu/ezb9NyOq2iaBxCZiFAOJjDenJJtbu50+htS2nASNKZUQBnl6/3uuLlmYNBmTzKj7D3fXze+jRJF+zIBiN4PVY0g5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710178935; 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=u895+LbS4NiKCuuM6UrCOG79P0KhuQg+ZEmtgS4/K2E=; b=Vnh5eqdFW5dJirG4lzHYZeogsrTSYQHplk34Ka/2y8535znZq65gBCRg3f2Sy7z9q1HH5QGrRzB/f1BRKVpKXCsKyBZpFCDVks/zPmq+AQUhEeTHB3q7U09HgUFWyBa45XY6O2QPyPaqR+tETCdA+Fc7GrymV39wX4GPqWX45DI= 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 1710178935614231.7870638432713; Mon, 11 Mar 2024 10:42:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjeB-0002Ty-IY; Mon, 11 Mar 2024 13:41:11 -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 1rjje7-0002SU-J6 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:07 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjje3-0007IZ-5V for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:06 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e6277f72d8so3092554b3a.1 for ; Mon, 11 Mar 2024 10:41:00 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178859; x=1710783659; 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=u895+LbS4NiKCuuM6UrCOG79P0KhuQg+ZEmtgS4/K2E=; b=MLS+tVtF8tnuE+Wfr9P1XDz8h1rLrSpRAXtrqzZvJ/41h1jsbiwixMAvib4Msgp4B5 AtHpvyLbXsM06QzCHr2meK4DqOhcbPWmYHqz7Mr2YApmoAaEGmF49IcgFqUNaO2xQINx XKh7hdUW8CCEnMuGOo1mzz0nXXcN24hY5hniAnw2DfEZgn63DKCo3WTcT3rZeM/PwDxe DcbYfrw+9KjeqOtOk/WT9Od4b8I1xpgxL1k3jxqoJVTHakHqEWK6byLlnLb9Ymdp1Y7x 9k0zQmqPGXASy2JkuTqdw3U0MK4+pnVrei6P/uB/7oMxVCSy6lX05WVk08l9tHkSeeqj wCjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178859; x=1710783659; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u895+LbS4NiKCuuM6UrCOG79P0KhuQg+ZEmtgS4/K2E=; b=pRlX5KHFaDiaJgYKfc43CGVD6UV7+QyrhaUbyK6WtLtahLKXWB0+CBFOhppz9LrE/8 PZdK4c7YAU788he0qbEWh226Bykk6VshSy+pMM1AlQZ4NxKmFUxVjoaMWVa9f8mPWWxL +kagR46xPCGYuFTNwokKvNQw3qiolVFIE0PNk70wKUKXBkgCOdX7uR4a9hTSs594Omxd 1+k6T3erYYeR1q3HpdnOA+Be8qicO1ozcsFrBnbsxgEphylr9mA6i0x1arQpJbIN2CMm aEmJazHZ6kpPNy/mUZtuxkZAR2WIfXJW0GdC6+cLyVN9IafEAEx8MrgJ+Qfd5Hei7Axn 1YHQ== X-Gm-Message-State: AOJu0YyEWeONnY/TMQWvkJj+K2tT3o/pRtgK/gYsotlwcCKryUJEDqVI mL1fC4nSNuWhuJJVfAspH2G92W5X5MIIi02XKePzSZVG93crdhtgE9kj10ee0QQ= X-Google-Smtp-Source: AGHT+IEvJtFLwNk7l5adFSH5CStdqLWPWCyWd59X/ATmK8V3LZNvontfMQEiEZhm4Iuc33BGdrsHTQ== X-Received: by 2002:a05:6a20:748e:b0:1a1:8ba3:500f with SMTP id p14-20020a056a20748e00b001a18ba3500fmr5491486pzd.31.1710178858883; Mon, 11 Mar 2024 10:40:58 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 04/24] replay: allow runstate shutdown->running when replaying trace Date: Tue, 12 Mar 2024 03:40:06 +1000 Message-ID: <20240311174026.2177152-5-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42d; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42d.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710178936520100001 Content-Type: text/plain; charset="utf-8" When replaying a trace, it is possible to go from shutdown to running with a reverse-debugging step. This can be useful if the problem being debugged triggers a reset or shutdown. This can be tested by making a recording of a machine that shuts down, then using -action shutdown=3Dpause when replaying it. Continuing to the end of the trace then reverse-stepping in gdb crashes due to invalid runstate transition. Just permitting the transition seems to be all that's necessary for reverse-debugging to work well in such a state. Reviewed-by: Pavel Dovgalyuk Signed-off-by: Nicholas Piggin Reviewed-by: Alex Benn=C3=A9e --- include/sysemu/runstate.h | 1 + replay/replay.c | 2 ++ system/runstate.c | 31 ++++++++++++++++++++++++++++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h index 0117d243c4..fe25eed3c0 100644 --- a/include/sysemu/runstate.h +++ b/include/sysemu/runstate.h @@ -9,6 +9,7 @@ void runstate_set(RunState new_state); RunState runstate_get(void); bool runstate_is_running(void); bool runstate_needs_reset(void); +void runstate_replay_enable(void); =20 typedef void VMChangeStateHandler(void *opaque, bool running, RunState sta= te); =20 diff --git a/replay/replay.c b/replay/replay.c index a2c576c16e..b8564a4813 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -385,6 +385,8 @@ static void replay_enable(const char *fname, int mode) replay_fetch_data_kind(); } =20 + runstate_replay_enable(); + replay_init_events(); } =20 diff --git a/system/runstate.c b/system/runstate.c index d6ab860eca..8f9ee034de 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -182,6 +182,12 @@ static const RunStateTransition runstate_transitions_d= ef[] =3D { { RUN_STATE__MAX, RUN_STATE__MAX }, }; =20 +static const RunStateTransition replay_play_runstate_transitions_def[] =3D= { + { RUN_STATE_SHUTDOWN, RUN_STATE_RUNNING}, + + { RUN_STATE__MAX, RUN_STATE__MAX }, +}; + static bool runstate_valid_transitions[RUN_STATE__MAX][RUN_STATE__MAX]; =20 bool runstate_check(RunState state) @@ -189,14 +195,33 @@ bool runstate_check(RunState state) return current_run_state =3D=3D state; } =20 -static void runstate_init(void) +static void transitions_set_valid(const RunStateTransition *rst) { const RunStateTransition *p; =20 - memset(&runstate_valid_transitions, 0, sizeof(runstate_valid_transitio= ns)); - for (p =3D &runstate_transitions_def[0]; p->from !=3D RUN_STATE__MAX; = p++) { + for (p =3D rst; p->from !=3D RUN_STATE__MAX; p++) { runstate_valid_transitions[p->from][p->to] =3D true; } +} + +void runstate_replay_enable(void) +{ + assert(replay_mode !=3D REPLAY_MODE_NONE); + + if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + /* + * When reverse-debugging, it is possible to move state from + * shutdown to running. + */ + transitions_set_valid(&replay_play_runstate_transitions_def[0]); + } +} + +static void runstate_init(void) +{ + memset(&runstate_valid_transitions, 0, sizeof(runstate_valid_transitio= ns)); + + transitions_set_valid(&runstate_transitions_def[0]); =20 qemu_mutex_init(&vmstop_lock); } --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710178967; cv=none; d=zohomail.com; s=zohoarc; b=EBphj2uD80eDeoMcBR3us6sCNiEt3uWDkDSaA9PpvkL9qQyXejhqWe8P4J9y1wwjhKP8MQTG+HHMWn9GpV2zS+OIM2OKsXLoqZsIO1xsole28qF4XnL2kFFdLd1Bqxr/Syglri1+QWdlkrrTVc8tyBlpoE+gGZKYgobdCi+eJms= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710178967; 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=eKpzpXj/rNwSAlMipdDJMEvIfQrihazLg7YHWN/oksU=; b=V5rIvxyeNYwHh3XHUHMFNbTPFq0Ftti1AvD3JUAXbUoON2pG57X37FkyXgTlV4OceFpVCiyNbo5Huby0gUEogTHHBkeSmLsB4PSB3voCqCCaUsJyq3A/OhcQVls/qfCyNpDsWMN6vD3+FOX39Df4Y9Evp+FpsidKVLeMajS9fGc= 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 1710178967652216.5728700433757; Mon, 11 Mar 2024 10:42:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjeD-0002Uw-P2; Mon, 11 Mar 2024 13:41:13 -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 1rjje8-0002Sq-V4 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:09 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjje5-0007Js-Ni for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:08 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6e56787e691so3755341b3a.0 for ; Mon, 11 Mar 2024 10:41:05 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:41:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178864; x=1710783664; 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=eKpzpXj/rNwSAlMipdDJMEvIfQrihazLg7YHWN/oksU=; b=l+eDB8iExD5tDt3AUAn8FmP7dXnOVVDkh685Jz1fIyvEVHuifRD0fm4Lq7ZQCC5nWt 8PmzRd0ijr1SJ8Hn0oTcPXR50ES1pAqBZawNY3Eu3JLcJRs54DUr6YU2+kX7egygrXmA gDtZzlBB7/+5e64Zk8A1chNAa8M3n1I+tFchlr37AmcfVT7XfO8+XX9IN5k3RE9n8WRP ags/YFRtCgX2YJ/p3PU0ZZgxnaXX9eNDtni3Z6e1u9fyXlL60kxDSl+9W3N9zHx5TDas bOg7pGr92K3qBdgOvGKEp5lQDJ5qV3hOtJYQIt6bL+o8Y99pQNv16dwKN9RX3MjtGeO2 nm6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178864; x=1710783664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eKpzpXj/rNwSAlMipdDJMEvIfQrihazLg7YHWN/oksU=; b=D7+4ZQAjlhXGax92PDOLg8WNjqwZMLvmzS0XRETATQqcYkSBCphHNzLkWgZ5Yc8AAj R6+gt0avdkurBJxFVQ0omJ6aQ+sEwh9d0INrZjGLp+VvKJjWvZiWbqxpUTqIJKn9KKat i+5/h8aj1GKHjrAo5swzVl1EXSilASMgt9YdpWFM5lBN9lr8PcCUOQ1fW3Nib2LBTvLs i/Cfwsh32FLkU0FCeahS0Q+LR9jFoExVKLjHxJz7Rql/Rf0IFkUFWRet2mcEZpHIjkjc vBEYV04FfniRd02zl0FnHWfRrRVqoonAqlrIsDc8z3wpQCTzWuC6+RMpWXrKzu5Bwl5Y Xtbg== X-Gm-Message-State: AOJu0Yz65DWEtKUSqT5FapzmHvrOQEqdl/kSbEQcbfsnOctvJs/Z8sUc SKyBHbYMjcEIZCm5446nh0JYU7oFuTRdjRMrZnV7H/iaBTOnbnxb1heNjqIR1gY= X-Google-Smtp-Source: AGHT+IGVSkV4C9Krr6IAQhl1qIMVdGkJISfDIjhbkadkx6jRwjEaCeWdRRz/eAkmoGC3Zrc/WC4JFA== X-Received: by 2002:a05:6a20:438b:b0:1a1:e41:3edb with SMTP id i11-20020a056a20438b00b001a10e413edbmr10109812pzl.11.1710178864007; Mon, 11 Mar 2024 10:41:04 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 05/24] Revert "replay: stop us hanging in rr_wait_io_event" Date: Tue, 12 Mar 2024 03:40:07 +1000 Message-ID: <20240311174026.2177152-6-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::432; envelope-from=npiggin@gmail.com; helo=mail-pf1-x432.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710178968554100001 Content-Type: text/plain; charset="utf-8" This reverts commit 1f881ea4a444ef36a8b6907b0b82be4b3af253a2. That commit causes reverse_debugging.py test failures, and does not seem to solve the root cause of the problem x86-64 still hangs in record/replay tests. The problem with short-cutting the iowait that was taken during record phase is that related events will not get consumed at the same points (e.g., reading the clock). A hang with zero icount always seems to be a symptom of an earlier problem that has caused the recording to become out of synch with the execution and consumption of events by replay. Signed-off-by: Nicholas Piggin --- include/sysemu/replay.h | 5 ----- accel/tcg/tcg-accel-ops-rr.c | 2 +- replay/replay.c | 21 --------------------- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index f229b2109c..8102fa54f0 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -73,11 +73,6 @@ int replay_get_instructions(void); /*! Updates instructions counter in replay mode. */ void replay_account_executed_instructions(void); =20 -/** - * replay_can_wait: check if we should pause for wait-io - */ -bool replay_can_wait(void); - /* Processing clocks and other time sources */ =20 /*! Save the specified clock */ diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index 894e73e52c..a942442a33 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -109,7 +109,7 @@ static void rr_wait_io_event(void) { CPUState *cpu; =20 - while (all_cpu_threads_idle() && replay_can_wait()) { + while (all_cpu_threads_idle()) { rr_stop_kick_timer(); qemu_cond_wait_bql(first_cpu->halt_cond); } diff --git a/replay/replay.c b/replay/replay.c index b8564a4813..895fa6b67a 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -451,27 +451,6 @@ void replay_start(void) replay_enable_events(); } =20 -/* - * For none/record the answer is yes. - */ -bool replay_can_wait(void) -{ - if (replay_mode =3D=3D REPLAY_MODE_PLAY) { - /* - * For playback we shouldn't ever be at a point we wait. If - * the instruction count has reached zero and we have an - * unconsumed event we should go around again and consume it. - */ - if (replay_state.instruction_count =3D=3D 0 && replay_state.has_un= read_data) { - return false; - } else { - replay_sync_error("Playback shouldn't have to iowait"); - } - } - return true; -} - - void replay_finish(void) { if (replay_mode =3D=3D REPLAY_MODE_NONE) { --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179183; cv=none; d=zohomail.com; s=zohoarc; b=ZydCg+GCeWjtK+/JhScwPwJ8GTzatxVXhZxal4B+qu1CjHjpeKgyrO4NlNyTvbExCywdgLMWTcEXm1mbBGbf+UOB9TcoG0cv/8S9wlqSdlEvJHfTuT8pfCu/n5gXh5xCcbGMTcAtJ0dATWGS/wWTwkNLjc1agI38GjDRi1w3BrM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179183; 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=zYd02SLfgP/LCWG+Mrru0HvWw0TZYZU2hsjtTtlA/n0=; b=Jk+7YjR2wOCwUeH0D0DF+l4zoJoOudN+I+O+VWnIh3pznfiaXW037SDCuruXRogjmkq02G+epWWiAi5f+mkd1hjbEivetTFzIBkRhTv6hStdOWcGSRHG2lcB6rjlzA3hsKq61DUkDrvOqa+rip/2ytYjA2Zun9nnOIML3uLgscQ= 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 1710179183376714.6438554751385; Mon, 11 Mar 2024 10:46:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjeE-0002V4-Qi; Mon, 11 Mar 2024 13:41:14 -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 1rjjeC-0002UK-Ly for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:12 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjeA-0007LL-Oj for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:12 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e5a50d91b4so3152525b3a.2 for ; Mon, 11 Mar 2024 10:41:10 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178869; x=1710783669; 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=zYd02SLfgP/LCWG+Mrru0HvWw0TZYZU2hsjtTtlA/n0=; b=gJFtBBXkulb8RBZMXYFemYICx4m0WVqcvgzw5x9zHiO6X9/qyLtGTff0hw3x/iaVg3 SO7lLp/zSC3f0nxbY+T5oT6m7nIXxKhkp19Ls2haNyxKfd7apNFSlakLofGtPxQR+4et qkl2zluO0QgaFtduSAsCJBQV0xiYlQCFAFBl5YhK3VplgjyEAjBMwxQCfilmA407F7B0 2/3Rhi4nQQ3XMXxg6L4mK5AkbwlvSzkvfWAzRlB2/cTBFUZPpcUtCRC+Bg+vPvERnqu3 T1SV5DJ6Y5TfbK4mEpZn0KQ6Qo2E/FvGOBlTgnFfci/va8HhTffxXRZb2c1rHt1FKB/j iDmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178869; x=1710783669; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zYd02SLfgP/LCWG+Mrru0HvWw0TZYZU2hsjtTtlA/n0=; b=jgLq6lmro235JX+3CiAf3/be4aS+cnwvN1cZiRt0L+uzN62V2YABlhg/a+YCQdvhKj 70H4cvPfef/vsvle/HzD/ABH95tUYIKnTR48Ei4UJn1ekP9NJoJMPMbN/86WjzPrD1c3 QqnwrK/T9hrvcPy9LEQs2yQpb8MVCgM8Zoo4Kiow4rVEefDG0I477uPXOb7qqM8eSpP3 fkBachu+eI/yPplv8s2OloIkye533C9MSwr7kVGGhA1XD2F3gNyCbX9WU//63lb+jTwE txllJte7Wh8ghf9f7MsGxQzvGHKWcb5WxeN4+6bix37H2QQaXc0zITT6q1+1enbDgpru 20Mw== X-Gm-Message-State: AOJu0YyARegjDMjjObnZ0ryfJkWdnd7ho7ld+YGFZuW/XLwryFZ14he6 dRdTjWFYfdv4Gff46bqmATeWhU7CId4crSN4vQ4G1MyEaJgn8VH/IAnZBBjwKPc= X-Google-Smtp-Source: AGHT+IFEW4kHNws9S75IZ2FSIr5IIrHrUjMISTYkQyCh5bMdiJVDKOJdfPElSeMvp/3/FIl1qbcYLA== X-Received: by 2002:a05:6a20:6a23:b0:1a1:4e68:30db with SMTP id p35-20020a056a206a2300b001a14e6830dbmr9792704pzk.12.1710178869131; Mon, 11 Mar 2024 10:41:09 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 06/24] chardev: set record/replay on the base device of a muxed device Date: Tue, 12 Mar 2024 03:40:08 +1000 Message-ID: <20240311174026.2177152-7-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42d; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42d.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179185306100007 Content-Type: text/plain; charset="utf-8" chardev events to a muxed device don't get recorded because e.g., qemu_chr_be_write() checks whether the base device has the record flag set. This can be seen when replaying a trace that has characters typed into the console, an examination of the log shows they are not recorded. Setting QEMU_CHAR_FEATURE_REPLAY on the base chardev fixes the problem. Signed-off-by: Nicholas Piggin --- chardev/char.c | 71 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 21 deletions(-) diff --git a/chardev/char.c b/chardev/char.c index 3c43fb1278..ba847b6e9e 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -615,11 +615,24 @@ ChardevBackend *qemu_chr_parse_opts(QemuOpts *opts, E= rror **errp) return backend; } =20 -Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context, - Error **errp) +static void qemu_chardev_set_replay(Chardev *chr, Error **errp) +{ + if (replay_mode !=3D REPLAY_MODE_NONE) { + if (CHARDEV_GET_CLASS(chr)->chr_ioctl) { + error_setg(errp, "Replay: ioctl is not supported " + "for serial devices yet"); + return; + } + qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_REPLAY); + replay_register_char_driver(chr); + } +} + +static Chardev *__qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *con= text, + bool replay, Error **errp) { const ChardevClass *cc; - Chardev *chr =3D NULL; + Chardev *base =3D NULL, *chr =3D NULL; ChardevBackend *backend =3D NULL; const char *name =3D qemu_opt_get(opts, "backend"); const char *id =3D qemu_opts_id(opts); @@ -657,11 +670,11 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMain= Context *context, chr =3D qemu_chardev_new(bid ? bid : id, object_class_get_name(OBJECT_CLASS(cc)), backend, context, errp); - if (chr =3D=3D NULL) { goto out; } =20 + base =3D chr; if (bid) { Chardev *mux; qapi_free_ChardevBackend(backend); @@ -681,11 +694,25 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMain= Context *context, out: qapi_free_ChardevBackend(backend); g_free(bid); + + if (replay && base) { + /* RR should be set on the base device, not the mux */ + qemu_chardev_set_replay(base, errp); + } + return chr; } =20 -Chardev *qemu_chr_new_noreplay(const char *label, const char *filename, - bool permit_mux_mon, GMainContext *context) +Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context, + Error **errp) +{ + /* XXX: should this really not record/replay? */ + return __qemu_chr_new_from_opts(opts, context, false, errp); +} + +static Chardev *__qemu_chr_new(const char *label, const char *filename, + bool permit_mux_mon, GMainContext *context, + bool replay) { const char *p; Chardev *chr; @@ -693,14 +720,22 @@ Chardev *qemu_chr_new_noreplay(const char *label, con= st char *filename, Error *err =3D NULL; =20 if (strstart(filename, "chardev:", &p)) { - return qemu_chr_find(p); + chr =3D qemu_chr_find(p); + if (replay) { + qemu_chardev_set_replay(chr, &err); + if (err) { + error_report_err(err); + return NULL; + } + } + return chr; } =20 opts =3D qemu_chr_parse_compat(label, filename, permit_mux_mon); if (!opts) return NULL; =20 - chr =3D qemu_chr_new_from_opts(opts, context, &err); + chr =3D __qemu_chr_new_from_opts(opts, context, replay, &err); if (!chr) { error_report_err(err); goto out; @@ -722,24 +757,18 @@ out: return chr; } =20 +Chardev *qemu_chr_new_noreplay(const char *label, const char *filename, + bool permit_mux_mon, GMainContext *context) +{ + return __qemu_chr_new(label, filename, permit_mux_mon, context, false); +} + static Chardev *qemu_chr_new_permit_mux_mon(const char *label, const char *filename, bool permit_mux_mon, GMainContext *context) { - Chardev *chr; - chr =3D qemu_chr_new_noreplay(label, filename, permit_mux_mon, context= ); - if (chr) { - if (replay_mode !=3D REPLAY_MODE_NONE) { - qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_REPLAY); - } - if (qemu_chr_replay(chr) && CHARDEV_GET_CLASS(chr)->chr_ioctl) { - error_report("Replay: ioctl is not supported " - "for serial devices yet"); - } - replay_register_char_driver(chr); - } - return chr; + return __qemu_chr_new(label, filename, permit_mux_mon, context, true); } =20 Chardev *qemu_chr_new(const char *label, const char *filename, --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179001; cv=none; d=zohomail.com; s=zohoarc; b=dXDs2+8RSRI9haHYDwLnMnY2p0svVUEJObX/CekUAQxwBBL12i1tm6iQgapqymuO0sgwCjQlQI1maDpfqSKptrraudzkTC88v72+DSrH2ld2of6KpaCCRhyyNTsm14awcqx4OrvIu8IMePeCxzP2sPA5kTpu42kPsNQa0lvMAjM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179001; 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=PCWjPm6O2sZUf84fzY2+POh+rCGK8+L6glbo6RMshm0=; b=hbSMkQ9CEigUGFu9FEDD2En+VAXilBYSZF9jABS0L9fZc47VeP09N+5MgSPaT+IhLychcYkPOVXwi9wuZy9HItdjFgi6LLbvZWkhCt+ayR/ok8O4Nmx4vuGl4LjyQ8JT/7ywdWbRhJvB5Mi9T++QefBxmx2icDW0AMqFXDe82rg= 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 1710179001972815.8818824625223; Mon, 11 Mar 2024 10:43:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjeK-0002WU-Ia; Mon, 11 Mar 2024 13:41:20 -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 1rjjeI-0002Vm-TJ for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:18 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjeH-0007M4-9F for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:18 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5d4d15ec7c5so4060141a12.1 for ; Mon, 11 Mar 2024 10:41:15 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.41.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:41:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178874; x=1710783674; 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=PCWjPm6O2sZUf84fzY2+POh+rCGK8+L6glbo6RMshm0=; b=mB1n85aSaOXTnFSC2rk2VEp1vhGMlVEQKzYQnapI2fIIwyCbbGgjGmM7SAJe9ZNfdB 79gCUlfEKFlSR3K1XRcaqRv9mhG3NV15mwGutDtVQ52MlSnNjKGcg6uy+VRo/hRf6cG8 xNbLN0rexiZXkzJQpc/On1lZcwZrxyqme7NwkFaRwlGHZSl+0k7lIjpH/70sXnLiRXpU MSgAbSLGyfTMSt7DX0iTFFpeJiEwXi9letief63QoR4pMJucpJNitqe57vOrBKGyJ22c r08U0rGOg+I+vi8T5pRcprZ71yPtq3ZH+tf2RMEF13KVAV5XDn0rhj8nTKsQEnU1Pn5y A+lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178874; x=1710783674; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PCWjPm6O2sZUf84fzY2+POh+rCGK8+L6glbo6RMshm0=; b=ey9951eivi3iER6qegCGj7Cv2kbRls99uz9UyxTCYCqUW4ToXJZPJPXFuxnm0eIydF 2EdYOGSRMNDt4vRFePBPjUK6EzIsxF8jDvZWecLSpCxejwtRQ8DZgDawb/olbLkj8q0e Y6INlzNWWRUD6gj6lt/TrLlYlBm2iNGiW9R3Z2gweRncZO4KyzSOB5quRP8bABkLGkbh qJVwt0pMT9DI7lNDiaugFDZOv+VnSbGaRbwF8h+jc9notFtIJ894HkzX6DRG4mmsNglS o2cJhnyTCuNNQOSeFfLfYyAasM4a36fZDa3x1H06T7+ujNkVHE8EjZqY3LT0fPtMVbb/ bTEQ== X-Gm-Message-State: AOJu0Yw2TXjo57zBckImK6hMkXzfWyQ4elIOFHlQchOAv3YU5OLpoQ50 OxnTpV4G1Rdcrlj/wfdfpQzIQhE/UnB5AbglbpMexLL2hGlcXV3NSVF/TnviCQM= X-Google-Smtp-Source: AGHT+IHQBGyuI0PNkFMEaTgllzTwa4TPWe5n+d7d1RG6Pyc/HDM56oFNYNpSexglzhk1h25RW0q5Cg== X-Received: by 2002:a05:6a21:788f:b0:1a1:3ecb:5316 with SMTP id bf15-20020a056a21788f00b001a13ecb5316mr9034133pzc.0.1710178874472; Mon, 11 Mar 2024 10:41:14 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 07/24] replay: Fix migration use of clock Date: Tue, 12 Mar 2024 03:40:09 +1000 Message-ID: <20240311174026.2177152-8-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::530; envelope-from=npiggin@gmail.com; helo=mail-pg1-x530.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179002649100001 Content-Type: text/plain; charset="utf-8" Migration reads host clocks when not holding the replay_mutex, which asserts when recording a trace. It seems that these migration times should be host times like other statistics in MigrationState. These do not require the replay_mutex. Signed-off-by: Nicholas Piggin --- migration/migration.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index a49fcd53ee..86093b34bf 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3405,7 +3405,7 @@ static void *migration_thread(void *opaque) { MigrationState *s =3D opaque; MigrationThread *thread =3D NULL; - int64_t setup_start =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); + int64_t setup_start =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); MigThrError thr_error; bool urgent =3D false; =20 @@ -3457,7 +3457,7 @@ static void *migration_thread(void *opaque) qemu_savevm_wait_unplug(s, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_ACTIVE); =20 - s->setup_time =3D qemu_clock_get_ms(QEMU_CLOCK_HOST) - setup_start; + s->setup_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - setup_start; =20 trace_migration_thread_setup_complete(); =20 @@ -3536,7 +3536,7 @@ static void *bg_migration_thread(void *opaque) =20 migration_rate_set(RATE_LIMIT_DISABLED); =20 - setup_start =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); + setup_start =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); /* * We want to save vmstate for the moment when migration has been * initiated but also we want to save RAM content while VM is running. @@ -3569,7 +3569,7 @@ static void *bg_migration_thread(void *opaque) qemu_savevm_wait_unplug(s, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_ACTIVE); =20 - s->setup_time =3D qemu_clock_get_ms(QEMU_CLOCK_HOST) - setup_start; + s->setup_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - setup_start; =20 trace_migration_thread_setup_complete(); =20 --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179055; cv=none; d=zohomail.com; s=zohoarc; b=bv0UMaMF0kxpq7XL/05zvlXOyPEnWRWb7rjgDaUpeh9Csx4YUjB2NAiigq2RZlo1t3K3Y/GvorkptKRnZOn3CuGTexM8e7ntJUWCs/rmm0GYh1knOjmyAd2PeTnRFC17zi1Tr2kJY7427pqGWpRJYd4EiFDwMdVtMlSgbo4mf5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179055; 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=AMEZpjRyPRfKkDXLG/bfNm8VyDDx9klR1nHqEDUL4Y4=; b=CmzPSA6zQEtR4QD1vhFQa3yhgxImKRVZmRaMbRUrPxP2WJ+m1K+xwaNGoAlbNJVt4Yk9IFTWToFNtqss2nTU06nqGc2A5g8F4JH7/C6hUn2+RsDRxuI81XVchTc1eMJh0iFzfvPbCBQGNt3yIT4FMWbs9XgHVS4UykWZYdmQwBc= 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 1710179055428115.7387345768168; Mon, 11 Mar 2024 10:44:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjeP-0002Xy-2g; Mon, 11 Mar 2024 13:41:25 -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 1rjjeN-0002Xe-JK for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:23 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjeL-0007MR-IS for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:23 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6e617b39877so3316088b3a.3 for ; Mon, 11 Mar 2024 10:41:21 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178880; x=1710783680; 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=AMEZpjRyPRfKkDXLG/bfNm8VyDDx9klR1nHqEDUL4Y4=; b=NoG47XadnOeegq3RUZtOGPpnxz2ibQKaDIjj6ngl1xiocb/mfzTmWrC77WdUxyuo7b 5l+FBtckOf2s5pbKDI3TIMhO5yB5whBwANCIvwh31Ygxoe8jWIgzSdlr4v6LTYc1W8Gh PXyhupP+EDUm4xy80c8nEc6vF8pSNSogUkfPbmKPFl5e0U+yYom/GH/RLbIpDC8j6Fwj U5KGd+QwIssgZL3DbSTfKzLi5cIQSDvWc9mN9WRHnZ5qJK1o2ZRr1XSSKVjxRslFwmPM nM5hZdGd/hXFAaPtndCPcjVvHupFMSFFFfhR+W5c0h+hi/cegBjy5yAeNkVHKrJ2QKAc ZmuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178880; x=1710783680; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AMEZpjRyPRfKkDXLG/bfNm8VyDDx9klR1nHqEDUL4Y4=; b=WYovVl/VEjb2kUSKvci4Xt+9dvALeDrMHR3/CPFWAYB4fb1d+JROJPx93EK7gxEVOf 5jc06R9mpjUNtdaTMNbVNqf82qmSVk6iIdPKEwp1RUy5shRIpif4zvcROxHtuIva7IQL OcLejSlcfaps+LGwTJupeYkqLAhReKFnOVWTBP3lQLTZkVx6UXxmrOaRBXXxwzcHNu9v 1HEROQ5IVCr/P5md6/ud1CUUcML2U1/1iwD06p/b/bnpn1PihiWmADiYVTtI3869I67m 7z3JYtBbHA9jZOeeMOHmLlBXCksAC/BTJDYeNQc07tyQ6t4xFRUIeEVqtyrK7v1dj3GL xJJg== X-Gm-Message-State: AOJu0YzOMsqi0SJQliphQnZ6HpH2DFRD6nQ7c4wskJuEio8I0AYsrqOE pIgLvH/Sch52xlUyApSFhd0aOJsaycuSHahAbMGW9qCC0qjKwJy4oW4zcy3GDSk= X-Google-Smtp-Source: AGHT+IFSbzNsqPBt7WGMkK6pNoGKFww4ClleaAgRSG4GH7Y42cpjHhdZ9x236KQgswFfYshqns8Feg== X-Received: by 2002:a05:6a21:33a1:b0:1a1:6c6c:97d with SMTP id yy33-20020a056a2133a100b001a16c6c097dmr5344619pzb.57.1710178879905; Mon, 11 Mar 2024 10:41:19 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 08/24] replay: Fix migration replay_mutex locking Date: Tue, 12 Mar 2024 03:40:10 +1000 Message-ID: <20240311174026.2177152-9-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::430; envelope-from=npiggin@gmail.com; helo=mail-pf1-x430.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179056781100001 Content-Type: text/plain; charset="utf-8" Migration causes a number of events that need to go in the replay trace, such as vm state transitions. The replay_mutex lock needs to be held for these. The simplest approach seems to be just take it up-front when taking the bql. Signed-off-by: Nicholas Piggin --- migration/migration.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 86093b34bf..7a24f94425 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -24,6 +24,7 @@ #include "socket.h" #include "sysemu/runstate.h" #include "sysemu/sysemu.h" +#include "sysemu/replay.h" #include "sysemu/cpu-throttle.h" #include "rdma.h" #include "ram.h" @@ -2525,6 +2526,7 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) } =20 trace_postcopy_start(); + replay_mutex_lock(); bql_lock(); trace_postcopy_start_set_run(); =20 @@ -2630,6 +2632,7 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) migration_downtime_end(ms); =20 bql_unlock(); + replay_mutex_unlock(); =20 if (migrate_postcopy_ram()) { /* @@ -2671,6 +2674,7 @@ fail: } migration_call_notifiers(ms, MIG_EVENT_PRECOPY_FAILED, NULL); bql_unlock(); + replay_mutex_unlock(); return -1; } =20 @@ -2722,6 +2726,7 @@ static int migration_completion_precopy(MigrationStat= e *s, { int ret; =20 + replay_mutex_lock(); bql_lock(); =20 if (!migrate_mode_is_cpr(s)) { @@ -2747,6 +2752,7 @@ static int migration_completion_precopy(MigrationStat= e *s, s->block_inactive); out_unlock: bql_unlock(); + replay_mutex_unlock(); return ret; } =20 @@ -3573,6 +3579,7 @@ static void *bg_migration_thread(void *opaque) =20 trace_migration_thread_setup_complete(); =20 + replay_mutex_lock(); bql_lock(); =20 if (migration_stop_vm(s, RUN_STATE_PAUSED)) { @@ -3606,6 +3613,7 @@ static void *bg_migration_thread(void *opaque) */ migration_bh_schedule(bg_migration_vm_start_bh, s); bql_unlock(); + replay_mutex_unlock(); =20 while (migration_is_active(s)) { MigIterateState iter_state =3D bg_migration_iteration_run(s); @@ -3635,6 +3643,7 @@ fail: migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); bql_unlock(); + replay_mutex_unlock(); } =20 bg_migration_iteration_finish(s); --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710178937; cv=none; d=zohomail.com; s=zohoarc; b=HIvkY5D6Fvet13xicjUaqyAfezDhhM3GAWdvBC8rbrckUym6DoBlI5R6NIMXKvbh6yrDIyMOEayJVcKntqgg1G6GB11AskBEw7VUOK3g6A580LrJTRDh19fy+9VJVza86Ch7Rv5PdgDYitfAZU2V9zSvtvpM3dvW1Z8OfPbVypQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710178937; 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=KIe47Fwcl7aGXVqbunL4ff4uzd0bDZVnqiv3Rpt/7b0=; b=hg4sxpvhbGIbzyJb23FPovhzSeHl4/6qXTm8ps1p3jMD3id3vYmnGtctpYYG1Sm0nqrahgyBMIJEeyI0E9gANe/60cxL6El1I8PBH1tQeCxxDf4ViBWssJ1AvEhTN2AcKTnq+DCydHocZBAYhOiAyzFKi9lEEq21Oh0yc37p8dM= 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 1710178937544570.9854786450679; Mon, 11 Mar 2024 10:42:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjeU-0002Yq-V1; Mon, 11 Mar 2024 13:41:30 -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 1rjjeS-0002YM-94 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:28 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjeQ-0007Mu-L4 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:27 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6e5eaf5bb3eso3591782b3a.3 for ; Mon, 11 Mar 2024 10:41:26 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178885; x=1710783685; 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=KIe47Fwcl7aGXVqbunL4ff4uzd0bDZVnqiv3Rpt/7b0=; b=Z7t4jNwj2Oc6Yy8ZoVPOLs/CEoxUWo5sTRPpn5AzlamyhU3/mmvAgkgqTJFcuKUNHb bA35yWGzJN2AauFJcfz9cTTgyBwAs7xu/aZt59wy1DQCMwHr4e44AOac70Ioqhb6yNgG a1W2oLF59G5K5o+9k32M1cxQlGkmbke8JM2tKpJHDECSFWAbBXi4cEMoc+q5JSFqG2j/ XGW9J3YAvRs9hImsUmKUuVyDRDWH106YSM+sqtw3nJtwiwjSiDtOl8JlDcNaBAX5eM96 68MF7lNIkc5hT9QV0YneHrc3CwIqE1o33A/5701bw2DcCGvdvm+15phbtG8KBPG9Wlf7 AXew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178885; x=1710783685; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KIe47Fwcl7aGXVqbunL4ff4uzd0bDZVnqiv3Rpt/7b0=; b=mvast2e7ZE6f94hkkAcma23S/2GTSgYRsugr1yAr0ouqUsWpbSLzzEp7DrpPeT286A 7PCEM0fjLb4CJN+0kboLviTHITTEYUXmLbFklxKkrkwvwyqVYSOi8WbYJ0UwRYxaxnx0 i/EXAS5WD/pMROLDA4bsQfwGAYokIyo93sY1aBbBUK6gDYe3dXwtMD1VLju390I2cezo J/MjzLyFTfY8ugN6eKIPueX+bytX8BXjSGjoY4TFICwLjP7G5HWjuslfKc9fPhQmolYJ wOo6UPU/HXZ1x5hr43aJf/2LOiEixW5ZgpbnVgFYrMhgxSBmIgvf9S7mS3Qi+GOgfqpG ERvQ== X-Gm-Message-State: AOJu0YzBi6WCkmDCLg6JqTLRo3x0eZQdnsgDdudyr5Tto+pST27XbKr1 3ec53tfyUfHx0PvWPj9uKhwZtd0GsZwsljRvbgpbzDsymFduXPkFDXc022B5KG8= X-Google-Smtp-Source: AGHT+IExsNqBUHeYWdkUF2ovNXfQoxprvKRcNuCTUrpYd+Yq1nhoNrmlK1iW2Y3V/V6S52GYJHabqw== X-Received: by 2002:a05:6a20:3947:b0:1a1:682d:cc4a with SMTP id r7-20020a056a20394700b001a1682dcc4amr5429779pzg.43.1710178885213; Mon, 11 Mar 2024 10:41:25 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 09/24] virtio-net: Use replay_schedule_bh_event for bhs that affect machine state Date: Tue, 12 Mar 2024 03:40:11 +1000 Message-ID: <20240311174026.2177152-10-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42e; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42e.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710178938480100005 Content-Type: text/plain; charset="utf-8" The regular qemu_bh_schedule() calls result in non-deterministic execution of the bh in record-replay mode, which causes replay failure. Signed-off-by: Nicholas Piggin --- hw/net/virtio-net.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index a3c711b56d..ad12d80677 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -40,6 +40,7 @@ #include "migration/misc.h" #include "standard-headers/linux/ethtool.h" #include "sysemu/sysemu.h" +#include "sysemu/replay.h" #include "trace.h" #include "monitor/qdev.h" #include "hw/pci/pci_device.h" @@ -415,7 +416,7 @@ static void virtio_net_set_status(struct VirtIODevice *= vdev, uint8_t status) timer_mod(q->tx_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + n->= tx_timeout); } else { - qemu_bh_schedule(q->tx_bh); + replay_bh_schedule_event(q->tx_bh); } } else { if (q->tx_timer) { @@ -2668,7 +2669,7 @@ static void virtio_net_tx_complete(NetClientState *nc= , ssize_t len) */ virtio_queue_set_notification(q->tx_vq, 0); if (q->tx_bh) { - qemu_bh_schedule(q->tx_bh); + replay_bh_schedule_event(q->tx_bh); } else { timer_mod(q->tx_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + n->tx_timeou= t); @@ -2823,7 +2824,7 @@ static void virtio_net_handle_tx_bh(VirtIODevice *vde= v, VirtQueue *vq) return; } virtio_queue_set_notification(vq, 0); - qemu_bh_schedule(q->tx_bh); + replay_bh_schedule_event(q->tx_bh); } =20 static void virtio_net_tx_timer(void *opaque) @@ -2906,7 +2907,7 @@ static void virtio_net_tx_bh(void *opaque) /* If we flush a full burst of packets, assume there are * more coming and immediately reschedule */ if (ret >=3D n->tx_burst) { - qemu_bh_schedule(q->tx_bh); + replay_bh_schedule_event(q->tx_bh); q->tx_waiting =3D 1; return; } @@ -2920,7 +2921,7 @@ static void virtio_net_tx_bh(void *opaque) return; } else if (ret > 0) { virtio_queue_set_notification(q->tx_vq, 0); - qemu_bh_schedule(q->tx_bh); + replay_bh_schedule_event(q->tx_bh); q->tx_waiting =3D 1; } } --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179199; cv=none; d=zohomail.com; s=zohoarc; b=VSnk8NtB1IWMvVbjASGxLbsvfR16tlsxPBTmQdD7jWxdS4WZte0nePnbK3lyIevbveDfldgck6WrSUxlzjOVsdufil6kLfJOrqumyHtM8aF9yhrsKFRVGssIAioC47lx8ntEshq5WhA0zFZy3LxtG+nUf9+cOZjWJhzcOyJR6eQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179199; 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=N4Cx0ZaTSrFNoq7rJ39FkSsZPS8YFhgH7P+2DPv9QN4=; b=nILm2ZqWyWOyEzCtjljBP6f3jdcWrsuxfCNB8osNd61KZXRXw9qYNyy1K0YQh5tlLgUqmQjDhC5JbjLHYWrH2XlG5NVkIttla9lQ/nnXrXbBZRIiioqg2wAEI92h+yM5PeCyyD0+v8kqnUijPun7K+EaMMjK9kqO72LbcCbI3EA= 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 1710179199684353.4645149320494; Mon, 11 Mar 2024 10:46:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjea-0002Z9-Il; Mon, 11 Mar 2024 13:41:36 -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 1rjjeY-0002Z0-Qf for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:34 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjeW-0007NI-8f for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:34 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6e627596554so2250876b3a.2 for ; Mon, 11 Mar 2024 10:41:31 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.41.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:41:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178891; x=1710783691; 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=N4Cx0ZaTSrFNoq7rJ39FkSsZPS8YFhgH7P+2DPv9QN4=; b=H/BnlesQf31DiRT2ZExe7QrAHDLSN1Go++WoiI5as4EcgXWKJaXyZwAlmpR37Ojuf8 yLSwjZXmZGox9+G9sY5I10ggmKK/woZLMQgbc2lbvJNV8jZmf5YLvHYvLACx/N46CNVI 460GbP0OMDWww1SlpYlU+WWxFWmkjWISk2mlILfaCbTqUj/8etiFwiJGTs36tjQTYwGl 3QUXs5qAYBMqggXdIdJugKM4iNS5eNNp8EvQt8BvFkYqTmhXsAGkCdz+xtCJTF4tYkTo kZJUXE/AQZ+AeN2Yvbz70znu/GHNPgpCrcbfK2qDF6tkLsuc7eGjW862yejgNhaCzcGv XC3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178891; x=1710783691; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N4Cx0ZaTSrFNoq7rJ39FkSsZPS8YFhgH7P+2DPv9QN4=; b=YpAexDsd95E7IptR/4N4Hl5pMGkMPz9vcmug1B0pqHLltLql0Obq7aXgOKkGT2Bo2L 1Q61PtQNhAXdYdzTPKyyEP5Kq7OAt8TXlDGBZU9ia5PMJdAvKYHR+FrzcTb9+OO/bQNB Irn0KU8G0U7bFD5fFWGbFbKQE/Je6LRZcFCQ/ouuHiGGvZJYCIzjFWk1ZA6Eyxe/PeZe f7gVLsRLNEpPuvCU1tWP5+YcXXiyMKfItD+K/MbruHvO+RhlKRr19eGPHjtw2bLjVa3q n6ACBk8FdphlF1zAWlDRhEdIzl1O73+PaJcpML7C/1DWc3Nk2kjjevF56j+29dLGmmMx HCUw== X-Gm-Message-State: AOJu0YxO6x1EyAyYKokkHZdPpz75QhDpBDlJ4YBqAIJSkrKVjjFB8O9E P8CUM7G1034AAjfr13LftI2uYA4tJmFHJdiOXSTz8ZG3PD67/rGXw6M/tMoVwcc= X-Google-Smtp-Source: AGHT+IE4OFlSOLVpgo5Wr4qd3RiOLb6X6AswktBcaG+MRqpCmwEUSoa8uBJv0Xe78ihuMIFNF241GA== X-Received: by 2002:a05:6a20:6a1d:b0:1a1:72ea:2da9 with SMTP id p29-20020a056a206a1d00b001a172ea2da9mr5835258pzk.19.1710178890752; Mon, 11 Mar 2024 10:41:30 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 10/24] virtio-net: Use virtual time for RSC timers Date: Tue, 12 Mar 2024 03:40:12 +1000 Message-ID: <20240311174026.2177152-11-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42f; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42f.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179201238100003 Content-Type: text/plain; charset="utf-8" Receive coalescing is visible to the target machine, so its timers should use virtual time like other timers in virtio-net, to be compatible with record-replay. Signed-off-by: Nicholas Piggin --- hw/net/virtio-net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index ad12d80677..2ce1d53a0f 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2120,7 +2120,7 @@ static void virtio_net_rsc_purge(void *opq) chain->stat.timer++; if (!QTAILQ_EMPTY(&chain->buffers)) { timer_mod(chain->drain_timer, - qemu_clock_get_ns(QEMU_CLOCK_HOST) + chain->n->rsc_timeout); + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + chain->n->rsc_timeou= t); } } =20 @@ -2356,7 +2356,7 @@ static size_t virtio_net_rsc_do_coalesce(VirtioNetRsc= Chain *chain, chain->stat.empty_cache++; virtio_net_rsc_cache_buf(chain, nc, buf, size); timer_mod(chain->drain_timer, - qemu_clock_get_ns(QEMU_CLOCK_HOST) + chain->n->rsc_timeout); + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + chain->n->rsc_timeou= t); return size; } =20 @@ -2594,7 +2594,7 @@ static VirtioNetRscChain *virtio_net_rsc_lookup_chain= (VirtIONet *n, chain->max_payload =3D VIRTIO_NET_MAX_IP6_PAYLOAD; chain->gso_type =3D VIRTIO_NET_HDR_GSO_TCPV6; } - chain->drain_timer =3D timer_new_ns(QEMU_CLOCK_HOST, + chain->drain_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, virtio_net_rsc_purge, chain); memset(&chain->stat, 0, sizeof(chain->stat)); =20 --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179012; cv=none; d=zohomail.com; s=zohoarc; b=JUaHPbWdzCHKmbB7O1sldUE84p7OGciyoq2vBo0W8IkThHurXxMa/Xk2kgx7IcSsv8wgRONfULD18avuUWGN0XPR/vnfuJBFkhL4Kv2t4q+Nlgcj1Cs1KkBOKX/XI3gnu2UuQdkQN984kQ3WWEYhW+vaLgQimxMIYPyQ2iSXSdc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179012; 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=ypjlmGRHzY0uruaNOcG3LohKyREVxpMddX9iaQbvl0I=; b=Bh51VAyWGQ8w2vnXIEbuZIWgQD5OzXF2G1dYdnnf7Is1cLftu7D1Aw/PvsXth8oPBqSnJDxZu+2VqFuytRq1aozTvcEzRCphYPE5k3VI0vMQ/+07IkV+Jr24PN4cpG8v8su9McC41Ld7tI3uVwZN0bXizrWUmqsribA5wC2qqjc= 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 1710179012402256.1007939523573; Mon, 11 Mar 2024 10:43:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjef-0002bi-S3; Mon, 11 Mar 2024 13:41:41 -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 1rjjee-0002Zc-B9 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:40 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjec-0007Nc-PZ for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:40 -0400 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3bd4e6a7cb0so3004484b6e.3 for ; Mon, 11 Mar 2024 10:41:37 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.41.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:41:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178896; x=1710783696; 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=ypjlmGRHzY0uruaNOcG3LohKyREVxpMddX9iaQbvl0I=; b=Sm/MyGhYAs5i2hfbYnbqYbsyYTP1xMjoaYA3ayweCX4BsscU+g3cUVr+wP7ck6NZ+z LQ9LpCC/cNyXAPBKYXMN6K1C22KxuzbtMQnRjwuUapRpjz6SF1IY+OgT+xpjhiiiNUw4 ldSra8493YjnIbRvv2vTWhX9U2POfOdleNk6rVMM2Vmt+44OjwyzNYx32tsvy+t6BX6F Wn5DgHzYTWEgXVTpw1fnMI4eYLNsN82FXsnvzEw+ESjhcqy8mvmmEQtSCsi12wplEIOX UTf04zUblu6QplheGKgIkG200iKLFxiv4JvSUmns/dKXL9wZXbxOQZij6PrI7mGghRGq jFdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178896; x=1710783696; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ypjlmGRHzY0uruaNOcG3LohKyREVxpMddX9iaQbvl0I=; b=gWUgYZWHacAcJNthbgQW1Q8R76ZOtUr+won9bIF6S+wRtB/a25bHWXOPohoC4cra/+ jFqUhcey8i4NG6H2C0+Bn18phhxOMIVXnwYrm8xgHWc86Z6Azm0oUjCQ5bEnmFI/mHoP WyVe3mbKajwAcvEFlGu3FR0kd1VP+JIiydoIOwJtFQCwNi2VDiL+Z8y81EjP1JSUMiG2 8ccFqp9fC7DSxwXxf7/GRj57bin2QNMbEtIHor4txa2Hig0jYAes/ph8rENbwGJQmxwA 8DjtpeixBlQZkToK2q1QBw4xUaRdRxE00lHcA1rCgl4ohnwDQcweHGDDwUaCqZclFFmS Lwwg== X-Gm-Message-State: AOJu0YyoJmWqLhmHqU9VMsRqC0WT0zk0pKSr0fMThOiqEVZJ5oqZRAOq eI3iyUZDMJy4hqWTLWeEnfPoxJxgjzvXlgkZaKI7XZOGzny50HBF/3F8adDd9aU= X-Google-Smtp-Source: AGHT+IEc5s2/zyTKI8pG6Ai5VuVN1ci5ub1RvUw+Ry01K4ZqbVzzZFBLE9rQ65EOas04vid1hk18Zw== X-Received: by 2002:a05:6808:384d:b0:3c2:3fc6:a05a with SMTP id ej13-20020a056808384d00b003c23fc6a05amr1804850oib.33.1710178896206; Mon, 11 Mar 2024 10:41:36 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 11/24] net: Use virtual time for net announce Date: Tue, 12 Mar 2024 03:40:13 +1000 Message-ID: <20240311174026.2177152-12-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::22c; envelope-from=npiggin@gmail.com; helo=mail-oi1-x22c.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179012670100001 Content-Type: text/plain; charset="utf-8" Using virtual time for announce ensures that guest visible effects are deterministic and don't break replay. Signed-off-by: Nicholas Piggin --- net/announce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/announce.c b/net/announce.c index 9e99044422..70b5d5e822 100644 --- a/net/announce.c +++ b/net/announce.c @@ -187,7 +187,7 @@ static void qemu_announce_self_once(void *opaque) =20 void qemu_announce_self(AnnounceTimer *timer, AnnounceParameters *params) { - qemu_announce_timer_reset(timer, params, QEMU_CLOCK_REALTIME, + qemu_announce_timer_reset(timer, params, QEMU_CLOCK_VIRTUAL, qemu_announce_self_once, timer); if (params->rounds) { qemu_announce_self_once(timer); --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179086; cv=none; d=zohomail.com; s=zohoarc; b=GbbWUi95W4eh+OVcoWqGsw8GBhta7dzS/QOB7FLb1NbIkSDVb6+Yx9I5TwTTKtuDdd0g43OYLOuuJrkNA0T7sDfCeXCUlvr9rZbBkS2kN4NZcIv+OdrhMymyFSROsF91YaN2d8sDUM35CizNuY9Ik8fpeKSh9m+RDcO4znB4zwU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179086; 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=TRcl63k4Enolg0XIOUbcFz2ceM8wzscJs4qT96hKv3M=; b=Nd7CN0SXf9QOKd8E5JmPhZQDkQYeVDD4/L/jLoWXYqDmKZylUzGzDc4L9EOVXHxiwivg7Orc8qzxDOsgFQAqityhE2tO32UoZMkON0Rdp11yS02Lyg04IU1Fx/f2b1QsNXHrW9U9zWSDvwZoyXctwxH/8rsybB7tngpHFkhGz58= 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 1710179086093764.3046555162115; Mon, 11 Mar 2024 10:44:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjez-0002zE-AY; Mon, 11 Mar 2024 13:42:01 -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 1rjjej-0002j7-6v for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:45 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjeh-0007PR-Ji for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:44 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6e5d7f1f25fso2087367b3a.0 for ; Mon, 11 Mar 2024 10:41:43 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.41.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178902; x=1710783702; 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=TRcl63k4Enolg0XIOUbcFz2ceM8wzscJs4qT96hKv3M=; b=gaXKD3ThBCJDUQqQpmtGnxqQtrdY8TNmvgQyI9NhOTG6cOrH42EfVTotCwhDQ1eA0t ceWmXvGLUdRQRkEPa3hPnuXnmUu0AwYb5z6h5hLoS2K0990ouOIvwMdcfHd7l8WPWmb3 EIkj86UUTgvZhWYWRp0DA+tq4I8Zjj9DSFz9hVw0FWZavzgqAPYl40wfMl5q8ofEOcmp HRW3s0h8Tbe6Uw5oUctUw4D2ypopiHiLUUkR+w+Xjn6ls6N/jlvYKOLyZzds5NfvjUI1 iSIBwC/2nCiMaYLafNiPkGk8hg4co0mTFO26+Rg49AndlpWeWYV2vPgAK/SJcwm5mh7C lo3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178902; x=1710783702; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TRcl63k4Enolg0XIOUbcFz2ceM8wzscJs4qT96hKv3M=; b=LNaIDoPoR7JwxQqmw893MbVjKvXw+4MD9jiAo7hEk1xPmUI18R+gZaz6MMt7KSjRjc KBniZBXBvbf5/3ywC+SUoWR9jGQxfx1kuAhFsO36kRPKu5A9wQl3jE/kOUvL8KezgETv yl5Un1jVPb/Tk0gMl1fCkJgqgqN6GynmPTfdyUffYS4Syfh+jeWGO18fxfJIHMbt2vKF Kt+//kGFHjkUtDbc/av3kIxSsbIXpY9Vgr9fXigERayb8AUvGgEnNQHtyzLuPw6bFWTL VpAPQ7+moJ3EKHaSt0ed1teyVz5cwq8SJpbXuCtkqBX5orX3yu02iILLNLHUtE6WiERx EmAw== X-Gm-Message-State: AOJu0Yxv4/iEt2lpOuQj9qXIvyimpiS5edsC5efbgXlkx4kaBp5nPvEJ 2TA/tUEOF0cQomYeJYwlqBWONElJhI2pPWtwT2gDOaSOK7HGxhhXxSCLl18E+dw= X-Google-Smtp-Source: AGHT+IHwg71O/unBd/fPFI8XRs5TXQrJKcPahM8orTDTp4kUgbr5FfeBfckNcFfpp0nJYyeiKBuCbg== X-Received: by 2002:a05:6a00:27a0:b0:6e5:dff8:6e5f with SMTP id bd32-20020a056a0027a000b006e5dff86e5fmr7645519pfb.34.1710178901589; Mon, 11 Mar 2024 10:41:41 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 12/24] savevm: Fix load_snapshot error path crash Date: Tue, 12 Mar 2024 03:40:14 +1000 Message-ID: <20240311174026.2177152-13-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::434; envelope-from=npiggin@gmail.com; helo=mail-pf1-x434.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179086962100001 Content-Type: text/plain; charset="utf-8" An error path missed setting *errp, which can cause a NULL deref. Signed-off-by: Nicholas Piggin --- migration/savevm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/savevm.c b/migration/savevm.c index dc1fb9c0d3..fee9318c06 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -3259,6 +3259,7 @@ bool load_snapshot(const char *name, const char *vmst= ate, /* Don't even try to load empty VM states */ ret =3D bdrv_snapshot_find(bs_vm_state, &sn, name); if (ret < 0) { + error_setg(errp, "Snapshot can not be found"); return false; } else if (sn.vm_state_size =3D=3D 0) { error_setg(errp, "This is a disk-only snapshot. Revert to it " --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179137; cv=none; d=zohomail.com; s=zohoarc; b=oAaoLtbZzsHjM3yFntWI/yr4MEz+quGqUQe9ODaZMHm9Q8TWpMi5sc6xOHe8XYbX+R6+pD5fj3MOfLOeTrv0H1R2DbioSuSvexcC/KixqoEDTN8ykJfYyt7d7CXOqV4EmzzX8TgtDApiZ5sN02VBT1uky18g03lDJmfpw+iyoss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179137; 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=diri3m78EwCD+gDi71O1KOJH/MABv0MOoiXvKOFnIyw=; b=JGt2Iq7KWyU+9E/qRaXzdgJfkGe00/XyOanMhUfRsSPrB2AUPboXST3HJE9sEpi1V2MHUV2FxJ08dD2Kh+OQHhSOItHzN5COlys6cIEWLP4dLWfm3LVU9fpzAyRxEV1uVJOQA89hdP5l5T5LlnXegaPJReYeVuHmVU9a26SB/cE= 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 1710179137610491.46093923716774; Mon, 11 Mar 2024 10:45:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjf0-0003Em-CP; Mon, 11 Mar 2024 13:42:02 -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 1rjjeo-0002yc-Up for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:52 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjen-0007Q6-6t for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:41:50 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6e5eaf5bb3eso3592075b3a.3 for ; Mon, 11 Mar 2024 10:41:48 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178907; x=1710783707; 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=diri3m78EwCD+gDi71O1KOJH/MABv0MOoiXvKOFnIyw=; b=LeoTcHJ8DlrnW05mUniDpvJrdpPKIYIC71tPb45Y9LJGo0z3FzsSxcYFuXx0i5eSAu gPP8N5brepjFM2n6gTtm5E6FB9/irtufGQm5shf6l2FrS0qHTXVtzJztgDqzq15n21Aq 3AsEqsRsXwtiafdk1JrdWU6A6XN25+pvM8xOQQ5da0vDAi3aY8L9R0D6MSZbirvU6Vj+ 8ik/6FqbWsORPDDAcEmnQ6cfwzE3M3G5Ze14TOKZqnN9Y6Mv4Z+XP9UcN95Y8mLWaD0h jc1ADqPMY7GfgrUjASJ9DzBoj+Yi6lHKcKPW3M9vQSNu0/tpHQlHs2OW5EKhSazsDgOp zFng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178907; x=1710783707; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=diri3m78EwCD+gDi71O1KOJH/MABv0MOoiXvKOFnIyw=; b=p876BjkcmNP/MRm//E8d+gfwOXbxygXSO+oqXL/6Hl029JiSZ/D9kBSUhc6mi0wJUO gBJCFfwU7SXW2tPfpimaiiOC1Aza2ZbinLMCsfIAX2Ex6EgZb11KEf1yjI901ivKsbZZ ctsllXTBG4uJXDgSBRQowKf5hczVd/ySmA0zfX6639BAdOjKyZEf62fj7L2flRRiiDZB X2h+3fTrNauG4pGCf11RB0sL6eDt5IDMi0sNi8gE64ndGLLFn5SRG9v8CWB13AcwlHSj 97wdH++aESiYINiD2m4Q7xMAVYilfPB/fbo/6EgoXkh9/0ytIZnFhLmWRDSiT9ltnn2j a24w== X-Gm-Message-State: AOJu0Yz+V4JCtLGLctoBXqU+TnNyTCWOkCuT9w7k+ifWP+L8LTFEdzrg a0ale5YyW7CHVA9tBmpov0m6J5cH+L3LWQ25QdA11b/cyZZEZFT+hAPhA9po6gM= X-Google-Smtp-Source: AGHT+IEdwpaMRc13DahPgDb8+kNI8EwlVkwj4prESfXwjQleRcA1xk+wrIcPnqzXDZItZghjnTx1dg== X-Received: by 2002:a05:6a00:2404:b0:6de:1b57:ca8c with SMTP id z4-20020a056a00240400b006de1b57ca8cmr6630655pfh.23.1710178906748; Mon, 11 Mar 2024 10:41:46 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 13/24] tests/avocado: replay_linux.py remove the timeout expected guards Date: Tue, 12 Mar 2024 03:40:15 +1000 Message-ID: <20240311174026.2177152-14-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::429; envelope-from=npiggin@gmail.com; helo=mail-pf1-x429.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179139081100003 Content-Type: text/plain; charset="utf-8" replay_linux tests with virtio on aarch64 and x86-64 q35 machines seems to be more reliable now, so timeouts are no longer expected. pc_i440fx, and non-virtio still have problems, so mark them as flaky: they are not just long-running, but can hang indefinitely. These tests take about 400 seconds each, so require SPEED=3Dslow. Signed-off-by: Nicholas Piggin --- tests/avocado/replay_linux.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/avocado/replay_linux.py b/tests/avocado/replay_linux.py index b3b91ddd9a..c0e50bb52b 100644 --- a/tests/avocado/replay_linux.py +++ b/tests/avocado/replay_linux.py @@ -118,7 +118,7 @@ def run_replay_dump(self, replay_path): except subprocess.CalledProcessError: self.fail('replay-dump.py failed') =20 -@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout') +@skipUnless(os.getenv('SPEED') =3D=3D 'slow', 'runtime limited') class ReplayLinuxX8664(ReplayLinux): """ :avocado: tags=3Darch:x86_64 @@ -127,19 +127,21 @@ class ReplayLinuxX8664(ReplayLinux): =20 chksum =3D 'e3c1b309d9203604922d6e255c2c5d098a309c2d46215d8fc026954f3c= 5c27a0' =20 + @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable') def test_pc_i440fx(self): """ :avocado: tags=3Dmachine:pc """ self.run_rr(shift=3D1) =20 + @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable') def test_pc_q35(self): """ :avocado: tags=3Dmachine:q35 """ self.run_rr(shift=3D3) =20 -@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout') +@skipUnless(os.getenv('SPEED') =3D=3D 'slow', 'runtime limited') class ReplayLinuxX8664Virtio(ReplayLinux): """ :avocado: tags=3Darch:x86_64 @@ -153,6 +155,7 @@ class ReplayLinuxX8664Virtio(ReplayLinux): =20 chksum =3D 'e3c1b309d9203604922d6e255c2c5d098a309c2d46215d8fc026954f3c= 5c27a0' =20 + @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable') def test_pc_i440fx(self): """ :avocado: tags=3Dmachine:pc @@ -165,7 +168,7 @@ def test_pc_q35(self): """ self.run_rr(shift=3D3) =20 -@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout') +@skipUnless(os.getenv('SPEED') =3D=3D 'slow', 'runtime limited') class ReplayLinuxAarch64(ReplayLinux): """ :avocado: tags=3Daccel:tcg --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179163; cv=none; d=zohomail.com; s=zohoarc; b=EarNjtzCfkChsGZUYCVXTPjzXVIauA72XvxVqtk9aGSAnAfSUMKFnHcDRrSKqU9UtC9JmIKrU3bV7NRqsLw65zC5X7SOw6/2gr2cVTKAoHDnE5nmDTmel+PRb9YCOTG4lVeyjgR5HCvOJn5pBxKn9NK0/O9pbtMpr+lVOAm5hOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179163; 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=iM8ZZscE7pj+Z7J5S93rTnFI05PsMASFwHURBr43Ioo=; b=DXLWTI4g/Km+RiKVkmdcGdq8Kd1yQP0YXorC34SqMYL3XW9tUaIcx8t8nrvoHl43G7YYcLnfU1POLQxRF0/la5kGn+4lRA35OlJD+lcMQlcAvIw2BzSuKfdiKBo04m5rMYTLt6Q2uxRFae1ucS/Bquo4cnXfNGK68nvQw6nBdWM= 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 1710179163168554.847972305511; Mon, 11 Mar 2024 10:46:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjfT-0003sg-Ep; Mon, 11 Mar 2024 13:42:31 -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 1rjjf2-0003UZ-A6 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:04 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjes-0007QQ-JI for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:04 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6e55b33ad14so2449205b3a.1 for ; Mon, 11 Mar 2024 10:41:53 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178912; x=1710783712; 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=iM8ZZscE7pj+Z7J5S93rTnFI05PsMASFwHURBr43Ioo=; b=OyPfJ8c2aIWh9NlUHSrYkHL6C+9EEQpZn0JIlsrKIY96l8tfqN5/d6QH6mvBe3aPx7 KGjTeZNWKD1ZCeyliC/j1a1vOgly9MqQK49/SBad0GH477n9d+3F+z60oJJdtu9NezHR xvrTQb8KlLl/z47oi4mag4al01lVfek/ioy7xUNhyfMEDdwvcoWasSdtdCroVGcVoYL5 tSHuPhe58bHcOqPOj5sfd6C1Q8RwD1VnH298SjwGxEZa+yW9eg+GH5AEda5yWdR2dwW9 k+AM8weY5TYv5fp/XtF3YO08rfnvJGRHgh7yQ6zRZBFrmU/ZT/LQUpU0caaHKlLxdc1M Y2Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178912; x=1710783712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iM8ZZscE7pj+Z7J5S93rTnFI05PsMASFwHURBr43Ioo=; b=ipScIiHlG1K1HBuiIvEmYwUpECHQLyPzbaoU1XZHWmlmISYEm8TTzaUSkzW6kT1XSf UrZQt/S+1Lyk5eEKkim7HH5wegqo7yUmoveEkQqPmS0/xB6eb0B11mWVfHG06mnOHjiY NQeh3p7ih1gqfWoVM1YrgE3AemLeASLHHs06M2nGGRXhx8aEEEmYjmFdysoVZdArObD9 U+h+P3tQhkgbFotls1C3kS7t1C8qIVgSmspzAiskz6kDmqnU0VT5RrpBIW41ipFLpWw6 F6JtHKVdv5LZv5A9DLKBK5bQe9LvtFbvSZByAmd6ynjxz9Y5TF1PLCHN71ex8e9EC+vJ 61iA== X-Gm-Message-State: AOJu0YzKQYdf8jNmuXoaAKyQDAM4WK8kvELlGMnC6bk4oIvt7zGxi/3r WW1xEGUx/F1IpJ8hHQzr7uXScvyJaf/Fn5w+oW3gGFTY+mQjK/aTRt3ER+4WmUQ= X-Google-Smtp-Source: AGHT+IFimX/UevUYrOT5oEXpcXelUbnXSjgNGLHNF4s8AJb8uIw0Ck8Un2l/8dHsxwDid5ss5Q2fYw== X-Received: by 2002:a05:6a00:1988:b0:6e5:ec63:95dd with SMTP id d8-20020a056a00198800b006e5ec6395ddmr7492844pfl.21.1710178911957; Mon, 11 Mar 2024 10:41:51 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 14/24] tests/avocado/reverse_debugging.py: mark aarch64 and pseries as not flaky Date: Tue, 12 Mar 2024 03:40:16 +1000 Message-ID: <20240311174026.2177152-15-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.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=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42c.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179165162100007 These seem to be quite solid, including on several gitlab CI runs. Enabling them should help catch breakage in future. And update the powernv comment -- gitlab isn't the problem, there are known gaps in implementation. Tested-by: Alex Benn=C3=A9e Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Nicholas Piggin --- tests/avocado/reverse_debugging.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_deb= ugging.py index 92855a02a5..8fe76ff921 100644 --- a/tests/avocado/reverse_debugging.py +++ b/tests/avocado/reverse_debugging.py @@ -223,9 +223,6 @@ class ReverseDebugging_AArch64(ReverseDebugging): =20 REG_PC =3D 32 =20 - # unidentified gitlab timeout problem - @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on G= itLab') - def test_aarch64_virt(self): """ :avocado: tags=3Darch:aarch64 @@ -248,14 +245,10 @@ class ReverseDebugging_ppc64(ReverseDebugging): =20 REG_PC =3D 0x40 =20 - # unidentified gitlab timeout problem - @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on G= itLab') - def test_ppc64_pseries(self): """ :avocado: tags=3Darch:ppc64 :avocado: tags=3Dmachine:pseries - :avocado: tags=3Dflaky """ # SLOF branches back to its entry point, which causes this test # to take the 'hit a breakpoint again' path. That's not a problem, @@ -264,7 +257,7 @@ def test_ppc64_pseries(self): self.reverse_debugging() =20 # See https://gitlab.com/qemu-project/qemu/-/issues/1992 - @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on G= itLab') + @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'powernv migration sup= port is incomplete so rr debugging is flaky') =20 def test_ppc64_powernv(self): """ --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710178960; cv=none; d=zohomail.com; s=zohoarc; b=QtF+TIQaNX/nlYqGdezWUj8IlywUJtlGL/SpeLdboKztQM9YsjOQaYvA/WmqdklxFCyVZP/G02SdQM4L3WCIq4mpiiIsHbqxTjHNGXqTpEeY2jGezcxpzvvNme+IeKpix6hA3KBvNqtg8jReBeG0XAF8eKYn9GTKZWQidZPrm3k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710178960; 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=/eazafKsUh9Gq+1jlyAtlIIMsQVJTUKsjooFoPTkUTU=; b=WffjmzNoSXCr7G8Y667oOUEBZ97/wSz5L9cpdSR6frrjxf1wrQOteGfQYTGBea5K+HIuXwxuCqWXEi6seV7m4tlVZNoKCFoFk2aE2+V7260fgwYM1UYzY0VvUppUh8NovZ8GSRgxTIA7YyCsBte08Vk1LGSt46noeem9NxOFivg= 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 1710178960244555.1761029066428; Mon, 11 Mar 2024 10:42:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjf9-0003XU-JN; Mon, 11 Mar 2024 13:42:14 -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 1rjjf0-0003Ix-Rk for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:03 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjey-0007Qm-3t for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:02 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6e5dddd3b95so3381944b3a.1 for ; Mon, 11 Mar 2024 10:41:58 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178918; x=1710783718; 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=/eazafKsUh9Gq+1jlyAtlIIMsQVJTUKsjooFoPTkUTU=; b=EEz2UXclFZjsyfOBXgsGm4vyGiwoeo4+eSsPrX9ENO1CgfQEwcdlXWF19m14kWJ+DK WEPy7VYaUK6yLDW6xZM9LYioYdD3MwSE9dL+emCL7pEeatEwG6fc+ty8uQpez//NV5wI q5YDkEal92XHVJ1OpznwHSj0eMFaNkF5VlFdDkTuoPIIh16GDVu0hqGwO+2EB02M84mO htVkKrzu/pEibjv/FAN77Ncugg/0/WmjpTiqYWDT3LdyI1WOKEfc/RuCvlbKB8CHTrJh 6km5SAVlGO+hHnYzmFZCYEfUhg45NHFZKO5MIq4meKLMpwoRhGr4zOuukaI/sDej3UnU LpxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178918; x=1710783718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/eazafKsUh9Gq+1jlyAtlIIMsQVJTUKsjooFoPTkUTU=; b=AefF9+z+vcmIOaBnBPA8ir8fNUaDrOQh2t39NhJPszs2BanFo1XGaEVwa62/exvliS zonN7m4DezhRu5gHBXwxgrmuhoDV7lxzYPhwQQt7yOVGH0Q4UW0awJ5gNFy1zbA7YHX8 lZugg6+ViG5yUOiU5uLb6fKbl3JU2DZDAEOOV2ILaheOwq7VvSVlg59mgO2bjy0Cg8ao f/qcNHU+h+11p7UEzlcgItst9QXL+q/Lp/6T0K8/6+cbYgzdKzuupmRD+uHKyi+CYpXJ 98x8Zoq4oMiaLU7gS2Kv5ONdBA5MKEJc+Ok75G336NkF5EcnVuV2VP2LXkZkQLpZXuR7 R84A== X-Gm-Message-State: AOJu0Ywe0c/jOFqpKenJoTBiQqilRmhm43dOiwn6/oRfmoelzfFgN2Lo Qb2KAoMCxNCYym98ZgBX8NdHRoc8Kj1o/NTwkKlUQ6yUV25G86jeY+koPWM424U= X-Google-Smtp-Source: AGHT+IEwlmUuf3SMj1mN5Cry6+I5wPwFa1oeWtT5/HJBaYKr8kLP4c7r1U9FAggNX1PtQ+mN7DZp4g== X-Received: by 2002:a05:6a00:1309:b0:6e6:6e12:493f with SMTP id j9-20020a056a00130900b006e66e12493fmr8739960pfu.2.1710178917635; Mon, 11 Mar 2024 10:41:57 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 15/24] tests/avocado: reverse_debugging.py add test for x86-64 q35 machine Date: Tue, 12 Mar 2024 03:40:17 +1000 Message-ID: <20240311174026.2177152-16-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42c; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42c.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710178960552100001 Content-Type: text/plain; charset="utf-8" The x86-64 pc machine has a problem with record/replay. q35 seems to work well. Add a new q35 test and update the flaky message for pc. Signed-off-by: Nicholas Piggin --- tests/avocado/reverse_debugging.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_deb= ugging.py index 8fe76ff921..e76cf54ad7 100644 --- a/tests/avocado/reverse_debugging.py +++ b/tests/avocado/reverse_debugging.py @@ -206,8 +206,7 @@ def get_pc(self, g): + self.get_reg_le(g, self.REG_CS) * 0x10 =20 # unidentified gitlab timeout problem - @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on G= itLab') - + @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'pc machine is unstabl= e with replay') def test_x86_64_pc(self): """ :avocado: tags=3Darch:x86_64 @@ -216,6 +215,14 @@ def test_x86_64_pc(self): # start with BIOS only self.reverse_debugging() =20 + def test_x86_64_q35(self): + """ + :avocado: tags=3Darch:x86_64 + :avocado: tags=3Dmachine:q35 + """ + # start with BIOS only + self.reverse_debugging() + class ReverseDebugging_AArch64(ReverseDebugging): """ :avocado: tags=3Daccel:tcg --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179045; cv=none; d=zohomail.com; s=zohoarc; b=AEu6e+VAWEiRc1dbypLFsHDad79QuhCkzGjdtE+8pH5AOiOTki2z4ixNWfW8KhJOSA1O076yc8OsPb+Btce7ECj5AehqlEDl8bSLtQhIHJDm/SQ1Jve15eUV7BME7/K42zmPvtLW4ADXr7RCWn379hK15wwoS8ED41kEEH/BwAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179045; 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=qeSHK80EhLg2UFHrD4A9Wejbe45HGPILp3WXNbs1+Gg=; b=dYHhcWyjAIBO13BYwk8nseb+n0Ug6j6w+iwsmjYulE4RGRU0AeAmilgWMI95ao4BI8szOxjnz2RodpjJQ+4x75eYVRZc7U6puSB8GaG28avnLTBbwzh7MlBrnHgdLlPkirmWeAP3Xs7itk9j0QO5aQ2kZfZ/jJ3mB1GpBihwz1A= 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 1710179045663832.5130172457335; Mon, 11 Mar 2024 10:44:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjfR-0003mo-99; Mon, 11 Mar 2024 13:42:29 -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 1rjjf4-0003XS-SY for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:10 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjf3-0007RK-2f for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:06 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6e6082eab17so4249266b3a.1 for ; Mon, 11 Mar 2024 10:42:04 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178923; x=1710783723; 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=qeSHK80EhLg2UFHrD4A9Wejbe45HGPILp3WXNbs1+Gg=; b=m21FOnuqbxGSpSe8QnUU73H6Ql5x+HrtfKizTOGTXGuMPFeU59dnerXzuYWEx6mRus /HUIAnNckATtfIhyHOhw4YBXQcbcBlyHykSRjdcp6YZo/QMB+I0ojzaLQ19rFKWej6q5 M2HisrYjIRN8JsZqx56dOWFXoXw6hzzSQVyVFxj4anc5YKRD7LnKTq97pOmb/MLopN3m XsqWcqmaltaipTeq6Nz3LyYP7oEfiyxyO9mkQzQKySFvzuQa9fSGSkHscnlvVzhR0GIC A4wP1cNBuen5gAXhCWAtXUTUsz1p2MdyT438TRYzHd8lPRDCbnw2CYoZ7gCgEEMdh2mK Z15A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178923; x=1710783723; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qeSHK80EhLg2UFHrD4A9Wejbe45HGPILp3WXNbs1+Gg=; b=LrR/qGWzz4U+Fn3Y+T547k2W0EUJvCweBkaRup35AWnHdU2rNE2UH/68KbcHECyUyM HgrKaKwSQ0yyq1DTWJKvBSiNF6QMKwa59xlwCTFHaqVBStcfGmXVg37xDWfjb5N0p65N zPwZgw9+vFo8uBYZ7UW+Fo9OPcYyZXfkZq1kzuWJPwxf+VqIIUX2e5mEPUTcceXM/LFo uqIhmYQvsdBDU6kO5dFqJtagiZmcvMaQRfWJIKBpVNphlm4LDhxUa7PGf+X3sZSrNPI5 wiGGSR4ijCom8EgffqA9Pii5YBZcHDnlh2lCN7q/0QilDdVg0ycm5M/bYtPYDyKDKDtK Duhw== X-Gm-Message-State: AOJu0Yw+k0u0iqVDWwGl8J1/zX7PCfI6bu2rvsP1scYWV2pZI4x2uUy5 rHA+co9y9Hi+00eQkmKqIb1H6OBKxt45IzfmVfP1o0XZ2avRlYjnICWmx+ozscc= X-Google-Smtp-Source: AGHT+IHGQWAaxsZtgzkETkkuaFLblyFRr8Tgd6HFQeOMY1sa066PPD8IdYR8kL4JR3pvu3Zxdok4OA== X-Received: by 2002:a05:6a00:228e:b0:6e6:878b:fbc3 with SMTP id f14-20020a056a00228e00b006e6878bfbc3mr1234061pfe.32.1710178922958; Mon, 11 Mar 2024 10:42:02 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 16/24] tests/avocado: reverse_debugging.py verify addresses between record and replay Date: Tue, 12 Mar 2024 03:40:18 +1000 Message-ID: <20240311174026.2177152-17-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42f; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42f.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179046810100001 Content-Type: text/plain; charset="utf-8" gdb is only attached in the replay phase, and the recorded trace is single-stepped to build up an address map that is used to then verify reverse-step and reverse-continue. This change attaches gdb in the record phase, and builds the address map by single-stepping the live machine. That address map is then verified by single-stepping the replay, and then used for the same reverse debug verification. This is a stronger verifcation between the record and the replay phases, as well as providing some testing of gdb operation in record mode. x86_64 has some problems with single-stepping here, so add a flag to avoid some of the new checks. Signed-off-by: Nicholas Piggin --- tests/avocado/reverse_debugging.py | 66 ++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_deb= ugging.py index e76cf54ad7..a790c342a8 100644 --- a/tests/avocado/reverse_debugging.py +++ b/tests/avocado/reverse_debugging.py @@ -45,7 +45,7 @@ def run_vm(self, record, shift, args, replay_path, image_= path, port): else: logger.info('replaying the execution...') mode =3D 'replay' - vm.add_args('-gdb', 'tcp::%d' % port, '-S') + vm.add_args('-gdb', 'tcp::%d' % port, '-S') vm.add_args('-icount', 'shift=3D%s,rr=3D%s,rrfile=3D%s,rrsnapshot= =3Dinit' % (shift, mode, replay_path), '-net', 'none') @@ -87,6 +87,17 @@ def check_pc(self, g, addr): if pc !=3D addr: self.fail('Invalid PC (read %x instead of %x)' % (pc, addr)) =20 + @staticmethod + def gdb_cont(g): + g.cmd(b'c') + + @staticmethod + def gdb_cont_nowait(g): + # The avocado GDBRemote does not have a good way to disconnect or + # continue without waiting for a reply, so open-code our own here. + data =3D g.encode(b'c') + g._socket.send(data) + @staticmethod def gdb_step(g): g.cmd(b's', b'T05thread:01;') @@ -99,7 +110,7 @@ def gdb_bstep(g): def vm_get_icount(vm): return vm.qmp('query-replay')['return']['icount'] =20 - def reverse_debugging(self, shift=3D7, args=3DNone): + def reverse_debugging(self, shift=3D7, args=3DNone, x86_workaround=3DF= alse): logger =3D logging.getLogger('replay') =20 # create qcow2 for snapshots @@ -117,11 +128,40 @@ def reverse_debugging(self, shift=3D7, args=3DNone): replay_path =3D os.path.join(self.workdir, 'replay.bin') port =3D find_free_port() =20 + steps =3D [] + # record the log vm =3D self.run_vm(True, shift, args, replay_path, image_path, por= t) + logger.info('connecting to gdbstub') + g =3D gdb.GDBRemote('127.0.0.1', port, False, False) + g.connect() + r =3D g.cmd(b'qSupported') + if b'qXfer:features:read+' in r: + g.cmd(b'qXfer:features:read:target.xml:0,ffb') + + if self.vm_get_icount(vm) !=3D 0: + self.fail('icount does not start at zero') + + # save the addresses of the first STEPS instructions executed + logger.info('stepping forward') + for i in range(self.STEPS): + pc =3D self.get_pc(g) + logger.info('saving position %x' % pc) + steps.append(pc) + self.gdb_step(g) + if x86_workaround and i =3D=3D 0 and self.vm_get_icount(vm) = =3D=3D 0: + logger.warn('failed to take first step, stepping again') + self.gdb_step(g) + if self.vm_get_icount(vm) !=3D self.STEPS: + self.fail('icount (%d) does not match number of instructions s= tepped' % self.vm_get_icount(vm)) + + logger.info('continue running') + self.gdb_cont_nowait(g) + while self.vm_get_icount(vm) <=3D self.STEPS: pass last_icount =3D self.vm_get_icount(vm) + logger.info('shutdown...') vm.shutdown() =20 logger.info("recorded log with %s+ steps" % last_icount) @@ -139,23 +179,23 @@ def reverse_debugging(self, shift=3D7, args=3DNone): if b'ReverseContinue+' not in r: self.fail('Reverse continue is not supported by QEMU') =20 + # Try single stepping logger.info('stepping forward') - steps =3D [] - # record first instruction addresses - for _ in range(self.STEPS): - pc =3D self.get_pc(g) - logger.info('saving position %x' % pc) - steps.append(pc) + for addr in steps: + # verify addresses match what initial execution saw + self.check_pc(g, addr) self.gdb_step(g) + logger.info('found position %x' % addr) =20 - # visit the recorded instruction in reverse order + # Try reverse stepping logger.info('stepping backward') for addr in steps[::-1]: self.gdb_bstep(g) + # verify addresses match what initial execution saw self.check_pc(g, addr) logger.info('found position %x' % addr) =20 - # visit the recorded instruction in forward order + # Step forward again logger.info('stepping forward') for addr in steps: self.check_pc(g, addr) @@ -175,7 +215,7 @@ def reverse_debugging(self, shift=3D7, args=3DNone): # continue - will return after pausing # This could stop at the end and get a T02 return, or by # re-executing one of the breakpoints and get a T05 return. - g.cmd(b'c') + self.gdb_cont(g) if self.vm_get_icount(vm) =3D=3D last_icount - 1: logger.info('reached the end (icount %s)' % (last_icount - 1)) else: @@ -213,7 +253,7 @@ def test_x86_64_pc(self): :avocado: tags=3Dmachine:pc """ # start with BIOS only - self.reverse_debugging() + self.reverse_debugging(x86_workaround=3DTrue) =20 def test_x86_64_q35(self): """ @@ -221,7 +261,7 @@ def test_x86_64_q35(self): :avocado: tags=3Dmachine:q35 """ # start with BIOS only - self.reverse_debugging() + self.reverse_debugging(x86_workaround=3DTrue) =20 class ReverseDebugging_AArch64(ReverseDebugging): """ --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179161; cv=none; d=zohomail.com; s=zohoarc; b=jlNnKX2fWpgCEzHKg33ycd+nOA3IPe5SFA8s7b4tojCF3mN3UEtYJP1XirlAZlrevZbHPKtDGbb6n05oCXjnKJgaKXddJ4b2IZwNnp3Ak+4xZ2rZOLjAXiRAhm2RB4RjvxrH570hObl2XtityNHYLyM/x5LgP7DK1JbUUwgDnII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179161; 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=R+Mw1KOsAKdIljnyOdgS7xf0wpaG47NUuB98WZioiqA=; b=kEbTXWmz4JgH9CLZtCeQIsdvCOgb4X8QZsn0Vo4i5LcGlzBhUHiTs9vZEsZye+9clkWRSaqeyIyp5D21a+ajYZpUbH/6t5sMJ8TjL5ifBQReTpn6veIsOkO0wifNJB9x5ZF+RwRX26e82P6tNU1oh4NLMr07s5x4pNRYDNy5EfU= 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 1710179161567109.34563033421762; Mon, 11 Mar 2024 10:46:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjfY-00048B-8g; Mon, 11 Mar 2024 13:42:36 -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 1rjjf9-0003ZJ-Qx for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:16 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjf8-0007Rw-Bd for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:11 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e63e9abf6aso2563163b3a.2 for ; Mon, 11 Mar 2024 10:42:09 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.42.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178928; x=1710783728; 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=R+Mw1KOsAKdIljnyOdgS7xf0wpaG47NUuB98WZioiqA=; b=fSc7hieTuQGNKfiaeqUYYXRmO2vJiOaqpRG+iM53kZTKQGEGARylBxX+5d7Nqjpucp hTGn1d/NJyrR+mnn0kYy5REbKHCyzbebTY8RPM3idCCNpd/UZyj9l0j62Ln1T1hfmM7g HlrqVD+J/joMhjtcYNVbfNd3sg6A5dd/IIzynrMVPtGcxgpyBCRPaVj+KMimx8yIYMKA 9mDk9sCSuMi0XAN6KBVglHdI8FgHuMxzCommhb8U1KL7aXn+UGjYgpXxkBSvqNiPaxhw yhUsAyVPZ7vlIdK7kNnufgyWkvGH0xr6Y5WO5kCNR8S+fLebd2JcLvsDQ9a/L9PI2KkQ mCWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178928; x=1710783728; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R+Mw1KOsAKdIljnyOdgS7xf0wpaG47NUuB98WZioiqA=; b=i+cgwnzAsD+pj/AHzZF2/Qu8smmFNwLMgOJ52Hxy/KeZ3hCOB+5QD3ZdUZlAyheH/X AXXqQFPWVRhmGOUbTOYPIkwehd4o299Z5VkMqzkIwPNQmtnq5mKTGnLrDj1nxnboKeu4 TktY8Z0bVrZg3DBdUJMTxXHUhptwBwjzLnzjpYoJzDWeLactGYbgatdysRYJ8XY9nYne eDndz/YS26ZfK9ci3rrp8BHnDV325hVdTz+G56OKoiKLfOlSP7sQcYoQ7bSdqXJCi/2B 9jN1h6b1VWMZAWOuJsvepYIFZyYBhAPg1k2m+L/FkF/yfsE6RIc76H+aM9B0C+4PIIdU diMA== X-Gm-Message-State: AOJu0Yxjri4O40e6bTr+sn5eSLhBWbiNM2vGRHQncP4DsoxRSIP+DHcf Somf2/+wDqP5ZhhxC1xABPR7PkL9Scb1EPUPC9EoKra3ZJovNVR76JPpcIcSvOE= X-Google-Smtp-Source: AGHT+IHfPujORP8WjpLarS0aDP0D8Sild9AbjkJ1WvBAubb6ngXAyL2hXVRyBqT1rDGblvkXj0uGSw== X-Received: by 2002:a05:6a20:a105:b0:1a3:1469:38cc with SMTP id q5-20020a056a20a10500b001a3146938ccmr3872276pzk.16.1710178928143; Mon, 11 Mar 2024 10:42:08 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 17/24] tests/avocado: reverse_debugging.py stop VM before sampling icount Date: Tue, 12 Mar 2024 03:40:19 +1000 Message-ID: <20240311174026.2177152-18-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42d; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42d.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179163160100003 Content-Type: text/plain; charset="utf-8" Rather than sampling the "last" icount then shutting down the vm while it is running, stop it first. This allows the actual last icount in the trace to be found. Signed-off-by: Nicholas Piggin --- tests/avocado/reverse_debugging.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_deb= ugging.py index a790c342a8..c84fbcd8bd 100644 --- a/tests/avocado/reverse_debugging.py +++ b/tests/avocado/reverse_debugging.py @@ -152,19 +152,20 @@ def reverse_debugging(self, shift=3D7, args=3DNone, x= 86_workaround=3DFalse): if x86_workaround and i =3D=3D 0 and self.vm_get_icount(vm) = =3D=3D 0: logger.warn('failed to take first step, stepping again') self.gdb_step(g) - if self.vm_get_icount(vm) !=3D self.STEPS: + self.gdb_step(g) + if self.vm_get_icount(vm) !=3D self.STEPS + 1: self.fail('icount (%d) does not match number of instructions s= tepped' % self.vm_get_icount(vm)) =20 logger.info('continue running') self.gdb_cont_nowait(g) =20 - while self.vm_get_icount(vm) <=3D self.STEPS: - pass + logger.info('stopping to read final icount') + vm.qmp('stop') last_icount =3D self.vm_get_icount(vm) logger.info('shutdown...') vm.shutdown() =20 - logger.info("recorded log with %s+ steps" % last_icount) + logger.info("recorded log with %s steps" % last_icount) =20 # replay and run debug commands vm =3D self.run_vm(False, shift, args, replay_path, image_path, po= rt) --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710178973; cv=none; d=zohomail.com; s=zohoarc; b=XZMzEEhMLy6lrd8rXh4WXx23s1BdY8Ol0ZI+l4qWpjXD2bWoi9iJ+YRZn/MNeG9KecYD/9RFqStEpeMUP0bC6DOtQ0GTn8sfTdNzYsJv/3gPd3sA45rhCDoJRJKZ+KpdNmHNphO6ogKFeapQxUYybscXibFjWsF4hyKYXjerN28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710178973; 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=BJbIVjuhRVi4haft9J+vCC4CMuONyFWVRLhrl1zM+vA=; b=ELKNrfdOBMWWHMB68YObmkYHyh4+gcIKLGRM3mXiiCj25k7HB9q71/TeQffGb+wEdqHX59lGH0IbZd5qYgtAfvByTx37RdTyAvgsr2iI1H+yjrlfP3oxVoPkU7wIcvJF8/pVAEToHLoKdXTWKIQ4H0xD2cLwcHSry5Tin2jUNEw= 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 1710178973651335.49154146108583; Mon, 11 Mar 2024 10:42:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjfZ-0004QC-Vq; Mon, 11 Mar 2024 13:42:38 -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 1rjjfE-0003cE-RT for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:20 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjfD-0007SS-36 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:16 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6e57a3bf411so1946373b3a.0 for ; Mon, 11 Mar 2024 10:42:14 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:42:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178933; x=1710783733; 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=BJbIVjuhRVi4haft9J+vCC4CMuONyFWVRLhrl1zM+vA=; b=Zh61yr5J09aF2WoToS/M1mHMlFmkR7N20M0N8GjGj1FlmSjJOUbkccX20ab0Fn54qZ BJUURP2pOmjiv5EJxumEOcItTDTIs8rBY/eSbjYq+UxaoY/IoqU7cCqZdGBiRLSFM30d Txn72UYtnYMt1sgc1E8LYqqe9yK2z9B0PFT2P8UnoTKlYncjq3petbWDphbQ31n3COZc Eqfuc89k/44rfDs0j0S0DBLlutNzoB/n2FyR5hIbQnsCnQ7nLDlKgLN3c9TGldqJ1mBU 8Jw/o1KvfHn8E+abk0WH9TVwSYFrXnSDg6aiyV6axvRZuqYweys6WuZDjWSXfWefaI5D rT9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178933; x=1710783733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BJbIVjuhRVi4haft9J+vCC4CMuONyFWVRLhrl1zM+vA=; b=KcV7sipXjdMm0GvkZ2uA9U5ZmfLGmdcFhwiUi64zlyGN+Uzdy7CCscjOJkMz0uBz3l zzIlpkVKIrvGgtzNv51GaXtgw+9E3NhS9aGMoz/uQyAL7XXp8ir6BKwpeykGEKbA5Q7t KJiQ0iAz7eakhCLqa8788EZuAxt8YjnZsbbEqKj7NI969LHBSeSU85/80RFbrR2y5x0s wR+51r++LzBf7UTbph8OyoIRyrtd7heyYdeLtCj9xTWiVDD4TLXVyO7i7v73yJIJ6V9r aljkuz0q5gHiLj5u5/xwBEcSR4ClTgImzuDw2z22TeZSENsjq25Wugr5ChzFkn6eX3CF chKw== X-Gm-Message-State: AOJu0YztEMGVYyl0hBS+f6D31knGeNDZ+TTso0Uc5Pc0GrF7mXfsk0I1 Ue61ulwSNvn6hlspzSDd9EyxzBBttPpdjvcKntgJdCKJcX1J0O7cwjRoOMu0zIU= X-Google-Smtp-Source: AGHT+IFkby1+lHxcyaFpPuw6Z+hPTch+XkzHcCmbXYVPyuicqjHt82HqJxngG04Q/6fnSD4YBVWDjg== X-Received: by 2002:a05:6a20:d80b:b0:1a2:b33b:d6e0 with SMTP id iv11-20020a056a20d80b00b001a2b33bd6e0mr9512296pzb.59.1710178933375; Mon, 11 Mar 2024 10:42:13 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 18/24] tests/avocado: reverse_debugging reverse-step at the end of the trace Date: Tue, 12 Mar 2024 03:40:20 +1000 Message-ID: <20240311174026.2177152-19-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::432; envelope-from=npiggin@gmail.com; helo=mail-pf1-x432.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710178974538100001 Content-Type: text/plain; charset="utf-8" The longer a trace is played for, the more chance there is for bugs to cause it to go out of synch with the initial recording. Stepping backward from the end of a trace can be a good way to find problems. This extends the runtime of the record phase to 1 second, to build a bigger trace, and it adds a replay test that runs to the end of the trace, steps back then forward and verifies the pc. Signed-off-by: Nicholas Piggin --- tests/avocado/reverse_debugging.py | 50 +++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_deb= ugging.py index c84fbcd8bd..635ff7bacc 100644 --- a/tests/avocado/reverse_debugging.py +++ b/tests/avocado/reverse_debugging.py @@ -9,6 +9,7 @@ # later. See the COPYING file in the top-level directory. import os import logging +import time =20 from avocado import skipUnless from avocado_qemu import BUILD_DIR @@ -31,7 +32,7 @@ class ReverseDebugging(LinuxKernelTest): that the execution is stopped at the last of them. """ =20 - timeout =3D 10 + timeout =3D 20 STEPS =3D 10 endian_is_le =3D True =20 @@ -87,6 +88,19 @@ def check_pc(self, g, addr): if pc !=3D addr: self.fail('Invalid PC (read %x instead of %x)' % (pc, addr)) =20 + @staticmethod + def gdb_break(g): + # The avocado GDBRemote does not have a good way to send this break + # packet, which is different from others. + g._socket.send(b'\x03') + transmission_result =3D g._socket.recv(1) + if transmission_result =3D=3D '-': + raise Exception("Bad ack") + result =3D g._socket.recv(1024) + response_payload =3D g.decode(result) + if response_payload !=3D b'T02thread:01;': + raise Exception("Unexpected response" + response_payload.decod= e()) + @staticmethod def gdb_cont(g): g.cmd(b'c') @@ -159,8 +173,14 @@ def reverse_debugging(self, shift=3D7, args=3DNone, x8= 6_workaround=3DFalse): logger.info('continue running') self.gdb_cont_nowait(g) =20 + logger.info('running for 1s...') + time.sleep(1) logger.info('stopping to read final icount') vm.qmp('stop') + self.gdb_break(g) + last_pc =3D self.get_pc(g) + logger.info('saving position %x' % last_pc) + self.gdb_step(g) last_icount =3D self.vm_get_icount(vm) logger.info('shutdown...') vm.shutdown() @@ -196,6 +216,34 @@ def reverse_debugging(self, shift=3D7, args=3DNone, x8= 6_workaround=3DFalse): self.check_pc(g, addr) logger.info('found position %x' % addr) =20 + # Run to the end of the trace, reverse-step, and then reverse-cont= inue + # back to the start, with no breakpoints. This allows us to get to= the + # end of the trace and reverse step from there, without possibly + # hitting a breakpoint that prevents reaching the end, as can happ= en + # with the later breakpoint tests. + logger.info('running to the end of the trace') + vm.qmp('replay-break', icount=3Dlast_icount - 1) + # This should stop at the end and get a T02 return. + self.gdb_cont(g) + if self.vm_get_icount(vm) !=3D last_icount - 1: + self.fail('failed to reach the end (icount %s, reached %s)' % = ((last_icount - 1), self.vm_get_icount(vm))) + logger.info('reached end of trace') + if not x86_workaround: + self.check_pc(g, last_pc) + logger.info('found position %x' % last_pc) + + logger.info('stepping backward') + self.gdb_bstep(g) + + logger.info('stepping forward') + self.gdb_step(g) + if not x86_workaround: + self.check_pc(g, last_pc) + logger.info('found position %x' % last_pc) + + logger.info('reversing to the start of the trace') + g.cmd(b'bc', b'T05thread:01;') + # Step forward again logger.info('stepping forward') for addr in steps: --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179037; cv=none; d=zohomail.com; s=zohoarc; b=lRn62G9TKUbbACJkbt0J9ZVR6HJkUNOcvG+0dpAzT9AQtoJRpbkoNDpuMJsGCuQavvoyXbEAXwvxdCpyaLjl5KDjcDq+yxcASvf/eZX6UcjsAF0jsCXi0kFhtMIX8sIj4CymSd4Os5na7IMG6dRiDhimuL2He8XKsja4RfuBhjQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179037; 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=rISfc8l1xBFHITbDV0m0cgRwOmIPXYSeOi4Nk95AjkA=; b=g9kDzcCKv2cnovXyu1KBrNWTE8WY+Tcc1cnJ9kIfLifihZ2ic2hTx2SIeRJVKxqXc/UYeDmq2+eM70eSL4ITB0utN6Tvh8gbxP9oadACmWpDpq2WA9V6JN/FA7jquzjZGxcblKYztNgWBg3s/f/lN/fDJ2oyvbOxO78+PKhAEho= 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 1710179037122810.0428961292463; Mon, 11 Mar 2024 10:43:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjfY-0004Cn-O7; Mon, 11 Mar 2024 13:42:36 -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 1rjjfL-0003lr-F5 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:27 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjfI-0007Sl-SI for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:22 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e46dcd8feaso2740628b3a.2 for ; Mon, 11 Mar 2024 10:42:20 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178939; x=1710783739; 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=rISfc8l1xBFHITbDV0m0cgRwOmIPXYSeOi4Nk95AjkA=; b=K3+WyGoLFGPePJmBoWNI5QY/YpnhojErT+qpLb1GKN8KMWEBiKa6MdLbfQbaJDOUob pLlnELhwIL7qMTSYsbNZfzwRdqCKO2IlpLeulDMsSKlFCK3jHdW+9zxyTSbrA5YNEwGy YtY/xE5IPW5W4pVBR8vbrjVPRU+kF8lfYrSjTSyXRU7D7/SH0L/xmWK/yvagLkKg7gw6 lXSh8T34YuJ0gvuV3buQNSD/z57Rr241jx38M7xJukedS0e5i48TxlJ6s2vcssfhqA2Q oZlFlKf3RQ9nkf31my69S/9FJ/P8xAgvy3koRpiEe4hufCgRDEYj99xqHRxspv1Q1j3S 7mmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178939; x=1710783739; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rISfc8l1xBFHITbDV0m0cgRwOmIPXYSeOi4Nk95AjkA=; b=vt0/beiz+tE4gyqjo7CcvfHOAXAubzR//uppkWlr/PvjQOG8IOq5jJsVl+goNfsOly 7AOWua1JpE5S15NvGkuKB/Rh3saxalH0B64skAJ1rlqXQoPk42XR8wxIv7IfBHQXWFT0 BFUCab/tlf0M0tab1XDE3I0NcntLdFSBJu4adkzdWDG/lNkIm7SvzV/SaDo3ehGkjExe SC1PN8LmurKGXUHfL7AgLZMK6JBL2KgTxpQRr65RK94/W3ktK1eypDlcDuYkHOpoysNs cg02ttqA+lHgdPz9OcCzddo2DZCRnW+O3QXdoiMHQ3fJWfqrT6iYF7wpwBdaS5UVX8Fg ztEg== X-Gm-Message-State: AOJu0Yyu0jw2kBD5crBrLJUMOu0ZYNtc1/6o/PxtbYTro4tT7fati11C vggKjcqzLCmXqENc5F8PxMO8E3J+1XuzS7z242H3FKbqLtOPfJ9a0PZ1SmL8XWM= X-Google-Smtp-Source: AGHT+IGRvS6YTzo8fFTT7cpnzRiZ9I9vJC/AkNtE7REgEH+nsHBJoP1b95VO/gB5czdXXnqydubGgA== X-Received: by 2002:a05:6a20:e118:b0:1a1:7257:6302 with SMTP id kr24-20020a056a20e11800b001a172576302mr5353318pzb.4.1710178938670; Mon, 11 Mar 2024 10:42:18 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 19/24] tests/avocado: reverse_debugging.py add snapshot testing Date: Tue, 12 Mar 2024 03:40:21 +1000 Message-ID: <20240311174026.2177152-20-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42d; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42d.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179038780100003 Content-Type: text/plain; charset="utf-8" Make a manual snapshot halfway though initial building of the address map in record mode. This will cause the reverse-step and reverse-continue tests to load that snapshot when beginning from later points in the trace, exercising the post-initial snapshot saving and loading. Signed-off-by: Nicholas Piggin --- tests/avocado/reverse_debugging.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_deb= ugging.py index 635ff7bacc..4bf4e6e1e5 100644 --- a/tests/avocado/reverse_debugging.py +++ b/tests/avocado/reverse_debugging.py @@ -50,7 +50,7 @@ def run_vm(self, record, shift, args, replay_path, image_= path, port): vm.add_args('-icount', 'shift=3D%s,rr=3D%s,rrfile=3D%s,rrsnapshot= =3Dinit' % (shift, mode, replay_path), '-net', 'none') - vm.add_args('-drive', 'file=3D%s,if=3Dnone' % image_path) + vm.add_args('-drive', 'file=3D%s,if=3Dnone,id=3Ddisk0' % image_pat= h) if args: vm.add_args(*args) vm.launch() @@ -124,6 +124,14 @@ def gdb_bstep(g): def vm_get_icount(vm): return vm.qmp('query-replay')['return']['icount'] =20 + @staticmethod + def vm_snapshot(vm): + return vm.qmp('snapshot-save', + {'job-id': 'snapshot-job', + 'tag': 'manual', + 'vmstate': 'disk0', + 'devices': []}) + def reverse_debugging(self, shift=3D7, args=3DNone, x86_workaround=3DF= alse): logger =3D logging.getLogger('replay') =20 @@ -162,6 +170,9 @@ def reverse_debugging(self, shift=3D7, args=3DNone, x86= _workaround=3DFalse): pc =3D self.get_pc(g) logger.info('saving position %x' % pc) steps.append(pc) + if i =3D=3D self.STEPS//2: + logger.info('saving VM snapshot at step %x...' % i) + self.vm_snapshot(vm) self.gdb_step(g) if x86_workaround and i =3D=3D 0 and self.vm_get_icount(vm) = =3D=3D 0: logger.warn('failed to take first step, stepping again') @@ -208,7 +219,9 @@ def reverse_debugging(self, shift=3D7, args=3DNone, x86= _workaround=3DFalse): self.gdb_step(g) logger.info('found position %x' % addr) =20 - # Try reverse stepping + # Try reverse stepping. The manual snapshot taken in the record + # phase should be used for reverse-stepping until the machine + # reverses to an icount older than the snapshot. logger.info('stepping backward') for addr in steps[::-1]: self.gdb_bstep(g) @@ -232,6 +245,8 @@ def reverse_debugging(self, shift=3D7, args=3DNone, x86= _workaround=3DFalse): self.check_pc(g, last_pc) logger.info('found position %x' % last_pc) =20 + # This should load the last snapshot taken. Could that be verified + # with QMP? logger.info('stepping backward') self.gdb_bstep(g) =20 --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710178993; cv=none; d=zohomail.com; s=zohoarc; b=CUnlddTVd7Hpx8POdrr5TsDLTPhrxKDh5Zu+Z7GOqHNxtOt/Mva7pI56L6We/IKEndblCA9UtYaM6AHMv8TUSIWfBAGtr5JPruzELbpdau9n8MUAC6FzgM99mDhy0WoOyj0+7ZRyzVDpYafiDn9kD8MkdEhkHM0JNVaaZzVxJfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710178993; 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=ReAKLnxDhZ0dLTbcBcY6ImZ2cOk598dKpfP+nB/tbBQ=; b=CSkZMR/J5+ahZ1c7XVNSLP72VTbbbmeT3DfZxK6s209p70yUGgdhi+jgRbXCfzbb8bzBCfCUqoC0aOsGlrOi9UDPL/LwxGHdwKrPKxMKxXFfjZcgPMgkyxRlZuxJpj3zYPVIDtRPt9JY3SU+Qil814MQEEwuKj9VVJTi0mV61OE= 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 1710178993893932.0192314519184; Mon, 11 Mar 2024 10:43:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjff-00055S-Ks; Mon, 11 Mar 2024 13:42:44 -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 1rjjfT-0003yR-JW for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:31 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjfP-0007T8-4g for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:29 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6e676ea4e36so2375466b3a.3 for ; Mon, 11 Mar 2024 10:42:26 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178945; x=1710783745; 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=ReAKLnxDhZ0dLTbcBcY6ImZ2cOk598dKpfP+nB/tbBQ=; b=icLf8KbySJi5I0MU03q8Sa3lslgb9qf/nE6s0be+DdBRYCKrqNFfiqSiswYDObp7su fd+8Enb95j6Hp0o4/dMQWYKP8p7/5zIQ5REfDNZNTlrHcqzUgavtdS47cPYQcNNm/flM UjTLOD1Frzac8d5MZ/UyS4C+0nDI98gfSpITJpZnWLYhovr6F93AX8Mph61w1pGTrkyw 5GT5IAhhtvRv0iONtrmP6zr8rTSjjFN/tXc1eyZYk3EEjoihBfawKwes6njBnJ/8cy8P SpqjsQnUg8ws8QmybR+qe53+pX3y7Rnlv1OUncUtaXNWQYT+wa0VEARQdYoG+ByaEnxz t9pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178945; x=1710783745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ReAKLnxDhZ0dLTbcBcY6ImZ2cOk598dKpfP+nB/tbBQ=; b=NR8C1VMJE+scIJ5IRqGGuq6IcPoBrvKn8FNGZHOgaUNMbmN1BpHuIKSH4HdrtN08MN tH9y9yzYh38rq8wKhwukBy0fs3V3HcbKMajYZPfRyDzkDr8hNxt/7ESqeHjSpBo6cVFJ Xddv7MpMdD5bxYZFT8DZWM2DlL7Fx+RIND1E08q/4QenO9RbGll8dIgd4BMouWgN7b1w kvzYUvfrhBi3KVDmkc7wBse+MJv5ckN+RCaZhna9O8xf6zSzLEX8kVw5TlcA0yn3jh1x 6s3cuo+yfCTSLnkJVlU8dQnfDIFDnbs/Ou/zwm5JVRdluLbOMSPl55dnQb03pCYvR3np SOsA== X-Gm-Message-State: AOJu0Yz16KY0ExgOqJIlZxLu3vcNfBLGwlqqy6h15OgmuvCG4vvdKiuX 0ticpBQCpacIi3sdIzEidnnVakZZDQOmZDYdrLjPRkCnjhpgAe/2jO/VidHe4K8= X-Google-Smtp-Source: AGHT+IHr6LuDGqUNSCjZhxYjFKq/y6EfdzE5nxC0Jag+yn9nyTGOO2EOD7CmUUDjbF2WcD3JKj0BIQ== X-Received: by 2002:a05:6a00:1a8a:b0:6e6:2cde:a3d9 with SMTP id e10-20020a056a001a8a00b006e62cdea3d9mr1207142pfv.10.1710178943884; Mon, 11 Mar 2024 10:42:23 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 20/24] replay: simple auto-snapshot mode for record Date: Tue, 12 Mar 2024 03:40:22 +1000 Message-ID: <20240311174026.2177152-21-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::429; envelope-from=npiggin@gmail.com; helo=mail-pf1-x429.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710178994607100001 Content-Type: text/plain; charset="utf-8" record makes an initial snapshot when the machine is created, to enable reverse-debugging. Often the issue being debugged appears near the end of the trace, so it is important for performance to keep snapshots close to the end. This implements a periodic snapshot mode that keeps a rolling set of recent snapshots. This could be done by the debugger or other program that talks QMP, but for setting up simple scenarios and tests, this is more convenient. Signed-off-by: Nicholas Piggin --- docs/system/replay.rst | 5 ++++ include/sysemu/replay.h | 11 ++++++++ replay/replay-snapshot.c | 57 ++++++++++++++++++++++++++++++++++++++++ replay/replay.c | 27 +++++++++++++++++-- system/vl.c | 9 +++++++ qemu-options.hx | 9 +++++-- 6 files changed, 114 insertions(+), 4 deletions(-) diff --git a/docs/system/replay.rst b/docs/system/replay.rst index ca7c17c63d..1ae8614475 100644 --- a/docs/system/replay.rst +++ b/docs/system/replay.rst @@ -156,6 +156,11 @@ for storing VM snapshots. Here is the example of the c= ommand line for this: ``empty.qcow2`` drive does not connected to any virtual block device and u= sed for VM snapshots only. =20 +``rrsnapmode`` can be used to select just an initial snapshot or periodic +snapshots, with ``rrsnapcount`` specifying the number of periodic snapshots +to maintain, and ``rrsnaptime`` the amount of run time in seconds between +periodic snapshots. + .. _network-label: =20 Network devices diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index 8102fa54f0..92fa82842b 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -48,6 +48,17 @@ typedef enum ReplayCheckpoint ReplayCheckpoint; =20 typedef struct ReplayNetState ReplayNetState; =20 +enum ReplaySnapshotMode { + REPLAY_SNAPSHOT_MODE_INITIAL, + REPLAY_SNAPSHOT_MODE_PERIODIC, +}; +typedef enum ReplaySnapshotMode ReplaySnapshotMode; + +extern ReplaySnapshotMode replay_snapshot_mode; + +extern uint64_t replay_snapshot_periodic_delay; +extern int replay_snapshot_periodic_nr_keep; + /* Name of the initial VM snapshot */ extern char *replay_snapshot; =20 diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c index ccb4d89dda..762555feaa 100644 --- a/replay/replay-snapshot.c +++ b/replay/replay-snapshot.c @@ -70,6 +70,53 @@ void replay_vmstate_register(void) vmstate_register(NULL, 0, &vmstate_replay, &replay_state); } =20 +static QEMUTimer *replay_snapshot_timer; +static int replay_snapshot_count; + +static void replay_snapshot_timer_cb(void *opaque) +{ + Error *err =3D NULL; + char *name; + + if (!replay_can_snapshot()) { + /* Try again soon */ + timer_mod(replay_snapshot_timer, + qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + + replay_snapshot_periodic_delay / 10); + return; + } + + name =3D g_strdup_printf("%s-%d", replay_snapshot, replay_snapshot_cou= nt); + if (!save_snapshot(name, + true, NULL, false, NULL, &err)) { + error_report_err(err); + error_report("Could not create periodic snapshot " + "for icount record, disabling"); + g_free(name); + return; + } + g_free(name); + replay_snapshot_count++; + + if (replay_snapshot_periodic_nr_keep >=3D 1 && + replay_snapshot_count > replay_snapshot_periodic_nr_keep) { + int del_nr; + + del_nr =3D replay_snapshot_count - replay_snapshot_periodic_nr_kee= p - 1; + name =3D g_strdup_printf("%s-%d", replay_snapshot, del_nr); + if (!delete_snapshot(name, false, NULL, &err)) { + error_report_err(err); + error_report("Could not delete periodic snapshot " + "for icount record"); + } + g_free(name); + } + + timer_mod(replay_snapshot_timer, + qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + + replay_snapshot_periodic_delay); +} + void replay_vmstate_init(void) { Error *err =3D NULL; @@ -82,6 +129,16 @@ void replay_vmstate_init(void) error_report("Could not create snapshot for icount record"= ); exit(1); } + + if (replay_snapshot_mode =3D=3D REPLAY_SNAPSHOT_MODE_PERIODIC)= { + replay_snapshot_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, + replay_snapshot_timer= _cb, + NULL); + timer_mod(replay_snapshot_timer, + qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + + replay_snapshot_periodic_delay); + } + } else if (replay_mode =3D=3D REPLAY_MODE_PLAY) { if (!load_snapshot(replay_snapshot, NULL, false, NULL, &err)) { error_report_err(err); diff --git a/replay/replay.c b/replay/replay.c index 895fa6b67a..c916e71d30 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -29,6 +29,10 @@ ReplayMode replay_mode =3D REPLAY_MODE_NONE; char *replay_snapshot; =20 +ReplaySnapshotMode replay_snapshot_mode; +uint64_t replay_snapshot_periodic_delay; +int replay_snapshot_periodic_nr_keep; + /* Name of replay file */ static char *replay_filename; ReplayState replay_state; @@ -424,6 +428,27 @@ void replay_configure(QemuOpts *opts) } =20 replay_snapshot =3D g_strdup(qemu_opt_get(opts, "rrsnapshot")); + if (replay_snapshot && mode =3D=3D REPLAY_MODE_RECORD) { + const char *snapmode; + + snapmode =3D qemu_opt_get(opts, "rrsnapmode"); + if (!snapmode || !strcmp(snapmode, "initial")) { + replay_snapshot_mode =3D REPLAY_SNAPSHOT_MODE_INITIAL; + } else if (!strcmp(snapmode, "periodic")) { + replay_snapshot_mode =3D REPLAY_SNAPSHOT_MODE_PERIODIC; + } else { + error_report("Invalid rrsnapmode option: %s", snapmode); + exit(1); + } + + /* Default 10 host seconds of machine runtime per snapshot. */ + replay_snapshot_periodic_delay =3D + qemu_opt_get_number(opts, "rrsnaptime", 10) * 1= 000; + + /* Default 2, to cover at least the last 10 host seconds of runtim= e. */ + replay_snapshot_periodic_nr_keep =3D + qemu_opt_get_number(opts, "rrsnapcount", 2); + } replay_vmstate_register(); replay_enable(fname, mode); =20 @@ -446,8 +471,6 @@ void replay_start(void) exit(1); } =20 - /* Timer for snapshotting will be set up here. */ - replay_enable_events(); } =20 diff --git a/system/vl.c b/system/vl.c index 70f4cece7f..8070cee6da 100644 --- a/system/vl.c +++ b/system/vl.c @@ -447,6 +447,15 @@ static QemuOptsList qemu_icount_opts =3D { }, { .name =3D "rrsnapshot", .type =3D QEMU_OPT_STRING, + }, { + .name =3D "rrsnapmode", + .type =3D QEMU_OPT_STRING, + }, { + .name =3D "rrsnaptime", + .type =3D QEMU_OPT_NUMBER, + }, { + .name =3D "rrsnapcount", + .type =3D QEMU_OPT_NUMBER, }, { /* end of list */ } }, diff --git a/qemu-options.hx b/qemu-options.hx index ac4a30fa83..9eb547bf52 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4651,13 +4651,13 @@ SRST ERST =20 DEF("icount", HAS_ARG, QEMU_OPTION_icount, \ - "-icount [shift=3DN|auto][,align=3Don|off][,sleep=3Don|off][,rr=3Dreco= rd|replay,rrfile=3D[,rrsnapshot=3D]]\n" \ + "-icount [shift=3DN|auto][,align=3Don|off][,sleep=3Don|off][,rr=3Dreco= rd|replay,rrfile=3D[,rrsnapshot=3D][,rrsnapmode=3Diniti= al|periodic][,rrsnaptime=3Dsecs][,rrsnapcount=3DN]\n" \ " enable virtual instruction counter with 2^N clock tic= ks per\n" \ " instruction, enable aligning the host and virtual clo= cks\n" \ " or disable real time cpu sleeping, and optionally ena= ble\n" \ " record-and-replay mode\n", QEMU_ARCH_ALL) SRST -``-icount [shift=3DN|auto][,align=3Don|off][,sleep=3Don|off][,rr=3Drecord|= replay,rrfile=3Dfilename[,rrsnapshot=3Dsnapshot]]`` +``-icount [shift=3DN|auto][,align=3Don|off][,sleep=3Don|off][,rr=3Drecord|= replay,rrfile=3Dfilename[,rrsnapshot=3Dsnapshot][,rrsnapmode=3Dinitial|peri= odic][,rrsnaptime=3Dsecs][,rrsnapcount=3DN]]`` Enable virtual instruction counter. The virtual cpu will execute one instruction every 2^N ns of virtual time. If ``auto`` is specified then the virtual cpu speed will be automatically adjusted to keep @@ -4699,6 +4699,11 @@ SRST name. In record mode, a new VM snapshot with the given name is created at the start of execution recording. In replay mode this option specifies the snapshot name used to load the initial VM state. + ``rrsnapmode=3Dperiodic`` will additionally cause a periodic snapshot = to + be created after ``rrsnaptime=3Dsecs`` seconds of real runtime. The la= st + ``rrsnapcount=3DN`` periodic snapshots (not including the initial) will + be kept (0 for infinite). Periodic snapshots are useful to speed + reverse debugging operations near the end of the recorded trace. ERST =20 DEF("watchdog-action", HAS_ARG, QEMU_OPTION_watchdog_action, \ --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179202; cv=none; d=zohomail.com; s=zohoarc; b=M34xRtmSHvko5wUW968KxIpGYFTUpnKiAaaahrHyWxvXWMrHrBfOm9YTmm5uufNanAgRSysMGzAt451CDz1/Hk6ejxqAwtG5/iHQJ5iQ0w843r9oW9d0xeE0TEFah7RxrK92qJcDggM5L0Acs6vSF4u6rNLFhwDv5VqCjnIIwns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179202; 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=B/XlsIofD/wjudMNjmydpE++GM2AoH7AyjDFCwRpOIY=; b=YvvVtAoxFX1WeJQXUDEFFPBnKM9OSfKK4uRjQl0qiwHCPjcvm2NX+mRUO8aYeCNM22NpujYoVKVnJhWYBMXpJRHqUbKTlUDWRLOPW5VizxOKNrdENv+D/7Jt2EyFnR1FQeKslOlOWI0HsRCgw82cX/1sbH3H0HK14e+vT9B422M= 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 1710179202097711.1783715631186; Mon, 11 Mar 2024 10:46:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjfa-0004Sq-6X; Mon, 11 Mar 2024 13:42:38 -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 1rjjfV-00041w-S9 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:35 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjfS-0007TN-So for qemu-devel@nongnu.org; Mon, 11 Mar 2024 13:42:32 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6e6381df003so4061662b3a.0 for ; Mon, 11 Mar 2024 10:42:30 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178949; x=1710783749; 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=B/XlsIofD/wjudMNjmydpE++GM2AoH7AyjDFCwRpOIY=; b=dKdExSpyAo4Vhr7tHH27ytmWMj+M+xBGOpsQWILHSyYs19GbBhiSdJtu+l1X9x1EeH /ZjuH72ahjw7xapcArzM4SbtEVMFP5b2JdDRMcMi3YJOplFQ6XLcECEClqxnQ8jfw7CY 4uc7EhBH8/zO9SvqaSkPdqxpKUtz8SCT33hcSpuoWLAQ0+jzeGZ9KoX7O109u20/C/SU VLmrzZsFaK3hlWyBO0i1NsufYLqqizzmn+pQci4/fcCF8jNZv9tjhCAxL9f3B+beXCCo ZMKtqRJK1udEtU9aawbyAVTQT+9IeMYdK18sopHB8PITo+Bzz31qFnLiwcWtJza73oF3 +18Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178949; x=1710783749; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B/XlsIofD/wjudMNjmydpE++GM2AoH7AyjDFCwRpOIY=; b=rM4SnzpUaONQeHv32aVxrjo6JCZu4ypM65xKOZgLhdoovxxPyEtlFp0jGM9WH/Yt4x NLa3f+EdsKkKJVxBedbkEMRlsBj53M3p7fcmBuBCNLOpUxLPySeZxSXxJLfsjTKBezO0 HFnrFxKnRDHKG8R0nDskA2IeFAWEVNXl5Xl0oBnWav4i5awgnWJ5JqB2caIPTHbOxHoI EFffN6FK4qPyVMYOxa9idm4FdL1lXz+SurOcL294Ml9kPn7VWVpm2Jt3I6WuZXXrB+lP Ol6YXc7YjNOEybq1lEHdN2TSWIi9tix7vLNh5TkU3WRw1Md2S5FNf32v8cmuLCDDwPd4 6GZw== X-Gm-Message-State: AOJu0Yx+tWGWQsNIchoePQSGdV0oY5lzcclR5OXaCQRNxeWjtMlaNg5W Q86pYZcX8WsMITwEXlEednTmbcA7ibs7Ix8usY3l6eAMky0MVMEyp/4TOWfBKzI= X-Google-Smtp-Source: AGHT+IF27GH2svtB2AKfHjQECJ98Nk3FJalKkgFnfyhrJpQ12c7nv8jDjsv/9cMHTZT89BAqbdEjEg== X-Received: by 2002:a05:6a20:914c:b0:1a1:8bdc:9dc2 with SMTP id x12-20020a056a20914c00b001a18bdc9dc2mr8921709pzc.31.1710178949094; Mon, 11 Mar 2024 10:42:29 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v4 21/24] tests/avocado: reverse_debugging.py test auto-snapshot mode Date: Tue, 12 Mar 2024 03:40:23 +1000 Message-ID: <20240311174026.2177152-22-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::435; envelope-from=npiggin@gmail.com; helo=mail-pf1-x435.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179203255100007 Content-Type: text/plain; charset="utf-8" This runs the recording phase with a periodic auto-snapshot. It also runs the machine for 5 seconds after creating the initial address map, so as to alow time for a some auto snapshots to be taken. In the replay mode a reverse-debugging sequence is added where the test is run to the end, and reverse-stepped from there. This should load the last auto-snapshot taken. The test hangs on x86-64 and aarch64 with autosnapshots, so it is disabled for them. Signed-off-by: Nicholas Piggin --- tests/avocado/reverse_debugging.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_deb= ugging.py index 4bf4e6e1e5..67b72ce519 100644 --- a/tests/avocado/reverse_debugging.py +++ b/tests/avocado/reverse_debugging.py @@ -32,9 +32,11 @@ class ReverseDebugging(LinuxKernelTest): that the execution is stopped at the last of them. """ =20 - timeout =3D 20 + timeout =3D 30 STEPS =3D 10 endian_is_le =3D True + # x86-64 and aarch64 hang with autosnapshot so turn it off by default + autosnapshot =3D False =20 def run_vm(self, record, shift, args, replay_path, image_path, port): logger =3D logging.getLogger('replay') @@ -47,9 +49,14 @@ def run_vm(self, record, shift, args, replay_path, image= _path, port): logger.info('replaying the execution...') mode =3D 'replay' vm.add_args('-gdb', 'tcp::%d' % port, '-S') - vm.add_args('-icount', 'shift=3D%s,rr=3D%s,rrfile=3D%s,rrsnapshot= =3Dinit' % - (shift, mode, replay_path), - '-net', 'none') + if self.autosnapshot: + vm.add_args('-icount', 'shift=3D%s,rr=3D%s,rrfile=3D%s,rrsnaps= hot=3Dinit' + ',rrsnapmode=3Dperiodic,rrsnapcount=3D1= 0,' + 'rrsnaptime=3D1' % (shift, mode, replay= _path)) + else: + vm.add_args('-icount', 'shift=3D%s,rr=3D%s,rrfile=3D%s,rrsnaps= hot=3Dinit' + % (shift, mode, replay_path)) + vm.add_args('-net', 'none') vm.add_args('-drive', 'file=3D%s,if=3Dnone,id=3Ddisk0' % image_pat= h) if args: vm.add_args(*args) @@ -184,8 +191,12 @@ def reverse_debugging(self, shift=3D7, args=3DNone, x8= 6_workaround=3DFalse): logger.info('continue running') self.gdb_cont_nowait(g) =20 - logger.info('running for 1s...') - time.sleep(1) + if self.autosnapshot: + logger.info('running for 5s...') + time.sleep(5) + else: + logger.info('running for 1s...') + time.sleep(1) logger.info('stopping to read final icount') vm.qmp('stop') self.gdb_break(g) @@ -365,6 +376,7 @@ def test_ppc64_pseries(self): # to take the 'hit a breakpoint again' path. That's not a problem, # just slightly different than the other machines. self.endian_is_le =3D False + self.autosnapshot =3D True self.reverse_debugging() =20 # See https://gitlab.com/qemu-project/qemu/-/issues/1992 --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179128; cv=none; d=zohomail.com; s=zohoarc; b=loGuGleVVWC6Fa9mmoOZ5OT/zKTSMG1xgBo2Vrf5Ee8ELIFbCYnhjVmVn4UaNFTlIy4GfhYFR3RU+9MvgAM2WvwSrKD9RuaW2azPHTPYIZIppq8XVCGb2O6Iz0iM4kqR0YeGadDLQA9TlOKfgaKHW8U4K9fLy2Ta9Rd+iWmwCA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179128; 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=lDxLWuCdYHq+0UxHzHGZvZ93wYuuHZ500ruO/QvykEw=; b=WfBe820+IapFD6ODhzJqPUD++DNfxvsyZD/EqrhVc/Xl6KXYL2fmqAADTWpn7tJOhy6remS4NK6HK3Os1cisy8pp9lV7dwuPcl69gQVHhchw4OmR7unQQfO78h7ohET+SJcZCr+WP2WoiMMJqGjswXCRk29ERvSLsFrCGrqybio= 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 1710179128515659.6988902290128; Mon, 11 Mar 2024 10:45:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjfj-0005MH-96; Mon, 11 Mar 2024 13:42:47 -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 1rjjfa-0004YZ-MH; Mon, 11 Mar 2024 13:42:38 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjfY-0007Tr-SZ; Mon, 11 Mar 2024 13:42:38 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6e64a9df6c3so3792408b3a.3; Mon, 11 Mar 2024 10:42:36 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178955; x=1710783755; 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=lDxLWuCdYHq+0UxHzHGZvZ93wYuuHZ500ruO/QvykEw=; b=d4hS2BuTrkMMrc2JAmESC6/CAFonk0Zvenlutp5CXGUxBwJtSUJFKYhJXdW49m4eH1 Sxe+JX0+eSYh5IfOciLsAl1t2Obmz0gsjKcC6w1eIuRhqhaGMnOf9j5rqxWmoxEo832J 9e6/W2TClAzfeCk66EOiwPvN0MStT3VgJplZZNQhyx6NGlS07iDYWpqGu9nw+qkRa/zo Uj6mWpeArMNXZTwriNgCNn0WA7tNoKeHJW+Y35iVCFr0VPOrzAltEYXS7kh0c3bowDV3 MbFiWlqAIHp4m2HKubD6Br73M4Xk5PuXuPpszI1IF03V3JF4nUyHsfvqonfVmKyZCCiY cw1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178955; x=1710783755; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lDxLWuCdYHq+0UxHzHGZvZ93wYuuHZ500ruO/QvykEw=; b=reiTlCuYTOoSp3cLT27+EfmaE9aOlFVa1nrT5qh6B9Xfmy6/15Q19Xu12fjToI1B2m WcpZDuAWDqkA1X/GkzBpjGwAQPt7LP89PRwNokK/3z5vMZ1+J83DP5tjcjd8+HVPRuGy qnEqj5z1GPAyJwKFK5eIsEaWykoRugqKaPOZ7L7GENriHdMB0Zku0NPGn/IYkPlt2MLX gLsPQCqQuRO5rgTMDd8KAT4jTky32k9fWYje5gPkT3OIZQRQKKOD5j2sFNbW5JIxo9QQ 8+71xlglWFCxfpSSSMVdlXKzdA34uRX03k3r077a+gE9yvz3NTLabPMib0fhj9INvKkg YijA== X-Forwarded-Encrypted: i=1; AJvYcCVh7CWtbwELgXIF7aPNSQYA+vPOf5bBCdFqMPXoJtTp0RvfD40wP5CjgwrBz0FDgGqMNOj+DXlZ3PvmJU2UYMtVn7tQ X-Gm-Message-State: AOJu0YwE/5nlkQUxM9gSyNv9oClzhTMNtyps23tI8zSggc7OCRyE6uQr KQkdoWA+YSnsuLeUhl7ClV/+9Po5cPhlx5tpyfm+5qTbsFMgRGW+cozg3OKQZkI= X-Google-Smtp-Source: AGHT+IHLaZL2JscYhnGsK2pqMh8r6LSnh3vkWR9vWi0hxg7lKDfVoNfqVjyPzEUxES7b4ytZbGmZ9g== X-Received: by 2002:a05:6a00:22d2:b0:6e6:800f:9f84 with SMTP id f18-20020a056a0022d200b006e6800f9f84mr9211371pfj.11.1710178954731; Mon, 11 Mar 2024 10:42:34 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev , qemu-ppc@nongnu.org Subject: [PATCH v4 22/24] target/ppc: fix timebase register reset state Date: Tue, 12 Mar 2024 03:40:24 +1000 Message-ID: <20240311174026.2177152-23-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::435; envelope-from=npiggin@gmail.com; helo=mail-pf1-x435.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179129179100001 Content-Type: text/plain; charset="utf-8" (H)DEC and PURR get reset before icount does, which causes them to be skewed and not match the init state. This can cause replay to not match the recorded trace exactly. For DEC and HDEC this is usually not noticable since they tend to get programmed before affecting the target machine. PURR has been observed to cause replay bugs when running Linux. Fix this by resetting using a time of 0. Cc: qemu-ppc@nongnu.org Signed-off-by: Nicholas Piggin --- hw/ppc/ppc.c | 11 ++++++++--- target/ppc/machine.c | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index fadb8f5239..f22321779e 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -1112,16 +1112,21 @@ void cpu_ppc_tb_reset(CPUPPCState *env) timer_del(tb_env->hdecr_timer); ppc_set_irq(cpu, PPC_INTERRUPT_HDECR, 0); tb_env->hdecr_next =3D 0; + _cpu_ppc_store_hdecr(cpu, 0, 0, 0, 64); } =20 /* * There is a bug in Linux 2.4 kernels: * if a decrementer exception is pending when it enables msr_ee at sta= rtup, * it's not ready to handle it... + * + * On machine reset, in this is called before icount is reset, so + * for icount-mode, setting TB registers using now=3Dqemu_clock_get_ns + * results in them being skewed when icount does get reset. Use an + * explicit 0 to get a consistent reset state. */ - cpu_ppc_store_decr(env, -1); - cpu_ppc_store_hdecr(env, -1); - cpu_ppc_store_purr(env, 0x0000000000000000ULL); + _cpu_ppc_store_decr(cpu, 0, 0, -1, 64); + _cpu_ppc_store_purr(env, 0, 0); } =20 void cpu_ppc_tb_free(CPUPPCState *env) diff --git a/target/ppc/machine.c b/target/ppc/machine.c index 203fe28e01..4c4294eafe 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -215,6 +215,8 @@ static int cpu_pre_save(void *opaque) * it here. */ env->spr[SPR_DECR] =3D cpu_ppc_load_decr(env); + printf("cpu_ppc_pre_save TB:0x%016lx\n", cpu_ppc_load_tbl(env)); + printf("cpu_ppc_pre_save DEC:0x%016lx\n", cpu_ppc_load_decr(env)); } =20 return 0; @@ -333,6 +335,8 @@ static int cpu_post_load(void *opaque, int version_id) * triggered types (including HDEC) would need to carry more state. */ cpu_ppc_store_decr(env, env->spr[SPR_DECR]); + printf("cpu_ppc_post_ld TB:0x%016lx\n", cpu_ppc_load_tbl(env)); + printf("cpu_ppc_post_ld DEC:0x%016lx\n", cpu_ppc_load_decr(env)); pmu_mmcr01_updated(env); } =20 --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179143; cv=none; d=zohomail.com; s=zohoarc; b=YNZ3qEJKHK0/p5YU/SpsnJDcXoKQZQPcxglutl5IVmQP+/4Rbg/2OZ7/NVoCM4PUi2itmypUIda4qA31+ojMpeTehZsINHIMvpToAaWIEFs/f1LOcKoT0YZfHlABPxspe8oCPHpayccwSUQFH2w3HzXhFBw/UcUDvAqgTblFh3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179143; 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=+gGhZ4pjanpiywqqalSDcdpCIXre6mE3lC/dQog4JF4=; b=JRoJxVp4cdiyGAYfxginELKtGKd7ZtzJlP21AG0f68B/ha8NgKRuOgAHvzINxQggYvLKBEW/28G6znWfSEGYaZr0CuxX78YzJiJ15s5MOUAYxz94ggt9jjfKlVG88n6ATvawg0IeguGt0GnHmmmTZsquttwO+p/9ORofkiDTJZw= 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 1710179143916565.8022535168368; Mon, 11 Mar 2024 10:45:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjfl-0005X1-Ay; Mon, 11 Mar 2024 13:42:49 -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 1rjjfg-0005Cq-Fx; Mon, 11 Mar 2024 13:42:44 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjfe-0007VU-Da; Mon, 11 Mar 2024 13:42:44 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6da202aa138so2990027b3a.2; Mon, 11 Mar 2024 10:42:41 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178960; x=1710783760; 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=+gGhZ4pjanpiywqqalSDcdpCIXre6mE3lC/dQog4JF4=; b=SFe1KojstCtfTIF8cNIyZSLX3o7CuCySBqintVPwfvynw3ReiQMHWcKqxBHs1O8ZAO TS1D3JajvQs+P/TjDQHkkxSPS2H6glMpkMVip1EaoPLTE9dlOO+nIKqfBYzTma6Tqeek xkFoH7GegiVxPWndi2UZxOw/84elTnEaEXN9e1TIYjgUsDm6muhbs2pY+a0SqjEkzJYF 12plJMqwbOzZdMWxaOaWf64T7DJKibv1XVowJ4B99QZ4ps1P5UPQgj3kCH93xG7ECRPW 4d/P6qUo2rh39Xl5nsgEo/09jxnxFlAPhDEB+Zf5U3yZKZnFvd9sEpZkm8SbpYXkYjLS 1scw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178960; x=1710783760; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+gGhZ4pjanpiywqqalSDcdpCIXre6mE3lC/dQog4JF4=; b=CYa8UegP4KyktNbvmE2lLD4X1LjTyXrv4js+YGF8IVluYr5+j1R9sBa3VqVktcM0gl dagaaVhw/YJhPSpK4SCXEmwLaeFGjHrXamPUHM0HwrnulWYGTxCcodpVocLg/yL1LFIQ UHUmJJxEOPtWVV5EFGoSYUsDBuh+BKcn1c97Kp4Xadwue9pZASt8NFYcLLE/MpXNO83K p0JKf+Wly2a3f2Hr8rDJC3nKvVNfnjzFPvqf3U43risdLwR0ZSGKSJH0bc7o7wVqin9e e9XP9pMluwVlyfUoEWS97aa4SlJfH8wto7Scs2S36kN9vabbVK7YbT59YUmzvtpoWeiY o7pg== X-Forwarded-Encrypted: i=1; AJvYcCW0DbxxwTQJKFmSIxLnFida4zSkf3nW5ymAEvlbGe5VLg1H/JBQGFMxrQICxXsvzVRQ1s4x5y3+3qTZXK+osfrMXqRZ X-Gm-Message-State: AOJu0Yy2xw53fA3s34bxVTLGSLJV74PWtEO009VXxn7GQnCKBjBk63XX j3Gx67FkbCS831FeChcjXUm6RXo2EWr5TwEvBDwBiqt0KKakyG0BoFPna0y5RkE= X-Google-Smtp-Source: AGHT+IFXpF4I/OuGKg9bdj1uNNtQuY5XO0v1eM0+8uA0NMFwCIaow87hNqPWip66hzVEjuJrbOVthA== X-Received: by 2002:a05:6a20:258f:b0:1a0:f5b9:bd88 with SMTP id k15-20020a056a20258f00b001a0f5b9bd88mr10137112pzd.55.1710178960293; Mon, 11 Mar 2024 10:42:40 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev , qemu-ppc@nongnu.org Subject: [PATCH v4 23/24] spapr: Fix vpa dispatch count for record-replay Date: Tue, 12 Mar 2024 03:40:25 +1000 Message-ID: <20240311174026.2177152-24-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42a; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42a.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179145105100001 Content-Type: text/plain; charset="utf-8" The dispatch count is a field in guest memory that the hypervisor increments when preempting and dispatching the guest. This was not being done deterministically with respect to icount, because tcg exec exit is not deterministic (e.g., an async event could cause it). Change vpa dispatch count increment to keep track of whether the vCPU is considered dispatched or not, and only consider it preempted when calling cede / confer / join / stop-self / etc. Cc: qemu-ppc@nongnu.org Signed-off-by: Nicholas Piggin --- include/hw/ppc/spapr_cpu_core.h | 3 +++ hw/ppc/spapr.c | 36 ++------------------------------- hw/ppc/spapr_hcall.c | 33 ++++++++++++++++++++++++++++++ hw/ppc/spapr_rtas.c | 1 + 4 files changed, 39 insertions(+), 34 deletions(-) diff --git a/include/hw/ppc/spapr_cpu_core.h b/include/hw/ppc/spapr_cpu_cor= e.h index 69a52e39b8..5feb0ecc2a 100644 --- a/include/hw/ppc/spapr_cpu_core.h +++ b/include/hw/ppc/spapr_cpu_core.h @@ -47,6 +47,7 @@ typedef struct SpaprCpuState { uint64_t vpa_addr; uint64_t slb_shadow_addr, slb_shadow_size; uint64_t dtl_addr, dtl_size; + bool dispatched; /* for vpa dispatch counter tracking */ bool prod; /* not migrated, only used to improve dispatch latencies */ struct ICPState *icp; struct XiveTCTX *tctx; @@ -61,4 +62,6 @@ static inline SpaprCpuState *spapr_cpu_state(PowerPCCPU *= cpu) return (SpaprCpuState *)cpu->machine_data; } =20 +void vpa_dispatch(CPUState *cs, SpaprCpuState *spapr_cpu, bool dispatch); + #endif diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 55263f0815..28ce5f263a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4572,47 +4572,15 @@ static void spapr_cpu_exec_enter(PPCVirtualHypervis= or *vhyp, PowerPCCPU *cpu) { SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); =20 - /* These are only called by TCG, KVM maintains dispatch state */ - spapr_cpu->prod =3D false; - if (spapr_cpu->vpa_addr) { + if (!spapr_cpu->dispatched) { CPUState *cs =3D CPU(cpu); - uint32_t dispatch; - - dispatch =3D ldl_be_phys(cs->as, - spapr_cpu->vpa_addr + VPA_DISPATCH_COUNTER); - dispatch++; - if ((dispatch & 1) !=3D 0) { - qemu_log_mask(LOG_GUEST_ERROR, - "VPA: incorrect dispatch counter value for " - "dispatched partition %u, correcting.\n", dispat= ch); - dispatch++; - } - stl_be_phys(cs->as, - spapr_cpu->vpa_addr + VPA_DISPATCH_COUNTER, dispatch); + vpa_dispatch(cs, spapr_cpu, true); } } =20 static void spapr_cpu_exec_exit(PPCVirtualHypervisor *vhyp, PowerPCCPU *cp= u) { - SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); - - if (spapr_cpu->vpa_addr) { - CPUState *cs =3D CPU(cpu); - uint32_t dispatch; - - dispatch =3D ldl_be_phys(cs->as, - spapr_cpu->vpa_addr + VPA_DISPATCH_COUNTER); - dispatch++; - if ((dispatch & 1) !=3D 1) { - qemu_log_mask(LOG_GUEST_ERROR, - "VPA: incorrect dispatch counter value for " - "preempted partition %u, correcting.\n", dispatc= h); - dispatch++; - } - stl_be_phys(cs->as, - spapr_cpu->vpa_addr + VPA_DISPATCH_COUNTER, dispatch); - } } =20 static void spapr_machine_class_init(ObjectClass *oc, void *data) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 75c2d12978..5f68c02739 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -487,6 +487,36 @@ static target_ulong h_register_vpa(PowerPCCPU *cpu, Sp= aprMachineState *spapr, return ret; } =20 +void vpa_dispatch(CPUState *cs, SpaprCpuState *spapr_cpu, bool dispatch) +{ + uint32_t counter; + + if (!dispatch) { + assert(spapr_cpu->dispatched); + } else { + assert(!spapr_cpu->dispatched); + } + spapr_cpu->dispatched =3D dispatch; + + return; + + if (!spapr_cpu->vpa_addr) { + return; + } + + /* These are only called by TCG, KVM maintains dispatch state */ + counter =3D ldl_be_phys(cs->as, spapr_cpu->vpa_addr + VPA_DISPATCH_COU= NTER); + counter++; + if ((counter & 1) !=3D dispatch) { + qemu_log_mask(LOG_GUEST_ERROR, + "VPA: incorrect dispatch counter value for " + "%s partition %u, correcting.\n", + dispatch ? "preempted" : "running", counter); + counter++; + } + stl_be_phys(cs->as, spapr_cpu->vpa_addr + VPA_DISPATCH_COUNTER, counte= r); +} + static target_ulong h_cede(PowerPCCPU *cpu, SpaprMachineState *spapr, target_ulong opcode, target_ulong *args) { @@ -505,6 +535,7 @@ static target_ulong h_cede(PowerPCCPU *cpu, SpaprMachin= eState *spapr, =20 if (!cpu_has_work(cs)) { cs->halted =3D 1; + vpa_dispatch(cs, spapr_cpu, false); cs->exception_index =3D EXCP_HLT; cs->exit_request =3D 1; ppc_maybe_interrupt(env); @@ -531,6 +562,8 @@ static target_ulong h_confer_self(PowerPCCPU *cpu) cs->exit_request =3D 1; ppc_maybe_interrupt(&cpu->env); =20 + vpa_dispatch(cs, spapr_cpu, false); + return H_SUCCESS; } =20 diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index f329693c55..8ce4230223 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -216,6 +216,7 @@ static void rtas_stop_self(PowerPCCPU *cpu, SpaprMachin= eState *spapr, */ env->spr[SPR_PSSCR] |=3D PSSCR_EC; cs->halted =3D 1; + vpa_dispatch(cs, spapr_cpu_state(cpu), false); ppc_store_lpcr(cpu, env->spr[SPR_LPCR] & ~pcc->lpcr_pm); kvmppc_set_reg_ppc_online(cpu, 0); qemu_cpu_kick(cs); --=20 2.42.0 From nobody Tue May 14 00:23:22 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1710179181; cv=none; d=zohomail.com; s=zohoarc; b=nG8ks5bCl8huByrRoPWiXJUM9Q7tusK4oLMA1lNI3cXwRbXnO0o0Umqnc59ysPCgkazSphzmNBWcvATZaZniROu6CMjHrzecSWOutXaqtjAsykQxsbbiZcs/ZTcSAxFYXiB5NqBO7dWG2yfXwA/2ermjXECPkeD+6Bk+KsyFSeQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710179181; 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=cJYmS7//KWqwEUzntf/7pcjsXnd3DRaeR+mHw8GRlas=; b=A91LkSo0pfBouEr/yBth2gFF8cgjFVuGoE/DOwFRHPLt2pN5KHqRtBlJB45WUOl+ExLmpgfEnWYOAWLhGCb0Ld57F8OD038XB05U0dlVFlu5JAcHWCQWaCyOg0Y0nPNpqnoXhZdf+AfJUtbm0gf/L3iI9sufH5bdEID/Sl/d5tY= 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 1710179181668493.98120043361155; Mon, 11 Mar 2024 10:46:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjjfr-0006In-6Z; Mon, 11 Mar 2024 13:42:55 -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 1rjjfn-0005zZ-Mm; Mon, 11 Mar 2024 13:42:51 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjjfl-0007W9-Qd; Mon, 11 Mar 2024 13:42:51 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e5eb3dd2f8so3336585b3a.2; Mon, 11 Mar 2024 10:42:47 -0700 (PDT) Received: from wheely.local0.net ([118.208.155.46]) by smtp.gmail.com with ESMTPSA id a18-20020a62d412000000b006e67b4d7b74sm4593187pfh.197.2024.03.11.10.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:42:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710178966; x=1710783766; 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=cJYmS7//KWqwEUzntf/7pcjsXnd3DRaeR+mHw8GRlas=; b=XLgJLyZTgLL3dJgOO0vZ6LZKegh2SUg2zr4VZjCWUV1C3gPqfhy8YjzoO7ZvdEcaHl gRIDaQSLY9oK1KOdlf+LvCRyYWu8/kqivhYhK8ji0pH5GB2H6rPe6pvFBeaApEL8d+YP MM0baCr3HDSRaEWIif7FF7gu0a9ShYi69pcn/b8gQgDwanlS3uxKOpjdGr7T//bZVqn8 389DgGM0PHQyL7OJRdn4R/bD0R2ChczL8hfmqzx1T9YsHjiiNFzmVjxYoUKaLvr7SI/2 5TKX8tag50VVvNMMxuVWoSl7Id1AHUGo60MwsrOuB+pVWPCJ0gIk3BdPkSLwmQcqXZXj m7cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710178966; x=1710783766; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cJYmS7//KWqwEUzntf/7pcjsXnd3DRaeR+mHw8GRlas=; b=jLKWkqMdeGrfkbTsO6Xy7fGqJCpvw/EkIDNCiuGYMWJbs2/BqqtCzDVLqdCyrxHYMd kt/gQPzy1FUX/NfBRicdJHxzuvSbS4jGhqxsaApPk75q+WqOHsDynyuMobmLuxAdjF2j 0lmzfmNizdJH/MdL8R7qQBXyCdIIPlIuI98lywZGKr/VyV7D3Af5AJRHWzECWGpA87z8 YVzQUMK+TLmt8LyfIgePraiC9tuoVxe8YaOnggx7E493yi9kps/XW/STj8/af7WbcyaF dsylE2RacaM3ctmXspH68EhlSyDXsr10xD54355tRsfL9ycIVNowLK4Zm8Ke7ex4WCWz 5LFA== X-Forwarded-Encrypted: i=1; AJvYcCW7Rd11U9KSUYNHacGk9GTcNR9ZLcSBXJRCJkgyqBjOolaOSgGMXef1LAdL5iqgbJ035O/uHSsG2hInVi6X3g0B2rG7 X-Gm-Message-State: AOJu0YzelVHyzd/d+IXBGI0QkfYAKPKBNfHwy6qIs8Z5WxZBjIbqr9Nf 30iFQvfUMT4o9uQ7u4PdST078cl6CqCo50yx7Fmkov6aZlUAFCTXoIyvbHKZaYo= X-Google-Smtp-Source: AGHT+IEuu6OMiP1EpBRtnn7qfNBbuxCvPVJwjj8e5BkI/v/tyS+D/utoINnLeC5mM6WfM1e9siMTPA== X-Received: by 2002:a05:6a20:3553:b0:1a1:82fc:94e2 with SMTP id f19-20020a056a20355300b001a182fc94e2mr3627211pze.44.1710178965704; Mon, 11 Mar 2024 10:42:45 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev , qemu-ppc@nongnu.org Subject: [PATCH v4 24/24] tests/avocado: replay_linux.py add ppc64 pseries test Date: Tue, 12 Mar 2024 03:40:26 +1000 Message-ID: <20240311174026.2177152-25-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240311174026.2177152-1-npiggin@gmail.com> References: <20240311174026.2177152-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::42d; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42d.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @gmail.com) X-ZM-MESSAGEID: 1710179183223100003 Content-Type: text/plain; charset="utf-8" Add a ppc64 pseries test. IO in SLOF is very slow when running in record-replay modes, so this this uses guestfish to extract the kernel and initrd and boot them directly. Cc: qemu-ppc@nongnu.org Signed-off-by: Nicholas Piggin --- The test takes about double the length of time of aarch64 and x86 tests (800s to 400s) for some reason. Not profiled it yet. tests/avocado/replay_linux.py | 78 ++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/tests/avocado/replay_linux.py b/tests/avocado/replay_linux.py index c0e50bb52b..1c11e48043 100644 --- a/tests/avocado/replay_linux.py +++ b/tests/avocado/replay_linux.py @@ -11,8 +11,9 @@ import os import logging import time +import subprocess =20 -from avocado import skipUnless +from avocado import skipIf, skipUnless from avocado_qemu import BUILD_DIR from avocado.utils import cloudinit from avocado.utils import network @@ -55,11 +56,14 @@ def vm_add_disk(self, vm, path, id, device): '%s,drive=3Ddisk%s-rr%s' % (device, id, bus_string)) =20 def vm_add_cdrom(self, vm, path, id, device): + vm.add_args('-device', + '%s,drive=3Ddisk%s' % (device, id)) vm.add_args('-drive', 'file=3D%s,id=3Ddisk%s,if=3Dnone,media=3Dcdr= om' % (path, id)) =20 def launch_and_wait(self, record, args, shift): self.require_netdev('user') vm =3D self.get_vm() + vm.add_args('-s') vm.add_args('-smp', '1') vm.add_args('-m', '1024') vm.add_args('-netdev', 'user,id=3Dvnet,hostfwd=3D:127.0.0.1:0-:22', @@ -207,3 +211,75 @@ def test_virt_gicv3(self): self.run_rr(shift=3D3, args=3D(*self.get_common_args(), "-machine", "virt,gic-version=3D3")) + +# ppc64 pseries test. +# +# This machine tends to fail replay and hang very close to the end of the +# trace, with missing events, which is still an open issue. +# +# spapr-scsi IO driven by SLOF/grub is extremely slow in record/replay mod= e, +# so jump through some hoops to boot the kernel directly. With this, the t= est +# runs in about 5 minutes (modulo hang), which suggests other machines may +# have similar issues and could benefit from bypassing bootloaders. +# +ppc_deps =3D ["guestfish"] # dependent tools needed in the test setup/box. + +def which(tool): + """ looks up the full path for @tool, returns None if not found + or if @tool does not have executable permissions. + """ + paths=3Dos.getenv('PATH') + for p in paths.split(os.path.pathsep): + p =3D os.path.join(p, tool) + if os.path.exists(p) and os.access(p, os.X_OK): + return p + return None + +def ppc_missing_deps(): + """ returns True if any of the test dependent tools are absent. + """ + for dep in ppc_deps: + if which(dep) is None: + return True + return False + +class ReplayLinuxPPC64(ReplayLinux): + """ + :avocado: tags=3Darch:ppc64 + :avocado: tags=3Daccel:tcg + """ + + hdd =3D 'virtio-blk-pci' + cd =3D 'scsi-cd' + bus =3D None + + def setUp(self): + super().setUp() + + if not ppc_missing_deps(): + # kernel, initramfs, and kernel cmdline are all taken by hand = from + # the Fedora image. + self.kernel=3D"vmlinuz-5.3.7-301.fc31.ppc64le" + self.initramfs=3D"initramfs-5.3.7-301.fc31.ppc64le.img" + cmd =3D "guestfish --ro -a %s run " ": mount /dev/sda2 / " ": = copy-out /boot/%s %s " ": copy-out /boot/%s %s " % (self.boot_path, self.ke= rnel, self.workdir, self.initramfs, self.workdir) + subprocess.run(cmd.split()) + + @skipIf(ppc_missing_deps(), 'dependencies (%s) not installed' % ','.jo= in(ppc_deps)) + def test_pseries(self): + """ + :avocado: tags=3Dmachine:pseries + """ + kernel=3Dos.path.normpath(os.path.join(self.workdir, self.kernel)) + initramfs=3Dos.path.normpath(os.path.join(self.workdir, self.initr= amfs)) + cmdline=3D"root=3DUUID=3D8a409ee6-3cb3-4b06-a266-39e2dae3e5fa ro n= o_timer_check net.fnames=3D0 console=3Dtty1 console=3DttyS0,115200n8" + self.run_rr(shift=3D3, args=3D("-device", "spapr-vscsi", + "-machine", "x-vof=3Don", + "-kernel", kernel, + "-initrd", initramfs, + "-append", cmdline)) + + # minimise the number of tests run by default because they are slow + # SLOF block IO is extremely slow when going through the blkreplay dri= ver + @skipUnless(os.getenv('SPEED') =3D=3D 'slow', 'runtime limited') + def test_pseries_slof(self): + self.run_rr(shift=3D3, args=3D("-device", "spapr-vscsi")) --=20 2.42.0