From nobody Tue Nov 26 14:44:11 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=1706199022; cv=none; d=zohomail.com; s=zohoarc; b=MKc/LoAanzxV4IY5EgVivjOqTO1y+rhZxcoNKxsKUgL480S3HM1SB2qmcQdKELbCOdT/fVQ9trO2IvrvHw+ZYX3vwgmNV1f0E9aWqjTLiESBBuyTTYouc0NN9HUex4ZK4EBPoksXhI/zJUudd6dPCkYtq7VENkaNesz8P6nxKWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706199022; 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=NQ83V6u3JjoeeV13hHMhpfCkNlbCNZFwOk7uKsoQQk8=; b=Oc49GdBF5Ocqcq6KAdHyzl4mmSwyk1SMsbGpkuGUd0u33NBllmHeY0rRkwJwfSZeF1nHZmyGRbkbKmqfSUNXfAnkW237wRjESPqrSF+3GQaHo5WoMzMVfUEHRBkd76T5nsSEi++ezI+1pyV0NcjnMNxyozPr3rIu5MfuN6jwc1o= 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 1706199022107141.69249105382585; Thu, 25 Jan 2024 08:10:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rT2Hh-0006p3-Tj; Thu, 25 Jan 2024 11:08:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rT2Hd-0006kT-Ju for qemu-devel@nongnu.org; Thu, 25 Jan 2024 11:08:53 -0500 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rT2Hc-0000LQ-4Q for qemu-devel@nongnu.org; Thu, 25 Jan 2024 11:08:53 -0500 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-5cf6d5117f9so4026425a12.2 for ; Thu, 25 Jan 2024 08:08:51 -0800 (PST) Received: from wheely.local0.net (110-175-3-177.tpgi.com.au. [110.175.3.177]) by smtp.gmail.com with ESMTPSA id oe7-20020a17090b394700b00293851b198csm14190pjb.56.2024.01.25.08.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 08:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706198930; x=1706803730; 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=NQ83V6u3JjoeeV13hHMhpfCkNlbCNZFwOk7uKsoQQk8=; b=R7BEaC7B+4lN8ueXVTp1iV/kSqP0LkCgt7NVJBtgNlXshd8D5GNJ15QrOprlKSrjMX lVuDfqj8Hwqo3IPzPv8moJV42+G5Vr6TN1dCafcoGI4AYfUL1c4jUD8A9uvshsUX9d1b bO7CUUZO2lrIixTcgQxwT56ALrQnG309xN+h/MeInWtElaDoomN1a4MMTi1AS2tCYphb +p2j8UspmrRVGLh474iXaeCSvjlRtwWiv03orsnWsqCH+VeWAzBwsEjDXYtEwEq9I1ox K+UYZtKIJn2c11ELlE3yIuVYZvIXyEtTKbg8kvCpcLBnqXFu7BuFjd51Ok2Fyx4Pqpdk kWfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706198930; x=1706803730; 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=NQ83V6u3JjoeeV13hHMhpfCkNlbCNZFwOk7uKsoQQk8=; b=osMWaVoq5F5Qjmmp0ZTFoxiS2uKJWW3nWNiACEfMast8fNrkg9PrnRQnuKYYItpL7V nEpug6vaUUThlp9mdVy5e3hBWquavgenOmJsJk553Q9eT3HnhIbganT77DZEminIH+JK s0h11PPHlSo0SawnLS7Z6Ks19Hyg7O3wxG7NGrk2NcV07Aq4cJ+mRJGT9mf2nFY0OriX GH2QcS8HeH/Vg6yh8YR1BWfez82NjrsFJ4GVrYEFr0zuYdduqsiw4lQYt5HEnsBtx40h 1bh8/+GofKRldcjyWbNti15j4IH+xzOYoC0uV7BqLhq28B1rPtXrefTFq5DcFpTEZnIY GuVw== X-Gm-Message-State: AOJu0YxnQ0iX1/INt8DbBovTUlU7JQVfhsDIA3xHGTNVHgZF/0lkQsM0 NqsPJMaW3iQn+j924RJq0QLl0KEqgLAA9lgxsZuPKqxUa6kc3JYn0OVXQ9u6 X-Google-Smtp-Source: AGHT+IGnpf/EMqVVaDkzyvRuvSPQDS3JC94doqdKlZqcM3tX4d9JgJltw7QaxVQBrRJLPS75wIs07w== X-Received: by 2002:a17:90b:3711:b0:28f:f728:c3f4 with SMTP id mg17-20020a17090b371100b0028ff728c3f4mr829646pjb.72.1706198929781; Thu, 25 Jan 2024 08:08:49 -0800 (PST) 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 Subject: [PATCH v2 1/4] replay: allow runstate shutdown->running when replaying trace Date: Fri, 26 Jan 2024 02:08:32 +1000 Message-ID: <20240125160835.480488-2-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240125160835.480488-1-npiggin@gmail.com> References: <20240125160835.480488-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::531; envelope-from=npiggin@gmail.com; helo=mail-pg1-x531.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: 1706199023784100003 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. Signed-off-by: Nicholas Piggin Reviewed-by: Pavel Dovgalyuk --- include/sysemu/runstate.h | 1 + replay/replay.c | 2 ++ system/runstate.c | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+) 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 3fd241a4fc..2951eed3bd 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -383,6 +383,8 @@ static void replay_enable(const char *fname, int mode) /* go to the beginning */ fseek(replay_file, HEADER_SIZE, SEEK_SET); replay_fetch_data_kind(); + + runstate_replay_enable(); } =20 replay_init_events(); diff --git a/system/runstate.c b/system/runstate.c index d6ab860eca..bd0fed8657 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_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,6 +195,19 @@ bool runstate_check(RunState state) return current_run_state =3D=3D state; } =20 +void runstate_replay_enable(void) +{ + const RunStateTransition *p; + + assert(replay_mode =3D=3D REPLAY_MODE_PLAY); + + for (p =3D &replay_runstate_transitions_def[0]; p->from !=3D RUN_STATE= __MAX; + p++) { + runstate_valid_transitions[p->from][p->to] =3D true; + } + +} + static void runstate_init(void) { const RunStateTransition *p; --=20 2.42.0 From nobody Tue Nov 26 14:44:11 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=1706199003; cv=none; d=zohomail.com; s=zohoarc; b=f/4tGLaetXGYMxq8J/HSDqvirSBi+6la+tIHgcUgQ7U+xsWmjUR+41umfhHsWQhZvo1ahbeWf1LweL8M1PVUnkLbAvEZG9G9zL2plPP2pcdrIPIIryYvZUuloa/rAbX43JVzoyOziuxzCsYto+xw7KAWICIB6fpHycaKn7gazi4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706199003; 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=PXYesdu3hsPu714PDI+d8tBlJ30SYBBULiN8Gp2dXuY=; b=l+UqutzTGM2pkkFAkuo+kjaMYNa8bRYvTEi1cj2GhkAvHW2uq5IDInoSu7QorJ7vPk5oIkBb94oGCX+M8rv5NhxvDCmwbyTBO/p1lqnrHukVdaHK2+Q0Z2p9txT23yP8vqiZOW6DdxjAfOTtevFfSGh7cJIHKS92Q4Vbkv4COXo= 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 1706199003920778.7571163245291; Thu, 25 Jan 2024 08:10:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rT2Hk-0006rp-Jd; Thu, 25 Jan 2024 11:09:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rT2Hj-0006pN-KU for qemu-devel@nongnu.org; Thu, 25 Jan 2024 11:08:59 -0500 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rT2Hh-0000MB-9C for qemu-devel@nongnu.org; Thu, 25 Jan 2024 11:08:59 -0500 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2902b0e9524so3606968a91.1 for ; Thu, 25 Jan 2024 08:08:56 -0800 (PST) Received: from wheely.local0.net (110-175-3-177.tpgi.com.au. [110.175.3.177]) by smtp.gmail.com with ESMTPSA id oe7-20020a17090b394700b00293851b198csm14190pjb.56.2024.01.25.08.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 08:08:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706198935; x=1706803735; 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=PXYesdu3hsPu714PDI+d8tBlJ30SYBBULiN8Gp2dXuY=; b=bP0VdvZIF7gSFowO+XkH1cR4o4/jzbMt8rVtFVfmzLK7ojc8E4654kdMoV9tZrPbnV As5QkYPdz6WNtYL2cSLy8nPgXU0q4uXGZIACitE6dEGWsYKEgPNjsY90zvPv5FwU58P4 IQgiVotcorTrhDkTMGMY0XA7tsXBgwyuvB0ghFqBcAEqStrt/iKzzic/hPW7UlMmVfT2 r9L4zHX+oRsSZIHErQyWvYEEBG2aRb8MUAjguDv2JzBpoGJ1emggQszz+XjvOvw0azh8 hhBvjdkfkw5uR/kZ1tkwltxdYDTnpSfc4P57EZ4ZNoRGE/qC8Ry+KTG7pfd6DaDeu4tc 1hlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706198935; x=1706803735; 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=PXYesdu3hsPu714PDI+d8tBlJ30SYBBULiN8Gp2dXuY=; b=vphSHkPrSewgstpUK6mu8uDi/94Abs1fwpoaDCgcRa9lb1DQW2UStZNQ/Ab3ONm6Ks 9RgixcHpR5PZDLQOueipLlouUPoF8BVlbKgPtx3JRnfRLaqkZXqNcEdtpBytLNZ884sL Fb4NXA2uRICkZiOLz70yXac93r3/jw+x24+lavCH4pD0uH99Lyz58+iUIlVg4HCE6+Hs 8d9/TVnirXRk7SJHGbWdyR9sZ4rPzyY51HTyo0/ejV8YIvA1QloYYuO2JTSMudceK7qk U2BL5rTrN8ltF8hLvXE3r8S6L5S82ccZASrKCaGobXitBLLj9qsVgFN4EZX4n3c3LMC5 iB3A== X-Gm-Message-State: AOJu0YxiD9bMmDFJN1z4dZfADlIwC82np+JZfGLwJDrOXM2uyrHpfpoY 37JtpoJQwoles7vOabTaVb9mJph0rX5w5OBGzX6A0PnJ/ZyUfWnFvXEEfji4 X-Google-Smtp-Source: AGHT+IF+O973fT8qhZjyr12mUnjQ8BRXIVKxus8xxLNqGzqtpa17/z6sQNTz/RK5f3nPLJDxjB4G4Q== X-Received: by 2002:a17:90a:f291:b0:28e:7b66:73e4 with SMTP id fs17-20020a17090af29100b0028e7b6673e4mr768906pjb.5.1706198934714; Thu, 25 Jan 2024 08:08:54 -0800 (PST) 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 Subject: [PATCH v2 2/4] scripts/replay-dump.py: Update to current rr record format Date: Fri, 26 Jan 2024 02:08:33 +1000 Message-ID: <20240125160835.480488-3-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240125160835.480488-1-npiggin@gmail.com> References: <20240125160835.480488-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::1029; envelope-from=npiggin@gmail.com; helo=mail-pj1-x1029.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: 1706199005801100003 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Nicholas Piggin --- scripts/replay-dump.py | 132 ++++++++++++++++++++++++++++++----------- 1 file changed, 98 insertions(+), 34 deletions(-) diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py index d668193e79..35732da08f 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 @@ -63,6 +64,10 @@ def read_byte(fin): "Read a single byte" return struct.unpack('>B', fin.read(1))[0] =20 +def read_bytes(fin, nr): + "Read a nr bytes" + return fin.read(nr) + def read_event(fin): "Read a single byte event, but save some state" if replay_state.already_read: @@ -134,6 +139,18 @@ 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) + return True + +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 +159,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 +174,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, read_bytes(dum= pfile, 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 +212,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 +227,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 +239,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 +268,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 +306,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 +330,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 +360,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 +397,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 Nov 26 14:44:11 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=1706198994; cv=none; d=zohomail.com; s=zohoarc; b=A5pPGEzFVPrY+Dm6B7+f1znokfPom7xAJGk+nvY/ZaYGgq3z0gdWKp6CM/yiSOefJA0gZABOzgyUJPmeZgsGibVHdk3WVD3fWymgDwsUKca/LCVZFh9g0x0XX/gPTbFAP/Rgdr/GP6+evLkHHY8Gqb1Ieb1tkcsLx3TZAMWwtcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706198994; 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=xCathHofE5nAYfNrhxY2aVLV9v0ArUIt8XjBeYaXknw=; b=gEZUng4h94yv0ATUgMVrqg8JFDpnPs5Uyk5YeM2Wayaneygs8NbG4EyDtZcB4zIKDh2znEzisRZ9dgQ8dGRy/JbIecGPHsrOLQBsuTTE1PSBgy3mH+S4thm5w4HUQJzpvQfCVtprLxZslJLjizTdiJpqR4fBvRg3qMHEKjITdYU= 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 1706198994800278.9378675276246; Thu, 25 Jan 2024 08:09:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rT2Hp-0006vI-OJ; Thu, 25 Jan 2024 11:09:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rT2Hn-0006tm-Bh for qemu-devel@nongnu.org; Thu, 25 Jan 2024 11:09:03 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rT2Hl-0000Ms-MP for qemu-devel@nongnu.org; Thu, 25 Jan 2024 11:09:03 -0500 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2906bcae4feso2656265a91.3 for ; Thu, 25 Jan 2024 08:09:01 -0800 (PST) Received: from wheely.local0.net (110-175-3-177.tpgi.com.au. [110.175.3.177]) by smtp.gmail.com with ESMTPSA id oe7-20020a17090b394700b00293851b198csm14190pjb.56.2024.01.25.08.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 08:08:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706198940; x=1706803740; 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=xCathHofE5nAYfNrhxY2aVLV9v0ArUIt8XjBeYaXknw=; b=nV7oklE8XLyDNG1h8pPPZDV0HJpyPNSHtGsSXybhNYYPSwIfO+vL4jmmRVeghYAKb4 8H7sZ/6yzAgKE2kRg2WemgEU+zjCzQjf6S9lFtFF21czmUo7lrmHelgjJBeJMy9jx0B0 +8AoJLriop7uVaxuOLHZV5H1CHi1Tgylqf2GMrpyVZLdnA3YzX2xaRhht8Tuga/WIhtg XSfd1VMe/7XS5/a4+kV+qbonrYH7ur6QoiIgRRpPh68rX5yjhpvumaOFTpsrRCU/8gNJ 0/mqN03ZCfK+icKAuL7x9DKxTKG3ma+1ydNeNnV4+ZnPNR2it2L05fHzwviiGju0z3Je AmBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706198940; x=1706803740; 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=xCathHofE5nAYfNrhxY2aVLV9v0ArUIt8XjBeYaXknw=; b=wAmIkiDLrM34rmDuN9mXMyKc9zre01tOkil/ex25NmB/S1Q6nhNmCh42+N4WyEXzZT NrDYBMTzU60EK/Zjmdc3eBjMNlRlw3NxeLadfk/p1KTkljgvHF8OZAdqq3UJJOgz1HvZ aq2QypSuchegNM7sznUZ/WbSNEQpG2KNDU5aHlAwQaG3aPRPDbAN7rTtGLnBK7LEe4ub lMwsrfBMG4iHl3Zegge3rLKsZd7mUP8VWb4rd1x3pxu0Va5+6O7B188Sv3lBhRpskpay LU3MFmdb6wY6jZH6FF3YZnPIEfmbloLZd+309O4KoljRuJBmGkE2JG4zpyt3fkvMx38l yLzA== X-Gm-Message-State: AOJu0YyHS3YEbm2SMaDfegwi32sUZOhZK6XArGKEHzix7y6Grl+1Zopl tzUWYqY0vf9LtrKDJI9bIHboY1UtAgR9K9nCrEvMxMx1trNGqm9a01DCkkHl X-Google-Smtp-Source: AGHT+IFunAMcsDDVtG2FVN/xFXc73njkvk6lKoRcGL9Tem3cdEhL1zxhpgXOASFqGX0JtpN1Jb2BqQ== X-Received: by 2002:a17:90a:4411:b0:28e:73c0:85c with SMTP id s17-20020a17090a441100b0028e73c0085cmr783157pjg.76.1706198939712; Thu, 25 Jan 2024 08:08:59 -0800 (PST) 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 Subject: [PATCH v2 3/4] scripts/replay-dump.py: rejig decoders in event number order Date: Fri, 26 Jan 2024 02:08:34 +1000 Message-ID: <20240125160835.480488-4-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240125160835.480488-1-npiggin@gmail.com> References: <20240125160835.480488-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::102d; envelope-from=npiggin@gmail.com; helo=mail-pj1-x102d.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: 1706198995954100001 Content-Type: text/plain; charset="utf-8" Sort decoder functions to be ascending in order of event number, same as the decoder tables. 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 35732da08f..a1d7ae0364 100755 --- a/scripts/replay-dump.py +++ b/scripts/replay-dump.py @@ -144,6 +144,19 @@ def swallow_bytes(eid, name, dumpfile, nr): dumpfile.seek(nr, os.SEEK_CUR) 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_interrupt(eid, name, dumpfile): + print_event(eid, name) + return True + def decode_exception(eid, name, dumpfile): print_event(eid, name) return True @@ -203,15 +216,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 @@ -227,6 +231,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 @@ -257,25 +276,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 Nov 26 14:44:11 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=1706199031; cv=none; d=zohomail.com; s=zohoarc; b=ISs4rIEiFBrHlOeZJg8P6hOK5qVbQ9xwb+C0FkvOvEdcBOSEVIuAgVHOodkYX9xrFZ09ADdfSHIxB9Or9EQqEqnv/C4cnIUETdIGWUDpGCv0iQ2UUQtyedN2OECNo9U64E9jzbTqJHFG3Gp8QsQQxH0L6hitsORWf3Zl+0ACZ9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706199031; 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=pkwo7UCJpMNv5mPn2sWjbV8ooarPUagmTu1VnxL99W0=; b=cpbfwVgVkBFZhfhWKt1wksb8Xw9Wk2AVRwJwGHvrewWNk46LgsDbCGczrY8Ijb3rfxK6xQoC9C58Ro+UBRdR2PkLbTBkznSJr9Ou/bK+zteGW7MhLcIn4WZOuC+M67lUzBeiB+b04jLFdnVYsC2UppXyZMEO4G/ltCNccAYV13g= 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 17061990311001012.7283157467407; Thu, 25 Jan 2024 08:10:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rT2Hu-0006yl-FS; Thu, 25 Jan 2024 11:09:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rT2Ht-0006vj-44 for qemu-devel@nongnu.org; Thu, 25 Jan 2024 11:09:09 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rT2Hr-0000NS-75 for qemu-devel@nongnu.org; Thu, 25 Jan 2024 11:09:08 -0500 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so5279253a12.1 for ; Thu, 25 Jan 2024 08:09:06 -0800 (PST) Received: from wheely.local0.net (110-175-3-177.tpgi.com.au. [110.175.3.177]) by smtp.gmail.com with ESMTPSA id oe7-20020a17090b394700b00293851b198csm14190pjb.56.2024.01.25.08.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 08:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706198944; x=1706803744; 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=pkwo7UCJpMNv5mPn2sWjbV8ooarPUagmTu1VnxL99W0=; b=Pb+EbWFzONOflOcPXQ+B5pwth+kHgsvb/MiYrXFZ0nsweoNwnq7GQVn4FJ6M4C88m6 hmG9ZgsJJvifsfA87N2ILv2Nl0TD4ahRn8/B0YDC7abGtEy2gkr/N8vW3DwcLpaDJeHA +FS5M33G/IYybzkvDgweJXBvM0M9yNy8iZWKOzyFzEJmM2D9yTdyb6xcaTq++QV7bld7 FeCpxDH9Sy/QjkmQzZTlARyG4pvIj+nxjupqLWM3IkXWuCBED7PmPlvew5/st2IOgqoB uNXS5w/H/cC/+IToIQmWTnCNGrR6Bf46wL8OWv99gDS/rSitfiIjBorxGASWTQjJclnn n41w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706198944; x=1706803744; 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=pkwo7UCJpMNv5mPn2sWjbV8ooarPUagmTu1VnxL99W0=; b=W6sDYXQi8ec70dspaqj3GjUjS/HWr5+WfHfXbV732y//R+Rqe+h0hc7MPuFqDYm9YW N8N4FN49EtSb04hI4Pajk8AAIHGM7u2rmFAvTQa6Azdd9vQc1Ga1Bqjos0LUurxoTYTf K0DoZJ9UrcM4LOS4k89DDxApBbCOORdayPwj4LN0Kuf2QWFXQoXjIcsF+mIq5h7TtTFi D37tGJhkY1MNPUwRjHtiqcE3F+qUDBs1RZUqoFNN1xRD2HUL09vm0WTE4X1yvY1qCGDt U3a4uRKlk4wj7wMDoHsBsEN1P3CzRyB5O1siAB6nQfDjyk98RoIyWGdSTH9kSFbW6joO bATA== X-Gm-Message-State: AOJu0Ywnb05iUu+gcgbw9SyKGVlUyY1t3rQHJpaVpEVTePbauZ4rPp8y 52kF4MD/oZyaFV6aInXFnvF7MqlmMsZfrzCcN5B686Y5xD3lyPxg4q+hLXtC X-Google-Smtp-Source: AGHT+IHkq+KFB8siFeMpeiKhcBdVZCuCCy+rsE0uDvcSnJYCyTlA2yC3AXNw0dMDgrsuaHhs9EcEaw== X-Received: by 2002:a17:90a:d313:b0:290:f9b6:8078 with SMTP id p19-20020a17090ad31300b00290f9b68078mr1050445pju.7.1706198944532; Thu, 25 Jan 2024 08:09:04 -0800 (PST) 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 Subject: [PATCH v2 4/4] tests/avocado: excercise scripts/replay-dump.py in replay tests Date: Fri, 26 Jan 2024 02:08:35 +1000 Message-ID: <20240125160835.480488-5-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240125160835.480488-1-npiggin@gmail.com> References: <20240125160835.480488-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::52c; envelope-from=npiggin@gmail.com; helo=mail-pg1-x52c.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: 1706199031890100001 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. Signed-off-by: Nicholas Piggin Reviewed-by: Pavel Dovgalyuk --- scripts/replay-dump.py | 6 ++++-- tests/avocado/replay_kernel.py | 16 ++++++++++++++++ tests/avocado/replay_linux.py | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py index a1d7ae0364..bfea9c099b 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 @@ -104,7 +105,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 @@ -125,7 +126,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" @@ -439,6 +440,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..9b3ee6726b 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 @@ -22,6 +23,11 @@ from avocado.utils import process from boot_linux_console import LinuxKernelTest =20 +from pathlib import Path + +self_dir =3D Path(__file__).parent +src_dir =3D self_dir.parent.parent + class ReplayKernelBase(LinuxKernelTest): """ Boots a Linux kernel in record mode and checks that the console @@ -63,6 +69,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 +78,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], + cwd=3Dsrc_dir, stdout=3Dsubprocess.DEVNU= LL) + 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..dd148ff639 100644 --- a/tests/avocado/replay_linux.py +++ b/tests/avocado/replay_linux.py @@ -11,6 +11,7 @@ import os import logging import time +import subprocess =20 from avocado import skipUnless from avocado_qemu import BUILD_DIR @@ -21,6 +22,11 @@ from avocado.utils.path import find_command from avocado_qemu import LinuxTest =20 +from pathlib import Path + +self_dir =3D Path(__file__).parent +src_dir =3D self_dir.parent.parent + class ReplayLinux(LinuxTest): """ Boots a Linux system, checking for a successful initialization @@ -94,6 +100,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 +116,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], + cwd=3Dsrc_dir, stdout=3Dsubprocess.DEVNU= LL) + 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