From patchwork Fri Jun 23 12:57:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1798997 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=GsTkBAAe; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QnckZ2H8nz20XB for ; Fri, 23 Jun 2023 22:59:02 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgM6-0000O3-N0; Fri, 23 Jun 2023 08:57: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 1qCgLz-0000Nj-Gq; Fri, 23 Jun 2023 08:57:32 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCgLv-0006Ki-Cu; Fri, 23 Jun 2023 08:57:30 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1b55fc3a71cso3429725ad.2; Fri, 23 Jun 2023 05:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687525045; x=1690117045; 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=ZYZtbYx1tTraQPH5pnDjU5hHvHaeoahGbsVG3TIvXMg=; b=GsTkBAAeyWw9cvCfjF/KXwyd21YJHoMI9myzSZ3SCBkknxjrfVd9k1Fg9aXimB4tGR 1BuWkBH++qWsmmh8/UfkNniIGt0nTRRZ2PHoOIqO/+tQGIOExzkBvl+u+a4Fb4znlKOZ 8kovxhDxav9kJALTalBqbmAl0tD+XcPSOqIvw+KW10ayc4scs3wmF11zRq8W4PKcTHwa laYoK2GoA12nJop87L1ZnoBtplScLggNb6Qfxy3FvfiWaLdvJ/TtBpoGfKr2ljD6gMjC wicRh7p7DAJorpGWIBOqq8xFm5sJRpeq4xLn/aOX3HCG6vAjDSDUKhN6sxJ/JWGeqv0C kxxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687525045; x=1690117045; 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=ZYZtbYx1tTraQPH5pnDjU5hHvHaeoahGbsVG3TIvXMg=; b=BtZcmlcQ9Bn4Pr9z4v8TcFrrRmr0PaU6x7thVfakRLCFnoGoxrs4QgiMxEBvctSE0i +InpI0nOcS1NLZog0uM8ZNroOT4L5he8B6aqV7omDALI5iOyDLIckcITr9TfSGNjyF1Z N9Er7DBMHhgbK8KXll9rpkctnIku3lueaDqUTQiheQHZJqDn6gKZOvS/P1vsyxaDNqXr /Vfu6qPuWjLg04dpfHUEYnjlpliuunl5RfqPj7AYY9lecP5IAN3EtXmIeDu/2ypqQfpz Q1MjPHX08g0fIIgtLYsSfFWDsoYLkM1sPcHk7uP3BUbeEDhfT/GI7lu1RKM4DWcEf2UO xNUw== X-Gm-Message-State: AC+VfDxsENbrWeIvOr7HfM1zmUg7R9WPuxtOdQAlRO4xyqSx+Nmw9uSb t4mc6rUNpBNP5oiaHagCzJNUFkR5DPs= X-Google-Smtp-Source: ACHHUZ4vOUaPfPPoZUOa//MC44t0ln7NktuWtQtxC5vIPKMvsfubCmx/OkJD3o+WRr2xdxWTQHPeMA== X-Received: by 2002:a17:902:778d:b0:1b0:26f0:4c8e with SMTP id o13-20020a170902778d00b001b026f04c8emr14235770pll.69.1687525045556; Fri, 23 Jun 2023 05:57:25 -0700 (PDT) Received: from wheely.local0.net (193-116-198-102.tpgi.com.au. [193.116.198.102]) by smtp.gmail.com with ESMTPSA id b12-20020a170902bd4c00b001a04d27ee92sm7141795plx.241.2023.06.23.05.57.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 05:57:25 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson , Greg Kurz , Harsh Prateek Bora , John Snow , Cleber Rosa , Pavel Dovgalyuk , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Peter Maydell , Richard Henderson Subject: [PATCH 1/7] target/ppc: Fix CPU reservation migration for record-replay Date: Fri, 23 Jun 2023 22:57:01 +1000 Message-Id: <20230623125707.323517-2-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623125707.323517-1-npiggin@gmail.com> References: <20230623125707.323517-1-npiggin@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=npiggin@gmail.com; helo=mail-pl1-x635.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org ppc only migrates reserve_addr, so the destination machine can get a valid reservation with an incorrect reservation value of 0. Prior to commit 392d328abe753 ("target/ppc: Ensure stcx size matches larx"), this could permit a stcx. to incorrectly succeed. That commit inadvertently fixed that bug because the target machine starts with an impossible reservation size of 0, so any stcx. will fail. This behaviour is permitted by the ISA because reservation loss may have implementation-dependent cause. What's more, with KVM machines it is impossible save or reasonably restore reservation state. However if the vmstate is being used for record-replay, the reservation must be saved and restored exactly in order for execution from snapshot to match the record. This patch deprecates the existing incomplete reserve_addr vmstate, and adds a new vmstate subsection with complete reservation state. The new vmstate is needed only when record-replay mode is active. Signed-off-by: Nicholas Piggin Acked-by: Pavel Dovgalyuk --- target/ppc/cpu.h | 2 ++ target/ppc/machine.c | 26 ++++++++++++++++++++++++-- target/ppc/translate.c | 2 ++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 4138a25801..0087ce66e2 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1119,7 +1119,9 @@ struct CPUArchState { target_ulong reserve_addr; /* Reservation address */ target_ulong reserve_length; /* Reservation larx op size (bytes) */ target_ulong reserve_val; /* Reservation value */ +#if defined(TARGET_PPC64) target_ulong reserve_val2; +#endif /* These are used in supervisor mode only */ target_ulong msr; /* machine state register */ diff --git a/target/ppc/machine.c b/target/ppc/machine.c index 134b16c625..a817532e5b 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -10,6 +10,7 @@ #include "qemu/main-loop.h" #include "kvm_ppc.h" #include "power8-pmu.h" +#include "sysemu/replay.h" static void post_load_update_msr(CPUPPCState *env) { @@ -671,6 +672,27 @@ static const VMStateDescription vmstate_compat = { } }; +static bool reservation_needed(void *opaque) +{ + return (replay_mode != REPLAY_MODE_NONE); +} + +static const VMStateDescription vmstate_reservation = { + .name = "cpu/reservation", + .version_id = 1, + .minimum_version_id = 1, + .needed = reservation_needed, + .fields = (VMStateField[]) { + VMSTATE_UINTTL(env.reserve_addr, PowerPCCPU), + VMSTATE_UINTTL(env.reserve_length, PowerPCCPU), + VMSTATE_UINTTL(env.reserve_val, PowerPCCPU), +#if defined(TARGET_PPC64) + VMSTATE_UINTTL(env.reserve_val2, PowerPCCPU), +#endif + VMSTATE_END_OF_LIST() + } +}; + const VMStateDescription vmstate_ppc_cpu = { .name = "cpu", .version_id = 5, @@ -692,8 +714,7 @@ const VMStateDescription vmstate_ppc_cpu = { VMSTATE_UINTTL_ARRAY(env.spr, PowerPCCPU, 1024), VMSTATE_UINT64(env.spe_acc, PowerPCCPU), - /* Reservation */ - VMSTATE_UINTTL(env.reserve_addr, PowerPCCPU), + VMSTATE_UNUSED(sizeof(target_ulong)), /* was env.reserve_addr */ /* Supervisor mode architected state */ VMSTATE_UINTTL(env.msr, PowerPCCPU), @@ -722,6 +743,7 @@ const VMStateDescription vmstate_ppc_cpu = { &vmstate_tlbemb, &vmstate_tlbmas, &vmstate_compat, + &vmstate_reservation, NULL } }; diff --git a/target/ppc/translate.c b/target/ppc/translate.c index c9fb7b40a5..eb278c2683 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -77,7 +77,9 @@ static TCGv cpu_xer, cpu_so, cpu_ov, cpu_ca, cpu_ov32, cpu_ca32; static TCGv cpu_reserve; static TCGv cpu_reserve_length; static TCGv cpu_reserve_val; +#if defined(TARGET_PPC64) static TCGv cpu_reserve_val2; +#endif static TCGv cpu_fpscr; static TCGv_i32 cpu_access_type; From patchwork Fri Jun 23 12:57:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1798992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=onCmxQFS; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QnckM1vd0z20XB for ; Fri, 23 Jun 2023 22:58:51 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgMC-0000P8-OO; Fri, 23 Jun 2023 08:57: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 1qCgM5-0000O8-2n; Fri, 23 Jun 2023 08:57:38 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCgM3-0006Lw-78; Fri, 23 Jun 2023 08:57:36 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1b5422163f4so4227865ad.2; Fri, 23 Jun 2023 05:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687525052; x=1690117052; 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=WLjwbrwCcnOwIHYqGly36m5ilqRyrKG/b9OdDLkfmVo=; b=onCmxQFSjYlYAiC+Q9KjRVx4st5gL+lvipu6Qfzm30XyOQdGEWvJKgKwgIP0tL8b// WQ6sG/2lzrgyy1hazDFIv6SWgoQCHE7SIpnLsB0m1+L4ko6Iv4lnIP0oz5kQ/cGfe3ap L65mmHsNQog7cDdPWGURYF+a3Nj8IXm6d1G+uGaOvhZi6vk7/dxvxaP/84xCSwE/SyjM mpN24cNLwd1adiHTmDaZln99X3sRTB7J13UGS/WDikF8c1179+Ld9L2yngtif2OmnBSk wC5HyOZKKqYqCdeJ2CXykL8eKMQZWigqSwY+q+kj1TIEplJ5p6ZtEDR6L0fWtnAiW7Ph ZWIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687525052; x=1690117052; 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=WLjwbrwCcnOwIHYqGly36m5ilqRyrKG/b9OdDLkfmVo=; b=M8OxOTa7ST/tHnUKwh3Wx6jao7m97qilejEzio/6UZb823/wKfQC+01ao4T0CQgVQH beXHivwV7omAnrlbW1fmqiuQ0IuX6yFqc99c8moRBzD2PboCdajQBRu66uqB60S8bBvu fyNuB5P9BA7st3aW/emmPI5uB5pez+QOVFR2y9Rq2b4CCrrqP5FAnEMuvE9IremlnVm2 o6FVWv7h3tHH+40XyWQ8HpVSdBeXrfK0r0OrPZMKYH/CcZ08Vpn8rreXa+j3TapC0aWT CsyZWaznl+ltmjFYrWEbMpYJfQGLUUFLz8HUL15UwIAyMOe+wk7jOTJ05GYZkDL/WXFS b+Dw== X-Gm-Message-State: AC+VfDwlKLfoJf4Juu7gsWUZcZ974CYEjNt83b7NSwHoZeLedpgoTeWh DtjSkNML8ajkgWGO09IMPq8sHKxa+Os= X-Google-Smtp-Source: ACHHUZ4EdfkQpEObJ2Dr5MfwBoTxg7qPgp8LSaML9GvgJUYIbSC1FZuTDdiUTgk2enuHrMqL369aTQ== X-Received: by 2002:a17:902:f542:b0:1b6:ba60:780e with SMTP id h2-20020a170902f54200b001b6ba60780emr3869055plf.24.1687525052417; Fri, 23 Jun 2023 05:57:32 -0700 (PDT) Received: from wheely.local0.net (193-116-198-102.tpgi.com.au. [193.116.198.102]) by smtp.gmail.com with ESMTPSA id b12-20020a170902bd4c00b001a04d27ee92sm7141795plx.241.2023.06.23.05.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 05:57:32 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson , Greg Kurz , Harsh Prateek Bora , John Snow , Cleber Rosa , Pavel Dovgalyuk , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Peter Maydell , Richard Henderson Subject: [PATCH 2/7] scripts/replay_dump.sh: Update to current rr record format Date: Fri, 23 Jun 2023 22:57:02 +1000 Message-Id: <20230623125707.323517-3-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623125707.323517-1-npiggin@gmail.com> References: <20230623125707.323517-1-npiggin@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=npiggin@gmail.com; helo=mail-pl1-x629.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This thing seems to have fallen by the wayside. This quick hack gets it vaguely working with the current format. It was some use in fixing rr support for ppc, so maybe others will find it useful too. Signed-off-by: Nicholas Piggin --- scripts/replay-dump.py | 89 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 6 deletions(-) diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py index 3ba97a6d30..c46ff8ffd6 100755 --- a/scripts/replay-dump.py +++ b/scripts/replay-dump.py @@ -122,12 +122,19 @@ def swallow_async_qword(eid, name, dumpfile): print(" %s(%d) @ %d" % (name, eid, step_id)) return True +def swallow_bytes(eid, name, dumpfile, nr): + "Swallow nr bytes of data without looking at it" + for x in range(nr): + read_byte(dumpfile) + return True + async_decode_table = [ Decoder(0, "REPLAY_ASYNC_EVENT_BH", swallow_async_qword), - Decoder(1, "REPLAY_ASYNC_INPUT", decode_unimp), - Decoder(2, "REPLAY_ASYNC_INPUT_SYNC", decode_unimp), - Decoder(3, "REPLAY_ASYNC_CHAR_READ", decode_unimp), - Decoder(4, "REPLAY_ASYNC_EVENT_BLOCK", decode_unimp), - Decoder(5, "REPLAY_ASYNC_EVENT_NET", decode_unimp), + Decoder(1, "REPLAY_ASYNC_BH_ONESHOT", decode_unimp), + Decoder(2, "REPLAY_ASYNC_INPUT", decode_unimp), + Decoder(3, "REPLAY_ASYNC_INPUT_SYNC", decode_unimp), + Decoder(4, "REPLAY_ASYNC_CHAR_READ", decode_unimp), + Decoder(5, "REPLAY_ASYNC_EVENT_BLOCK", decode_unimp), + Decoder(6, "REPLAY_ASYNC_EVENT_NET", decode_unimp), ] # See replay_read_events/replay_read_event def decode_async(eid, name, dumpfile): @@ -156,6 +163,13 @@ def decode_audio_out(eid, name, dumpfile): print_event(eid, name, "%d" % (audio_data)) return True +def decode_random(eid, name, dumpfile): + ret = read_dword(dumpfile) + size = read_dword(dumpfile) + swallow_bytes(eid, name, dumpfile, size) + print_event(eid, name, "%d %d" % (ret, size)) + return True + def decode_checkpoint(eid, name, dumpfile): """Decode a checkpoint. @@ -184,6 +198,24 @@ def decode_interrupt(eid, name, dumpfile): print_event(eid, name) return True +def decode_exception(eid, name, dumpfile): + print_event(eid, name) + return True + +def decode_shutdown(eid, name, dumpfile): + print_event(eid, name) + return True + +def decode_end(eid, name, dumpfile): + print_event(eid, name) + return False + +def decode_char_write(eid, name, dumpfile): + res = read_dword(dumpfile) + offset = read_dword(dumpfile) + print_event(eid, name) + return True + def decode_clock(eid, name, dumpfile): clock_data = read_qword(dumpfile) print_event(eid, name, "0x%x" % (clock_data)) @@ -268,6 +300,48 @@ def decode_clock(eid, name, dumpfile): Decoder(28, "EVENT_CP_RESET", decode_checkpoint), ] +v12_event_table = [Decoder(0, "EVENT_INSTRUCTION", decode_instruction), + Decoder(1, "EVENT_INTERRUPT", decode_interrupt), + Decoder(2, "EVENT_EXCEPTION", decode_exception), + Decoder(3, "EVENT_ASYNC_BH", swallow_async_qword), + Decoder(4, "EVENT_ASYNC_BH_ONESHOT", decode_unimp), + Decoder(5, "EVENT_ASYNC_INPUT", decode_unimp), + Decoder(6, "EVENT_ASYNC_INPUT_SYNC", decode_unimp), + Decoder(7, "EVENT_ASYNC_CHAR_READ", decode_unimp), + Decoder(8, "EVENT_ASYNC_BLOCK", decode_unimp), + Decoder(9, "EVENT_ASYNC_NET", decode_unimp), + Decoder(10, "EVENT_SHUTDOWN", decode_unimp), + Decoder(11, "EVENT_SHUTDOWN_HOST_ERR", decode_shutdown), + Decoder(12, "EVENT_SHUTDOWN_HOST_QMP_QUIT", decode_shutdown), + Decoder(13, "EVENT_SHUTDOWN_HOST_QMP_RESET", decode_shutdown), + Decoder(14, "EVENT_SHUTDOWN_HOST_SIGNAL", decode_shutdown), + Decoder(15, "EVENT_SHUTDOWN_HOST_UI", decode_shutdown), + Decoder(16, "EVENT_SHUTDOWN_GUEST_SHUTDOWN", decode_shutdown), + Decoder(17, "EVENT_SHUTDOWN_GUEST_RESET", decode_shutdown), + Decoder(18, "EVENT_SHUTDOWN_GUEST_PANIC", decode_shutdown), + Decoder(19, "EVENT_SHUTDOWN_SUBSYS_RESET", decode_shutdown), + Decoder(20, "EVENT_SHUTDOWN_SNAPSHOT_LOAD", decode_shutdown), + 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_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), + Decoder(30, "EVENT_CP_CLOCK_WARP_START", decode_checkpoint), + Decoder(31, "EVENT_CP_CLOCK_WARP_ACCOUNT", decode_checkpoint), + Decoder(32, "EVENT_CP_RESET_REQUESTED", decode_checkpoint), + Decoder(33, "EVENT_CP_SUSPEND_REQUESTED", decode_checkpoint), + Decoder(34, "EVENT_CP_CLOCK_VIRTUAL", decode_checkpoint), + Decoder(35, "EVENT_CP_CLOCK_HOST", decode_checkpoint), + Decoder(36, "EVENT_CP_CLOCK_VIRTUAL_RT", decode_checkpoint), + Decoder(37, "EVENT_CP_INIT", decode_checkpoint_init), + Decoder(38, "EVENT_CP_RESET", decode_checkpoint), + Decoder(39, "EVENT_END", decode_end), +] + def parse_arguments(): "Grab arguments for script" parser = argparse.ArgumentParser() @@ -285,7 +359,10 @@ def decode_file(filename): print("HEADER: version 0x%x" % (version)) - if version == 0xe02007: + if version == 0xe0200c: + event_decode_table = v12_event_table + replay_state.checkpoint_start = 12 + elif version == 0xe02007: event_decode_table = v7_event_table replay_state.checkpoint_start = 12 elif version == 0xe02006: From patchwork Fri Jun 23 12:57:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1798985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=bB4r7P9D; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QncjD4nTSz20XB for ; Fri, 23 Jun 2023 22:57:52 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgMF-0000Q3-6E; Fri, 23 Jun 2023 08:57: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 1qCgMC-0000P3-IV; Fri, 23 Jun 2023 08:57:44 -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 1qCgMA-0006Q8-UE; Fri, 23 Jun 2023 08:57:44 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6686c74183cso424430b3a.1; Fri, 23 Jun 2023 05:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687525059; x=1690117059; 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=Tuemuz9+yMRA0aIIj5fzqEDX8XdmM6dDu+ce4c9JhTE=; b=bB4r7P9DM5+cpvZJaXk+5gX55lHPBFSmgZjsJVkTfX7sMB/tidp68n8bWYyy4FTqeQ XhLoCo+/H6tDP3lWJ1f2NGjk5FwstPZah5hQ/US+vtoCopMcc5xuQx+nA1hw+Z+AKcVO 37wDGHJpT+4dEBXFiurYUs7061gKtIhQv9EaNAN23e5Bd8Tmf4clEAB3q8KnZRldmkEz FYrpahQws9tirQ4ELSaJFVDQRvoVvPx9LH4eM/lWAqmOkfbFuGcV7r4+Rc4BxypmS6v1 tu/b4J/GEyFv1x9e11JBhofICt8Cu1MKC62unZ+81CaksMESpiGaFjz6SBl6qQcQieHX OqTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687525059; x=1690117059; 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=Tuemuz9+yMRA0aIIj5fzqEDX8XdmM6dDu+ce4c9JhTE=; b=BBJGrlaqdZs64kv3YNkncRpAqK2d2Ck1LUn8v+861a1odEGj4BgMCBeyqis0JifP9S DvagqKCKMSn6wmd38z+QlOkKofOzOBvh0sIBEMYU0eIH3WPxKrX6wncx9tCrtnZWR5/d 1ioBxNskVWaIMvV5qnF2nNGY6q4jxv8X+ayCteImkabMjx7CXAp7hANYpnIO/Oi7evbw bHFR+NkZUKVzlmLRQabdGr/cblaujnYD6yzzcaaOXNOC7mhAykspBhqQKXmg3VM0EoAn 2zN+vSa3vN5O/jTMXwEJ/ZGa/0NXEx5SZjv8enbQAsbbZAK7SbcssO3AbHRyJOvWkExT 7heQ== X-Gm-Message-State: AC+VfDxTZ0+BnJli55VbjEEsbhIaimPoB722fqH6o+/vHZhcavslkc61 Bi9yhmi+URyAihtbEmpEF9bvbwqgFjU= X-Google-Smtp-Source: ACHHUZ4TSiaX6Kevkrc3Lc13nd3arZd3KviKJoFcQnHDhswOtQtZa1y8XOXYST3MSCycXyDEXxb40g== X-Received: by 2002:a05:6a20:548c:b0:123:100e:c8ae with SMTP id i12-20020a056a20548c00b00123100ec8aemr10576577pzk.52.1687525059285; Fri, 23 Jun 2023 05:57:39 -0700 (PDT) Received: from wheely.local0.net (193-116-198-102.tpgi.com.au. [193.116.198.102]) by smtp.gmail.com with ESMTPSA id b12-20020a170902bd4c00b001a04d27ee92sm7141795plx.241.2023.06.23.05.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 05:57:39 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson , Greg Kurz , Harsh Prateek Bora , John Snow , Cleber Rosa , Pavel Dovgalyuk , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Peter Maydell , Richard Henderson Subject: [PATCH 3/7] spapr: Fix machine reset deadlock from replay-record Date: Fri, 23 Jun 2023 22:57:03 +1000 Message-Id: <20230623125707.323517-4-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623125707.323517-1-npiggin@gmail.com> References: <20230623125707.323517-1-npiggin@gmail.com> MIME-Version: 1.0 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When the machine is reset to load a new snapshot while being debugged with replay-record, it is done from another thread, so the CPU does not run the register setting operations. Set CPU registers directly in machine reset. Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 20 ++++++++++++++++++-- include/hw/ppc/spapr.h | 1 + target/ppc/compat.c | 19 +++++++++++++++++++ target/ppc/cpu.h | 1 + 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 677b5eef9d..d290acfa95 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1317,6 +1317,22 @@ void spapr_set_all_lpcrs(target_ulong value, target_ulong mask) } } +/* May be used when the machine is not running */ +void spapr_init_all_lpcrs(target_ulong value, target_ulong mask) +{ + CPUState *cs; + CPU_FOREACH(cs) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; + target_ulong lpcr; + + lpcr = env->spr[SPR_LPCR]; + lpcr &= ~(LPCR_HR | LPCR_UPRT); + ppc_store_lpcr(cpu, lpcr); + } +} + + static bool spapr_get_pate(PPCVirtualHypervisor *vhyp, PowerPCCPU *cpu, target_ulong lpid, ppc_v3_pate_t *entry) { @@ -1578,7 +1594,7 @@ int spapr_reallocate_hpt(SpaprMachineState *spapr, int shift, Error **errp) } /* We're setting up a hash table, so that means we're not radix */ spapr->patb_entry = 0; - spapr_set_all_lpcrs(0, LPCR_HR | LPCR_UPRT); + spapr_init_all_lpcrs(0, LPCR_HR | LPCR_UPRT); return 0; } @@ -1656,7 +1672,7 @@ static void spapr_machine_reset(MachineState *machine, ShutdownCause reason) spapr_ovec_cleanup(spapr->ov5_cas); spapr->ov5_cas = spapr_ovec_new(); - ppc_set_compat_all(spapr->max_compat_pvr, &error_fatal); + ppc_init_compat_all(spapr->max_compat_pvr, &error_fatal); /* * This is fixing some of the default configuration of the XIVE diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 538b2dfb89..f47e8419a5 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -1012,6 +1012,7 @@ bool spapr_check_pagesize(SpaprMachineState *spapr, hwaddr pagesize, #define SPAPR_OV5_XIVE_BOTH 0x80 /* Only to advertise on the platform */ void spapr_set_all_lpcrs(target_ulong value, target_ulong mask); +void spapr_init_all_lpcrs(target_ulong value, target_ulong mask); hwaddr spapr_get_rtas_addr(void); bool spapr_memory_hot_unplug_supported(SpaprMachineState *spapr); diff --git a/target/ppc/compat.c b/target/ppc/compat.c index 7949a24f5a..ebef2cccec 100644 --- a/target/ppc/compat.c +++ b/target/ppc/compat.c @@ -229,6 +229,25 @@ int ppc_set_compat_all(uint32_t compat_pvr, Error **errp) return 0; } +/* To be used when the machine is not running */ +int ppc_init_compat_all(uint32_t compat_pvr, Error **errp) +{ + CPUState *cs; + + CPU_FOREACH(cs) { + PowerPCCPU *cpu = POWERPC_CPU(cs); + int ret; + + ret = ppc_set_compat(cpu, compat_pvr, errp); + + if (ret < 0) { + return ret; + } + } + + return 0; +} + int ppc_compat_max_vthreads(PowerPCCPU *cpu) { const CompatInfo *compat = compat_by_pvr(cpu->compat_pvr); diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 0087ce66e2..a0f4cec606 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1496,6 +1496,7 @@ int ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp); #if !defined(CONFIG_USER_ONLY) int ppc_set_compat_all(uint32_t compat_pvr, Error **errp); +int ppc_init_compat_all(uint32_t compat_pvr, Error **errp); #endif int ppc_compat_max_vthreads(PowerPCCPU *cpu); void ppc_compat_add_property(Object *obj, const char *name, From patchwork Fri Jun 23 12:57:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1798987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=eNCHveKU; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qncjg2cTlz20XB for ; Fri, 23 Jun 2023 22:58:15 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgMJ-0000W7-S8; Fri, 23 Jun 2023 08:57:51 -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 1qCgMI-0000Sn-2M; Fri, 23 Jun 2023 08:57:50 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCgMG-0006Ri-7j; Fri, 23 Jun 2023 08:57:49 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-54290603887so382586a12.1; Fri, 23 Jun 2023 05:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687525066; x=1690117066; 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=vPVziyxEWerMj/TzPold0Nq7Z0giPqF+Gq4GzlvWGMI=; b=eNCHveKUJa24DCz9/Hh2WWkkHwDJ7Lbo0o+i5RVTBnyKI+Uugp2oveX+mBY4Ovk3nr S2Lg/PxVYoxkAtJ6WHOhZIC0BiwG827dVz9iRgSGD+vr+Ed+yzPzHcMG98W0cDJJ3bBx zqo8sa9+I7L3vf39zUlpJPp7W7jRePbwS7h1opmfNL+yyDBtlqgIw1h66jwnWK5iMZzQ z9kvnEWgw7cnjBLw8LKV0WNxMtDWtR0jXrj6veVOoVEm3byuhCvk+9yVMX+06opBiFX/ 99rinYQhceQAI0UQgQhS+JCH0ZRPYjb6WcG/sSLLU3GbNgZ9l3agG8VrWo39eiDQgG/b F20A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687525066; x=1690117066; 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=vPVziyxEWerMj/TzPold0Nq7Z0giPqF+Gq4GzlvWGMI=; b=ce8ynNRkjo90nGML4+5r2BxbbxXJ6Jsa3+bFpoDx45To36g6/f2gvqCCR1Fwlbgf+Q wbmlN1j5Up6GZQeO2Ihbh9eFF0FnfL6EterfvDfPOpO0ANJG4AVHzMFnn5KCl6J4lYVQ UnH6Pnp1FZ8C2V0bwkccuXMyal8oFvr6Nt03f1g1VHvD0vKufgKAmAS7e7ey2s+jlsfH idHLz5QrsVx1pnzKUWN6p3X1WbdRS/GSgEzr8y3Flm3zp9RVpY521CrQhXYPAWCQ720A VlhchR0ADYumfpScqTn4HHhL2+tlzlV2xlYGGgnCpx9U8VQ4OnfItZfD17Gx0RDA52oR tKTQ== X-Gm-Message-State: AC+VfDwZvhtReJRxfr4Dj44TYIo0Ks8U13UcpGqvunV7kSoPf2+D6Nue t2rdUUouToPvCecQCOQ2xkz43x2usHA= X-Google-Smtp-Source: ACHHUZ7mQMEIz053ceNHRJFcgcwKn5bCe7D2Xu+HI+Tg/FkxWdYNhNI/HAUrQm455LTmsJ6zWxZcoA== X-Received: by 2002:a17:902:7c92:b0:1b3:91f7:4883 with SMTP id y18-20020a1709027c9200b001b391f74883mr9326153pll.46.1687525066227; Fri, 23 Jun 2023 05:57:46 -0700 (PDT) Received: from wheely.local0.net (193-116-198-102.tpgi.com.au. [193.116.198.102]) by smtp.gmail.com with ESMTPSA id b12-20020a170902bd4c00b001a04d27ee92sm7141795plx.241.2023.06.23.05.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 05:57:46 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson , Greg Kurz , Harsh Prateek Bora , John Snow , Cleber Rosa , Pavel Dovgalyuk , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Peter Maydell , Richard Henderson Subject: [PATCH 4/7] spapr: Fix record-replay machine reset consuming too many events Date: Fri, 23 Jun 2023 22:57:04 +1000 Message-Id: <20230623125707.323517-5-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623125707.323517-1-npiggin@gmail.com> References: <20230623125707.323517-1-npiggin@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=npiggin@gmail.com; helo=mail-pg1-x52a.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org spapr_machine_reset gets a random number to populate the device-tree rng seed with. When loading a snapshot for record-replay, the machine is reset again, and that tries to consume the random event record again, crashing due to inconsistent record Fix this by saving the seed to populate the device tree with, and skipping the rng on snapshot load. Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 12 +++++++++--- include/hw/ppc/spapr.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index d290acfa95..55948f233f 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1017,7 +1017,6 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset) { MachineState *machine = MACHINE(spapr); SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine); - uint8_t rng_seed[32]; int chosen; _FDT(chosen = fdt_add_subnode(fdt, 0, "chosen")); @@ -1095,8 +1094,7 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset) spapr_dt_ov5_platform_support(spapr, fdt, chosen); } - qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed)); - _FDT(fdt_setprop(fdt, chosen, "rng-seed", rng_seed, sizeof(rng_seed))); + _FDT(fdt_setprop(fdt, chosen, "rng-seed", spapr->fdt_rng_seed, 32)); _FDT(spapr_dt_ovec(fdt, chosen, spapr->ov5_cas, "ibm,architecture-vec-5")); } @@ -1649,6 +1647,14 @@ static void spapr_machine_reset(MachineState *machine, ShutdownCause reason) void *fdt; int rc; + if (reason != SHUTDOWN_CAUSE_SNAPSHOT_LOAD) { + /* + * Record-replay snapshot load must not consume random, this was + * already replayed from initial machine reset. + */ + qemu_guest_getrandom_nofail(spapr->fdt_rng_seed, 32); + } + pef_kvm_reset(machine->cgs, &error_fatal); spapr_caps_apply(spapr); diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index f47e8419a5..f4bd204d86 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -204,6 +204,7 @@ struct SpaprMachineState { uint32_t fdt_size; uint32_t fdt_initial_size; void *fdt_blob; + uint8_t fdt_rng_seed[32]; long kernel_size; bool kernel_le; uint64_t kernel_addr; From patchwork Fri Jun 23 12:57:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1798989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=lhTJ7ykt; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qncjp1Flqz20Xp for ; Fri, 23 Jun 2023 22:58:22 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgMQ-0000bO-2I; Fri, 23 Jun 2023 08:57:58 -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 1qCgMO-0000YG-Fi; Fri, 23 Jun 2023 08:57:56 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCgMM-0006St-Rk; Fri, 23 Jun 2023 08:57:56 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1b52d14df27so3232495ad.0; Fri, 23 Jun 2023 05:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687525073; x=1690117073; 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=PfTBS/AlA3Z4eD6Q+vPTYsZBcNTGo2xV3qOIbiykjsY=; b=lhTJ7yktpGWkCuu0QTUPYpU84/zB5b+o0KEB18IzaJahsNY7zI+F7Cfav1a1eBssaK DNkE59kEYlhNlHEmKT1sZjvCpxUK7ssENMOd8nPQj4q+TjHHCsM5zzM6avPdbBj0MSTl SY+c95cgYkfARC18O6TFqGQdwDQT4Sep11lgPUBw11odSV1JSRk3RGRt8kycPHr6L4hC ToYZoFkgvpVOz/TgsMhD+kgSl5ubpjfk4pE43z5+nOiAFFJf8ZQNMQN3oF2v526EDgWX jnuqCzc7PuzoyF8mg7vixKNEiWU3+1hMAjKQviAE0WwCkBIL3sDEgWh8OvOjqTLR7qHo epxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687525073; x=1690117073; 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=PfTBS/AlA3Z4eD6Q+vPTYsZBcNTGo2xV3qOIbiykjsY=; b=JW7Eg9f2/arHxkEkHA/qvV7bh3VJ15aVsGTED80I+Sg/l3zn+Qq8rCWCXNC++78/Wh NxCPhDNgj+MNpuyB2JQCZ0bjksqdDqaYzBTRV7ubZrTF4hFGqWbMqCDAELsGd3jE5BFZ vP1K6HF75AOBRDVTiOJAxzKnDV1Hqd0AJKUvahOzc0gwJZHFfvOmiOP74zavZFT3DPy/ jzE6VyqFkxE7JA2RnJur8fvtYldVC1MjKqqX3pnzMIPIt2pOimjc76AVYC0VoYAicozR dtcpo1kLkzSsVg7IgVOrWQx9ya07pGkvHw243u352IidcrCQQCEpffPloVEN72LExSzb 8B1Q== X-Gm-Message-State: AC+VfDzJW24tCXJHUORx7m6I9FJKi3L5iqJ+ixIH/Vk8emwgSnZ6gUAq Rwh/YGasw/PVV+g1sm/+0vQqMcU7Q7s= X-Google-Smtp-Source: ACHHUZ4jyHWlsnfqFbTdZSFGWCiQDBqIRkLDe7zlDkYXIwEPUo6cWZgUWYN4dJf0mM6mM2sCgAz3oA== X-Received: by 2002:a17:902:d506:b0:1b6:6c32:598b with SMTP id b6-20020a170902d50600b001b66c32598bmr10927209plg.21.1687525073088; Fri, 23 Jun 2023 05:57:53 -0700 (PDT) Received: from wheely.local0.net (193-116-198-102.tpgi.com.au. [193.116.198.102]) by smtp.gmail.com with ESMTPSA id b12-20020a170902bd4c00b001a04d27ee92sm7141795plx.241.2023.06.23.05.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 05:57:52 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson , Greg Kurz , Harsh Prateek Bora , John Snow , Cleber Rosa , Pavel Dovgalyuk , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Peter Maydell , Richard Henderson Subject: [PATCH 5/7] target/ppc: Fix timebase reset with record-replay Date: Fri, 23 Jun 2023 22:57:05 +1000 Message-Id: <20230623125707.323517-6-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623125707.323517-1-npiggin@gmail.com> References: <20230623125707.323517-1-npiggin@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=npiggin@gmail.com; helo=mail-pl1-x635.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Timebase save uses a random number for a legacy vmstate field, which makes rr snapshot loading unbalanced. The easiest way to deal with this is just to skip the rng if record-replay is active. Signed-off-by: Nicholas Piggin Reviewed-by: Pavel Dovgalyuk --- hw/ppc/ppc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 82e4408c5c..7b7db30f95 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -32,6 +32,7 @@ #include "qemu/main-loop.h" #include "qemu/error-report.h" #include "sysemu/kvm.h" +#include "sysemu/replay.h" #include "sysemu/runstate.h" #include "kvm_ppc.h" #include "migration/vmstate.h" @@ -933,8 +934,14 @@ static void timebase_save(PPCTimebase *tb) return; } - /* not used anymore, we keep it for compatibility */ - tb->time_of_the_day_ns = qemu_clock_get_ns(QEMU_CLOCK_HOST); + if (replay_mode == REPLAY_MODE_NONE) { + /* not used anymore, we keep it for compatibility */ + tb->time_of_the_day_ns = qemu_clock_get_ns(QEMU_CLOCK_HOST); + } else { + /* simpler for record-replay to avoid this event, compat not needed */ + tb->time_of_the_day_ns = 0; + } + /* * tb_offset is only expected to be changed by QEMU so * there is no need to update it from KVM here From patchwork Fri Jun 23 12:57:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1798994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=gAsuIJnb; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QnckY04fNz20Xp for ; Fri, 23 Jun 2023 22:59:00 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgMi-0000vu-1g; Fri, 23 Jun 2023 08:58:16 -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 1qCgMW-0000kU-JZ; Fri, 23 Jun 2023 08:58:06 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCgMU-0006TR-0V; Fri, 23 Jun 2023 08:58:03 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1b52864b701so4140105ad.3; Fri, 23 Jun 2023 05:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687525080; x=1690117080; 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=9hBlZWCigu09b7x1XsQAmOGL3rNxmzCeDZ1t+KZi1LM=; b=gAsuIJnbN+IZtFHfzBE0eK1CiYXALn4v35mDb6ywNbnbhEvbhT/0LVIZrLF/RX+wHm Wo8Lk5YoQDbqzvcX282X7cOPWB80ygmJCbgE3QbT73MQqS7dEedxuxozDufVYv5M+uya /2Mbm+Qx2zO7dvXjEV7dD+PriRViTm40OBApdMVnGvET+UxuKuAA4Oy9jKg+sgJci2dL Y0GNyliyDD4kuphCn0kdsR3LtGPYojkXdO8mCnCyk7fu4/86uAuXmXUQA2oq1VSkUxvN RpaUsF5NV8sDjQoRIJX8N9Std7KonJijQPCICPk0Yju8k9cqNu1KbfAfEIMGHgFWdgh6 jx6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687525080; x=1690117080; 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=9hBlZWCigu09b7x1XsQAmOGL3rNxmzCeDZ1t+KZi1LM=; b=XzfesIaTLaVgQ/23jiRQ72T6lf6lRfhXtgodxHbw5W8ESNYue6A3G/RkriYrw3qTIG Fc3o0tWLQPCNikTJvotaqNMt5FPr1qwEd5kAYTrtc0o/7F8VH4kRt5wunMfiZWLFCr8S DrF/IogZYoY6TYt3rKsQRKcYu3xFtb3S2gFldDTyPYLYVWO/SUZ9PxWv3ksnRBGvu1Ia N7Br0nh5AKZjP7WHPj28UCTlsBKE9hJKeiW98u2KLiBQb7FcAVBvnXuJ18rAFeK1i3NZ T+HqiKu9KZosGwZsFQQQrjvNSMbW3IJ/IVbYEu8WuF8X9Y/MOcdg9yoGc6NjSLHX92kd 45CA== X-Gm-Message-State: AC+VfDyRUPEo4smDeSLEsqGOdLqnb5Ba2Os69OCHH/2nU2rkeed5r2AC K6KrgwuxQv7MOsjF88++ef7GGZdl8Ro= X-Google-Smtp-Source: ACHHUZ6QmyKlEk7DAaZQwKk50GiasYz6kI7oD3b1+J08XNaj/e/zWCcXOl1Bcui127NwfalUFQWVYQ== X-Received: by 2002:a17:902:e751:b0:1b6:b805:5ae3 with SMTP id p17-20020a170902e75100b001b6b8055ae3mr3973321plf.3.1687525079992; Fri, 23 Jun 2023 05:57:59 -0700 (PDT) Received: from wheely.local0.net (193-116-198-102.tpgi.com.au. [193.116.198.102]) by smtp.gmail.com with ESMTPSA id b12-20020a170902bd4c00b001a04d27ee92sm7141795plx.241.2023.06.23.05.57.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 05:57:59 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson , Greg Kurz , Harsh Prateek Bora , John Snow , Cleber Rosa , Pavel Dovgalyuk , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Peter Maydell , Richard Henderson Subject: [PATCH 6/7] tests/avocado: boot ppc64 pseries replay-record test to Linux VFS mount Date: Fri, 23 Jun 2023 22:57:06 +1000 Message-Id: <20230623125707.323517-7-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623125707.323517-1-npiggin@gmail.com> References: <20230623125707.323517-1-npiggin@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=npiggin@gmail.com; helo=mail-pl1-x633.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This the ppc64 record-replay test is able to replay the full kernel boot so try enabling it. Signed-off-by: Nicholas Piggin --- tests/avocado/replay_kernel.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/avocado/replay_kernel.py b/tests/avocado/replay_kernel.py index fe1e901f4b..a4dc8c0d6c 100644 --- a/tests/avocado/replay_kernel.py +++ b/tests/avocado/replay_kernel.py @@ -255,8 +255,7 @@ def test_ppc64_pseries(self): kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0' - # icount is not good enough for PPC64 for complete boot yet - console_pattern = 'Kernel command line: %s' % kernel_command_line + console_pattern = 'VFS: Cannot open root device' self.run_rr(kernel_path, kernel_command_line, console_pattern) def test_m68k_q800(self): From patchwork Fri Jun 23 12:57:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1798988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=bM01o8W6; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qncjn6FwBz20XB for ; Fri, 23 Jun 2023 22:58:21 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgMk-0001G7-1P; Fri, 23 Jun 2023 08:58:18 -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 1qCgMg-0000vT-6T; Fri, 23 Jun 2023 08:58:15 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCgMc-0006UJ-Ml; Fri, 23 Jun 2023 08:58:13 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1b52bf6e659so3159195ad.3; Fri, 23 Jun 2023 05:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687525087; x=1690117087; 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=ekB+n0pvhBE4oDDClDofItiQvFeklJBwzGHlLI89v7E=; b=bM01o8W6fXegQg6teU++MN3kFduP79ib8cQ9oCQ8TybDYucVrpGIx9cg/5USi6Qc5V Z9hmAfmmSauEPEoSEsL76QVI5c8+1GWoXEoS0VxHwV06ijufiJJZ1UhZvU9iLzUwdCIw QWR8RTtwlZ+KH3tcewYhkrjJXE6OLrPDIVZXjl+oxZgrSGGs4SnqGgMjs3G4T7BiiPQn s+Jf2BrW6FfwJE8cdZcKw8oc66x7sOiUBiDdQ/PgbIjkRb/Uht6w43xgU9qT4bAU3j5X aGSddKdE668efaqyGKX02hwy40CCcOGi56QUHWFecDjVRcZ/epxGnA2lqesWYrksZvHd gMhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687525087; x=1690117087; 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=ekB+n0pvhBE4oDDClDofItiQvFeklJBwzGHlLI89v7E=; b=afjkmjJvgzU+gz19vfLTNUdrVkhTyBcoTClAf99yUa5o2HvytSNBeaBw05/fMCs6iG mQPMDSIkj1w25v+Uyrk86/Hwc/Y3+T5lWEYgHqRAzj5zbXhMyEcbBGEG/2SKCzJfOi58 8uh0beMeVv7pCxRzyLjr+sB6aPKKwMl+RDhzzRyTzuIFhOMd0gQBWNIQbuDfilp3YaKn mQ1FVGnVh1l1bNB4hAeMLq8k/TSN7nSA8YKgQwNIh+CRwsSc6uXaLMvgArUSqmAp3XLq slcm3EiDrubRErRUSFme0U/PBk/JIMPVAaBBffD/4oAtIK72CJfaXo5fBkFb/weiM5vR HTyA== X-Gm-Message-State: AC+VfDzOONM6EiZc9OQVMhc7GdR78UCMzraCQeXL9INX6aeXzUevVLxD bICbfhzNiPK2ubrJagTxD44lbw2TE+s= X-Google-Smtp-Source: ACHHUZ72NqcPGF4j0qG9coVxAGsxQpD2shhae0rDv8SVsZ+LCs/W3mC4geMwZY/UbwxAH2T9/F41NA== X-Received: by 2002:a17:902:6b43:b0:1b6:7d4b:3f97 with SMTP id g3-20020a1709026b4300b001b67d4b3f97mr8970048plt.24.1687525086915; Fri, 23 Jun 2023 05:58:06 -0700 (PDT) Received: from wheely.local0.net (193-116-198-102.tpgi.com.au. [193.116.198.102]) by smtp.gmail.com with ESMTPSA id b12-20020a170902bd4c00b001a04d27ee92sm7141795plx.241.2023.06.23.05.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 05:58:06 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson , Greg Kurz , Harsh Prateek Bora , John Snow , Cleber Rosa , Pavel Dovgalyuk , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Peter Maydell , Richard Henderson Subject: [PATCH 7/7] tests/avocado: ppc64 pseries reverse debugging test Date: Fri, 23 Jun 2023 22:57:07 +1000 Message-Id: <20230623125707.323517-8-npiggin@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623125707.323517-1-npiggin@gmail.com> References: <20230623125707.323517-1-npiggin@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62d.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org pseries can run reverse-debugging well enough to pass basic tests. There is strangeness with reverse-continue possibly relating to a bp being set on the first instruction or on a snapshot, that causes the PC to be reported on the first instruction rather than last breakpoint, so a workaround is added for that for now. Signed-off-by: Nicholas Piggin --- tests/avocado/reverse_debugging.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_debugging.py index 680c314cfc..553c931994 100644 --- a/tests/avocado/reverse_debugging.py +++ b/tests/avocado/reverse_debugging.py @@ -94,7 +94,7 @@ def gdb_bstep(g): def vm_get_icount(vm): return vm.qmp('query-replay')['return']['icount'] - def reverse_debugging(self, shift=7, args=None): + def reverse_debugging(self, shift=7, args=None, initial_skip=False): logger = logging.getLogger('replay') # create qcow2 for snapshots @@ -135,6 +135,10 @@ def reverse_debugging(self, shift=7, args=None): self.fail('Reverse continue is not supported by QEMU') logger.info('stepping forward') + + if initial_skip: + self.gdb_step(g) + steps = [] # record first instruction addresses for _ in range(self.STEPS): @@ -216,3 +220,25 @@ def test_aarch64_virt(self): self.reverse_debugging( args=('-kernel', kernel_path)) + +class ReverseDebugging_ppc64(ReverseDebugging): + """ + :avocado: tags=accel:tcg + """ + + REG_PC = 0x40 + + # unidentified gitlab timeout problem + @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab') + def test_ppc64_pseries(self): + """ + :avocado: tags=arch:ppc64 + :avocado: tags=machine:pseries + """ + # start with BIOS only + self.endian_is_le = False + # reverse-continue fails (seems to end up at the start) if a break + # is put on the first instruction. initial_skip skips one before the + # first bp, and it works. Could be due to break at the same icount + # as the snapshot? + self.reverse_debugging(initial_skip=True)