From patchwork Mon Feb 6 17:13:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650946 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp2393354pva; Mon, 6 Feb 2023 09:15:12 -0800 (PST) X-Google-Smtp-Source: AK7set99z0FItBcVO4olaUlBgdu3+YmK8Qmf9v2FBNKOy8SWqQ7n95Mo6wDk8FHmfHjwE3XxUm/X X-Received: by 2002:a0c:9a4c:0:b0:539:dc87:f4fb with SMTP id q12-20020a0c9a4c000000b00539dc87f4fbmr29787058qvd.41.1675703711972; Mon, 06 Feb 2023 09:15:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675703711; cv=none; d=google.com; s=arc-20160816; b=VsEKJbw2m618plEeCYI1mQju4tPyR9W4gKlMgAtdkvgLss9ED+9Rl1qddCYQs34uoR C8ft44NFD4y5xzphfcBNUBMQ1mrr9TKFihXMr1Hoh/r1ca2+JAAlKtjzCHyaznJ2Iola B/ULR5gftuoVakqvtf5fX6yplhq/Sv4W6LMNl7FxjrQGL6HjXeAaNdGNXsf86jjb20bu gy3Bgy1hFgfh8+BxwgOAl62YfFrtVncmoQ3A3cJWGfu76gyR0yap5TED0Lc9dInYdxwQ qUrp19+2suDqjY0fedEYII/MW0zRzTYAv753wP7YbnstYxh6FxpKIEwxCItnmu6N8K0c VfxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=110cMZIFcWWL1/kf503QWtB2fWh8LmnfgN3d4ZXxhlU=; b=MNWjZ3r0OWUDW03hCsFehvxIB6OrUNj595Xi7QcswGFwih4nqBDafkYQZkTEONq6+M TGEZOLQUDcYTOnutBUNoPSTcJ+UKKlrRvIEpFw2ihJHviSRrnPBO1SieFPJV4HGnuGSv rPuhxEMXhGrvlokRqheLv6ts+xFJvVcV1+LjiGg6cMO75dtHMgvRiycjHSF0MoxCcpxs lKGeubldoz3O8tQJwmgh3PQAHxjKAC1vVwUjdZkXiuDe4WhtnmyKAG5jHgYiBK6mhMMH o8WOFVG9hZ48CGVQ67NqurdG/cu8InHb5FKoKHawJd/IjPbHBYGUbTdgFdnPTjymWP2L OHLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d4iuiBAk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a16-20020a0ce390000000b0056bf1e34c8esi3838491qvl.165.2023.02.06.09.15.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Feb 2023 09:15:11 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d4iuiBAk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pP54K-0000jf-J9; Mon, 06 Feb 2023 12:14:16 -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 1pP54F-0000hY-0J for qemu-devel@nongnu.org; Mon, 06 Feb 2023 12:14:11 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pP54A-0001QS-1B for qemu-devel@nongnu.org; Mon, 06 Feb 2023 12:14:09 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ba1so7006221wrb.5 for ; Mon, 06 Feb 2023 09:14:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=110cMZIFcWWL1/kf503QWtB2fWh8LmnfgN3d4ZXxhlU=; b=d4iuiBAkE4gd4YhsO3M7Fhy0oz3Ym6oXmWgEAyu8yjCeFfiiNVJvqK0GOMB/H0TjSF btIZV0g0ptgQDAStRg3XjrEhqB54vvM+oX6XxINtm1JuPqkvSuYYXvjdOceKF81hyY3T fODm4DrjpAPuKFCMdmL2OT+CyPXxIivN73N56WCxWQm+in5EW9Z9VIeL5DN8jbCiO+C3 0bjaNssfRYgjKwdZSJpEbEiP7aYz0YkHihMfbGLBlbTr/NPjOkT1FQ4EGN2Iz5yb9/Vk 7bO/j4F5uS3vALHu5/4VycEamkemRR1Xe2XPpaeGyU/ChsobIKn5gTeyaBYhZ0poucaY YkHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=110cMZIFcWWL1/kf503QWtB2fWh8LmnfgN3d4ZXxhlU=; b=PLQL8OznSX8h/0aV4gF6bip+HgH4m7r2OUUeaIGT85IxXCvPaxyIuqExPX3kLNHzgp qOIflIqAXgNh5osFEi71x7oQ6sOWFDcm0ufvViIcA4fcTx3qgM9C38qxGxwcYAt2qweO kkBO7gGTbiUVmEZB0zQ2vmM4Gj2VURwieSpHM4I0Ihn3QW9B17sEde/9d1oMD7a2fIdT ajdD3yfDkUC6k1RdvYTkf2uDCfMYaN2MQS/ZwD5cWQLu5Rg3IQmpGNjOs5UNRYvbgNXk QLQMwzy+9GjIeceYnltTfahcWFKACdLh0C5W3ifGhc+EFkdzQOC4+WCXYCBoCivQtUml d0kQ== X-Gm-Message-State: AO0yUKWwu7OSDF90F0+300jsg5BWyYH9Jf8gs5FgPXy4YPx0Lqdyk3qd dmJIvwv0u8ecyfRWNEB0H0j2yO+ms625U1iL X-Received: by 2002:adf:c5c6:0:b0:2bf:c066:dd7e with SMTP id v6-20020adfc5c6000000b002bfc066dd7emr17286692wrg.40.1675703643731; Mon, 06 Feb 2023 09:14:03 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id y10-20020a05600015ca00b002bfd137ecddsm9529841wry.11.2023.02.06.09.14.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 09:14:03 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , "Dr. David Alan Gilbert" , Laurent Vivier , Thomas Huth , Warner Losh , Kyle Evans , Markus Armbruster Subject: [RFC PATCH 1/5] Rename the singlestep global variable to one_insn_per_tb Date: Mon, 6 Feb 2023 17:13:55 +0000 Message-Id: <20230206171359.1327671-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206171359.1327671-1-peter.maydell@linaro.org> References: <20230206171359.1327671-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The 'singlestep' global variable is badly misnamed, because it has nothing to do with single-stepping the emulation either via the gdb stub or by emulation of architectural debug facilities. Instead what it does is force TCG to put only one instruction into each TB. Rename it to one_insn_per_tb, so that it reflects what it does better and is easier to search for in the codebase. This misnaming is also present in user-facing interfaces: the command line option '-singlestep', the HMP 'singlestep' command, and the QMP StatusInfo object. Those are harder to update because we need to retain backwards compatibility. Subsequent patches will add better-named aliases so we can eventually deprecate-and-drop the old, bad name. Signed-off-by: Peter Maydell --- include/exec/cpu-common.h | 2 +- accel/tcg/cpu-exec.c | 4 ++-- bsd-user/main.c | 4 ++-- linux-user/main.c | 4 ++-- softmmu/globals.c | 2 +- softmmu/runstate-hmp-cmds.c | 4 ++-- softmmu/runstate.c | 2 +- softmmu/vl.c | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 6feaa40ca7b..f2592a1967f 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -163,7 +163,7 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, void *ptr, size_t len, bool is_write); /* vl.c */ -extern int singlestep; +extern int one_insn_per_tb; void list_cpus(const char *optarg); diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 9c857eeb077..08a65f8d506 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -157,12 +157,12 @@ uint32_t curr_cflags(CPUState *cpu) * Record gdb single-step. We should be exiting the TB by raising * EXCP_DEBUG, but to simplify other tests, disable chaining too. * - * For singlestep and -d nochain, suppress goto_tb so that + * For one-insn-per-tb and -d nochain, suppress goto_tb so that * we can log -d cpu,exec after every TB. */ if (unlikely(cpu->singlestep_enabled)) { cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1; - } else if (singlestep) { + } else if (one_insn_per_tb) { cflags |= CF_NO_GOTO_TB | 1; } else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { cflags |= CF_NO_GOTO_TB; diff --git a/bsd-user/main.c b/bsd-user/main.c index 6f09180d654..a8de6906ed5 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -50,7 +50,7 @@ #include "host-os.h" #include "target_arch_cpu.h" -int singlestep; +int one_insn_per_tb; uintptr_t guest_base; bool have_guest_base; /* @@ -391,7 +391,7 @@ int main(int argc, char **argv) } else if (!strcmp(r, "seed")) { seed_optarg = optarg; } else if (!strcmp(r, "singlestep")) { - singlestep = 1; + one_insn_per_tb = 1; } else if (!strcmp(r, "strace")) { do_strace = 1; } else if (!strcmp(r, "trace")) { diff --git a/linux-user/main.c b/linux-user/main.c index 4290651c3cf..99bcd542b42 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -66,7 +66,7 @@ char *exec_path; -int singlestep; +int one_insn_per_tb; static const char *argv0; static const char *gdbstub; static envlist_t *envlist; @@ -397,7 +397,7 @@ static void handle_arg_reserved_va(const char *arg) static void handle_arg_singlestep(const char *arg) { - singlestep = 1; + one_insn_per_tb = 1; } static void handle_arg_strace(const char *arg) diff --git a/softmmu/globals.c b/softmmu/globals.c index 527edbefdd0..f46df89d2db 100644 --- a/softmmu/globals.c +++ b/softmmu/globals.c @@ -43,7 +43,7 @@ int vga_interface_type = VGA_NONE; bool vga_interface_created; Chardev *parallel_hds[MAX_PARALLEL_PORTS]; int win2k_install_hack; -int singlestep; +int one_insn_per_tb; int fd_bootchk = 1; int graphic_rotate; QEMUOptionRom option_rom[MAX_OPTION_ROMS]; diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c index d55a7d4db89..29c9a038863 100644 --- a/softmmu/runstate-hmp-cmds.c +++ b/softmmu/runstate-hmp-cmds.c @@ -44,9 +44,9 @@ void hmp_singlestep(Monitor *mon, const QDict *qdict) { const char *option = qdict_get_try_str(qdict, "option"); if (!option || !strcmp(option, "on")) { - singlestep = 1; + one_insn_per_tb = 1; } else if (!strcmp(option, "off")) { - singlestep = 0; + one_insn_per_tb = 0; } else { monitor_printf(mon, "unexpected option %s\n", option); } diff --git a/softmmu/runstate.c b/softmmu/runstate.c index cab9f6fc075..8272aef43b4 100644 --- a/softmmu/runstate.c +++ b/softmmu/runstate.c @@ -236,7 +236,7 @@ StatusInfo *qmp_query_status(Error **errp) StatusInfo *info = g_malloc0(sizeof(*info)); info->running = runstate_is_running(); - info->singlestep = singlestep; + info->singlestep = one_insn_per_tb; info->status = current_run_state; return info; diff --git a/softmmu/vl.c b/softmmu/vl.c index 9177d95d4ec..dbe5124b5e7 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2957,7 +2957,7 @@ void qemu_init(int argc, char **argv) qdict_put_str(machine_opts_dict, "firmware", optarg); break; case QEMU_OPTION_singlestep: - singlestep = 1; + one_insn_per_tb = 1; break; case QEMU_OPTION_S: autostart = 0; From patchwork Mon Feb 6 17:13:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650948 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp2393526pva; Mon, 6 Feb 2023 09:15:27 -0800 (PST) X-Google-Smtp-Source: AK7set9AoKeIjBOd5RNjfyxI37tP2kUnHFQyxHlQ2SgAVRcfgDEvmN0t3JTEG9IYVn4uwshCf8iH X-Received: by 2002:ad4:5beb:0:b0:56b:ef0f:ee16 with SMTP id k11-20020ad45beb000000b0056bef0fee16mr436629qvc.7.1675703727637; Mon, 06 Feb 2023 09:15:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675703727; cv=none; d=google.com; s=arc-20160816; b=afp92571XXYWTTuo34FyU/+snO1yM5Pp96JpgB7gSTK6vsCxwQrBqeS1e+gEvu75Bg kutTyYmqsIaKFRKZXgwKHgq2+aKzqUj+gos6nyUZbI42mqEhZvPxzCI6MyAK8cWGmBNI dnfpisLCmanAHJa86hcn9dZqnM9HR6jZqaktQ5P+E0s0mEXpJ8QVziw0i+gMsPRBrRW8 XI6FjFuhRzZEODlgdcb/ktpgUyLNT7j+Y60Mmv2BLuLJNpViJ4k/FgSw3yW0eg8tKLWH XTmu/nsgw5MHCJ/NziRaxyK+FYw/Sd4ZdFvuM6+4nz46TDCVuRsjSsM1OXXKal7WmBvj DI6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i0Jr8DH9OG5vGfeN7iONeP5ImzvUd60F7hUAYLN+I10=; b=pYyWNVXO8ySVsJaiCLPmPoqLTVJe8BZKd84OVZSepIjr++2ZE4D876v9BLh/+HMvpk cIMj4je5Xqk0FhxrPIPuF7naty7noY44Wd8J1oJNuJU/o+ZmhlKRScF69G1Go+SIruNe pGwwEX7Ce+OSbp4CQde4JHgHlFSzG+/PHat3I4L/bXxfupR+MkRRrJ50Klx3EKiY5LgX MNMYkSKiIJI/xz6BD2IhOHaylWsLc47b8Th7vjdjVPpt3m63IoIfB85NU2CD6qxUhg12 zKz9aYqul8mx3TtJTFTGdkELKcTLV6j3d1IbPt4X1vi7Kgso2eSFEwEN3iPsNqC4yQcw jmHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HFsfwTlV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s2-20020a0ce302000000b004ef59b08985si4643318qvl.162.2023.02.06.09.15.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Feb 2023 09:15:27 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HFsfwTlV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pP54L-0000jx-CU; Mon, 06 Feb 2023 12:14:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP54G-0000hw-2W for qemu-devel@nongnu.org; Mon, 06 Feb 2023 12:14:12 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pP54A-0001Qb-Ln for qemu-devel@nongnu.org; Mon, 06 Feb 2023 12:14:10 -0500 Received: by mail-wr1-x432.google.com with SMTP id ba1so7006259wrb.5 for ; Mon, 06 Feb 2023 09:14:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=i0Jr8DH9OG5vGfeN7iONeP5ImzvUd60F7hUAYLN+I10=; b=HFsfwTlVS7H36hlbk8MGiLGB9AeDrGhw49moEB2O1/KNJCDnke7PG0oDF0fAQld7ao 63r4E7GVs+Rs/rZc6avvuTrQ/z18vQTrCGrVCRlbzZff+9n/WaYo3hPZ0ePF6q+0VBPr wBCOOkNAYKnPl1KfzTGVE6FtIAMDdtNQ9LYgyr20HMBSVtfDlyHf50JZVxnoU8aq9ORW ny0JWkpcs5kHNxpc49etfcFOSg5skPZFn6LBbmG2mDq6cHL9C1n5qRRPwGmPrE0nnAhv 85EY28fGvfcxoGp6xDt0plKJn4cXrYcAhBEwFu3iCtKcA4Ryu21zscIjhVagTdwASym+ bYTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=i0Jr8DH9OG5vGfeN7iONeP5ImzvUd60F7hUAYLN+I10=; b=t3ZMJUR1w/H2pqRC1lSXNKhXX/TeqZ0zRFNJYWsdTXIIWFx39a9unX60YtRuAnl2+T hg+Szc/V1eY5dXBS48nildHNYkT3LK2cndtBdYSFLJQZ7jDQzArE6/Zg/lyvjfFGrAAC AGteauRK0wQK1v6svr3E1metpw3LvzEBjBU2tcn4GIdnpiQDcmuuQEX7mrEqhhiQ2Ikn skpRicvL16bCwJ8/tiS0axemDyUNl6d1T0vyMtnAJHPCzL/pI4uz6cgvAmjG4VgKQ/gU 0n0tDS1qVqmzjDKEXyNdCjgDxCltoJEv+vWl5+7ez41FvyedwrwGHZO0qktTZsbjv/ae FNSw== X-Gm-Message-State: AO0yUKU6LJseSA7VSPLOx49wZ6SbqwzVgIAQcaRyotgMKd9KLMGuK1JO Dko1RIvp15Ge+k2w49BCjTnRK/LRvCjPKG95 X-Received: by 2002:adf:ec06:0:b0:2c3:ea95:4726 with SMTP id x6-20020adfec06000000b002c3ea954726mr3419106wrn.34.1675703644879; Mon, 06 Feb 2023 09:14:04 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id y10-20020a05600015ca00b002bfd137ecddsm9529841wry.11.2023.02.06.09.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 09:14:04 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , "Dr. David Alan Gilbert" , Laurent Vivier , Thomas Huth , Warner Losh , Kyle Evans , Markus Armbruster Subject: [RFC PATCH 2/5] linux-user: Add '-one-insn-per-tb' option equivalent to '-singlestep' Date: Mon, 6 Feb 2023 17:13:56 +0000 Message-Id: <20230206171359.1327671-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206171359.1327671-1-peter.maydell@linaro.org> References: <20230206171359.1327671-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The '-singlestep' option is confusing, because it doesn't actually have anything to do with single-stepping the CPU. What it does do is force TCG emulation to put one guest instruction in each TB, which can be useful in some situations. Create a new command line argument -one-insn-per-tb, so we can document that -singlestep is just a deprecated synonym for it, and eventually perhaps drop it. Signed-off-by: Peter Maydell --- docs/user/main.rst | 7 ++++++- linux-user/main.c | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/user/main.rst b/docs/user/main.rst index 6f2ffa080f7..f9ac701f4b1 100644 --- a/docs/user/main.rst +++ b/docs/user/main.rst @@ -93,8 +93,13 @@ Debug options: ``-g port`` Wait gdb connection to port +``-one-insn-per-tb`` + Run the emulation with one guest instruction per translation block. + This slows down emulation a lot, but can be useful in some situations, + such as when trying to analyse the logs produced by the ``-d`` option. + ``-singlestep`` - Run the emulation in single step mode. + This is a deprecated synonym for the ``-one-insn-per-tb`` option. Environment variables: diff --git a/linux-user/main.c b/linux-user/main.c index 99bcd542b42..41089e51cea 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -395,7 +395,7 @@ static void handle_arg_reserved_va(const char *arg) } } -static void handle_arg_singlestep(const char *arg) +static void handle_arg_one_insn_per_tb(const char *arg) { one_insn_per_tb = 1; } @@ -486,8 +486,11 @@ static const struct qemu_argument arg_table[] = { "logfile", "write logs to 'logfile' (default stderr)"}, {"p", "QEMU_PAGESIZE", true, handle_arg_pagesize, "pagesize", "set the host page size to 'pagesize'"}, - {"singlestep", "QEMU_SINGLESTEP", false, handle_arg_singlestep, - "", "run in singlestep mode"}, + {"one-insn-per-tb", + "QEMU_ONE_INSN_PER_TB", false, handle_arg_one_insn_per_tb, + "", "run with one guest instruction per emulated TB"}, + {"singlestep", "QEMU_SINGLESTEP", false, handle_arg_one_insn_per_tb, + "", "deprecated synonym for -one-insn-per-tb"}, {"strace", "QEMU_STRACE", false, handle_arg_strace, "", "log system calls"}, {"seed", "QEMU_RAND_SEED", true, handle_arg_seed, From patchwork Mon Feb 6 17:13:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650947 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp2393405pva; Mon, 6 Feb 2023 09:15:15 -0800 (PST) X-Google-Smtp-Source: AK7set+WFtd88Cjg795vA4Lmq1J6STQAX0sEGmEELOP7Y+701Y+3Ar+/1adULOl698rxOSD7ycS3 X-Received: by 2002:a05:622a:1b9e:b0:3ba:1c07:e472 with SMTP id bp30-20020a05622a1b9e00b003ba1c07e472mr12978167qtb.51.1675703715723; Mon, 06 Feb 2023 09:15:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675703715; cv=none; d=google.com; s=arc-20160816; b=sw9DT3xqCU6F3fZYJnN0jA8Yr8yHw8abE/Lmbh8UN7SOZlw0TinW0Dj94GBAk2eBIK svpJgb9tPb4WOWOZWpqEbJPzCKQl35E65F4joy4Hro98zLtLs2b7Ftc/bh16lnKrXxHf xfcubSR85b9XGMrYmZFVtxkq5l7Xbf4ub8kRBxZ9JTGSLDFEgbCPVEc2JK5avBKHX4Cn xHtJ/kgR5KRDO6UEK+CHviAhqyrxrDwBNt543WAUnkDbwQEbTT0vPAXeUgXb9Ml0LPAj KNt9nRE9n8qt5KALqwiu5eP1xWsIqIi714sHicw1jGY/qZvukKIROdURa/affQi2rfwb rFgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mvKv8MeGCedu3b+fClY2dUyPUXygqJQqulbvcZ7fvCk=; b=O1rGyQ6FHHvsQKSlmJa3nhGr8P6z7k16SFjBxVlZXPlaQ4eimCkK2wdghEJ56JfGON B3Hv/2EMTou59JstvjDG9JW31L/RZ0P33lXOelUIwjSGAhUPS6i/zdwunzMnPB8m3gsg 3Hhdq2ccJ9NMRK2FqTtmCNhhlO3/g3rm8hlL6xOMncxYk+OvxgQtvxw6+Pio61rXvI/c eqeKw79YuwwmMdq3O9wjz7gQvPmMWAl7pTwBQu2welR39MPlkUL1Ln0puGlGlzum+oA5 wYx4118D4ZmNHAQgouPxrz40+9n7NwILlMUhP3zH2xc73ZMIr1UZxNCvJllOba6U2/NB zJrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xyx4TEwe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a189-20020ae9e8c6000000b007092958d776si9207360qkg.429.2023.02.06.09.15.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Feb 2023 09:15:15 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xyx4TEwe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pP54J-0000jB-RN; Mon, 06 Feb 2023 12:14:15 -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 1pP54H-0000hz-2y for qemu-devel@nongnu.org; Mon, 06 Feb 2023 12:14:13 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pP54C-0001Qj-Pg for qemu-devel@nongnu.org; Mon, 06 Feb 2023 12:14:10 -0500 Received: by mail-wr1-x435.google.com with SMTP id r2so11061042wrv.7 for ; Mon, 06 Feb 2023 09:14:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=mvKv8MeGCedu3b+fClY2dUyPUXygqJQqulbvcZ7fvCk=; b=xyx4TEweFZbZdgM6BDOmxM4v8aaRMGRjatJWgrY6jwgoKnpgjPelPI/MrOvhZpBLVv 0vlMPSTRwQ9jq++rasLvCD/MlFZyYoXS1QRR+LbcHFCrPegm3PJtmui8xTmN2EETgtUL +fTDLkMdTMbFj1TwHbzj7ZqC1L1MQ5tfrzmpKklwE11m9CTbyPKtXs6iubEitLLFczLv GMrf3Esb4KeYRH0KMO8sQI2+tBKVEfQ2ewlyuQDIyEN9nAhXf/Zu34ens6WmOMcKieUM yMeZ56hQyHuV4L0qqEO1gD9xu8pJtN1gs8+nzNExXEO+raxG9YT5ecEJUPNxlK7NA3Un z1dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=mvKv8MeGCedu3b+fClY2dUyPUXygqJQqulbvcZ7fvCk=; b=YlrFZd7/ndqJRsCC54w63CvRB/9jnwZ/xbStPGLtsf+3tMa2y9dDvGIH/gFr2N9Tbn SD4RzAtVIh7cCdVjlWjIbMvuKrsF4GXXV7qv99qVQH4/qswNolR3Ztw0Fcu35xessrC5 9Rjpuv5amhnb/XEm/V+66CkX9auwqw7yCWrqY0iVPtjB/e5RgABEhuqpAPWLN6Zq7Fi6 c5qERM7hKkmW9NR+p+mcOiZ53K3szP8d0FijpWhjLbmL1TIMncGjQDSSoNlIrRq0Ezfw 51LF//1ATkQEC7/D/tPz6g+wVYLa3xcIuJqJlWoMcOtLycN4cy0rugFZ24HBt8GXgkMU obrQ== X-Gm-Message-State: AO0yUKXhJo6ibzhcISeWTiApd107CzOtN4w4TsaDP77KspYdehg1094r AZ2M92IOn+615Ig/8p0JSk4WXfBntBmJG2L8 X-Received: by 2002:adf:c788:0:b0:2bf:b7cb:d2ef with SMTP id l8-20020adfc788000000b002bfb7cbd2efmr19666371wrg.9.1675703645835; Mon, 06 Feb 2023 09:14:05 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id y10-20020a05600015ca00b002bfd137ecddsm9529841wry.11.2023.02.06.09.14.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 09:14:05 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , "Dr. David Alan Gilbert" , Laurent Vivier , Thomas Huth , Warner Losh , Kyle Evans , Markus Armbruster Subject: [RFC PATCH 3/5] bsd-user: Add '-one-insn-per-tb' option equivalent to '-singlestep' Date: Mon, 6 Feb 2023 17:13:57 +0000 Message-Id: <20230206171359.1327671-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206171359.1327671-1-peter.maydell@linaro.org> References: <20230206171359.1327671-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The '-singlestep' option is confusing, because it doesn't actually have anything to do with single-stepping the CPU. What it does do is force TCG emulation to put one guest instruction in each TB, which can be useful in some situations. Create a new command line argument -one-insn-per-tb, so we can document that -singlestep is just a deprecated synonym for it, and eventually perhaps drop it. Signed-off-by: Peter Maydell --- NB: not even compile tested! --- docs/user/main.rst | 7 ++++++- bsd-user/main.c | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/user/main.rst b/docs/user/main.rst index f9ac701f4b1..f4786353965 100644 --- a/docs/user/main.rst +++ b/docs/user/main.rst @@ -247,5 +247,10 @@ Debug options: ``-p pagesize`` Act as if the host page size was 'pagesize' bytes +``-one-insn-per-tb`` + Run the emulation with one guest instruction per translation block. + This slows down emulation a lot, but can be useful in some situations, + such as when trying to analyse the logs produced by the ``-d`` option. + ``-singlestep`` - Run the emulation in single step mode. + This is a deprecated synonym for the ``-one-insn-per-tb`` option. diff --git a/bsd-user/main.c b/bsd-user/main.c index a8de6906ed5..8ede40614ec 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -167,7 +167,8 @@ static void usage(void) "-d item1[,...] enable logging of specified items\n" " (use '-d help' for a list of log items)\n" "-D logfile write logs to 'logfile' (default stderr)\n" - "-singlestep always run in singlestep mode\n" + "-one-insn-per-tb run with one guest instruction per emulated TB\n" + "-singlestep deprecated synonym for -one-insn-per-tb\n" "-strace log system calls\n" "-trace [[enable=]][,events=][,file=]\n" " specify tracing options\n" @@ -390,7 +391,7 @@ int main(int argc, char **argv) (void) envlist_unsetenv(envlist, "LD_PRELOAD"); } else if (!strcmp(r, "seed")) { seed_optarg = optarg; - } else if (!strcmp(r, "singlestep")) { + } else if (!strcmp(r, "singlestep") || !strcmp(r, "one-insn-per-tb") { one_insn_per_tb = 1; } else if (!strcmp(r, "strace")) { do_strace = 1; From patchwork Mon Feb 6 17:13:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650950 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp2393737pva; Mon, 6 Feb 2023 09:15:50 -0800 (PST) X-Google-Smtp-Source: AK7set+80+/6aSQUbRu4ngLu+jB3b5Nd+VUXMh9ZQl/HrZpKbtwYavOZ8pxyQ8VyI5U455T1Q9jz X-Received: by 2002:a05:6214:2264:b0:56b:f097:a34b with SMTP id gs4-20020a056214226400b0056bf097a34bmr13127469qvb.3.1675703750239; Mon, 06 Feb 2023 09:15:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675703750; cv=none; d=google.com; s=arc-20160816; b=Iw5Q4dgRLBZWe1jAy/m/vdQ4kRsqpyUbRDZuXSl9F0vnFI1IqT72yd4DCein2A+CNZ +mEKkSXqj2bmq4rzoeMf0AFq8ePZfJLKUCqkRytILmH+2MTKbw5TZxvQv1xm+wXYDNLf 0jEjoS9eNs+qCKlYeWudDvLFilaoMc2LqX9fmdrSFAOi+ekW70D8nBvId47IvTvF62uP uzKRrlDiWwIN06UmJ2CjlhEeHAqKorKeUfQWF1gD2W3pHbdGtSZA8Jhx7DLJzIo6jW6A jWe25p/lh84Cu5rm3Y25fwKN2YLlcJoFw/ffmpU01Qa0eJNmLm8JDYaB8ELZwV6BeMDv LIOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CMZp74yJ4afPsnw6Yc/ZceAsQ465N4IhpQ4ktRnsEtk=; b=NgHbCS2L2yFiYy2fteZjSB3VDCuTzLryBknjOLp4WSHjFYx1++xSTcZ2sRZY3TiRXz 0Wr76N88qDP/jWDPNBff1/cj+ppRRClS0VZvB9FQYrPdNytm1zES7TKPwLZI/oEjnwd8 G5EQlICeKUGe8bsfF2Ydl2HwghF1T3LHBUCjAShoXPfccYVXPyxIhXm9IZT8Do/D+wXq PsM/VmXVyb1LME1nHyiLb93Q/KjXlTwN/tya8L69dF9BtNrKmQiCyxFs26agjeEEgBcv 445A/yMdNCNauMtbLEsyfvJzadZLpV3KFwP5YfxysK/veadGRXYLwfW7QzsX3OXu8YJ3 GoJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hLHro6a7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w13-20020a0ce10d000000b0056bfdecebe8si1659646qvk.157.2023.02.06.09.15.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Feb 2023 09:15:50 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hLHro6a7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pP54K-0000jh-Rh; Mon, 06 Feb 2023 12:14:16 -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 1pP54H-0000hy-2v for qemu-devel@nongnu.org; Mon, 06 Feb 2023 12:14:13 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pP54C-0001Qs-QF for qemu-devel@nongnu.org; Mon, 06 Feb 2023 12:14:11 -0500 Received: by mail-wr1-x42a.google.com with SMTP id h3so3229334wrp.10 for ; Mon, 06 Feb 2023 09:14:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=CMZp74yJ4afPsnw6Yc/ZceAsQ465N4IhpQ4ktRnsEtk=; b=hLHro6a7JUkB6g+l68fFB4zvtMJIaTGCt+1zRswoktGwMtDLg6KV8w+Ypw0SXyllTm rj3UFdosRDxj9H2dT8Xhh57d6/kStojs+FhwQIOMQVGrM1NuPmVhpLvDzo4VHLDlyuPH 4B31g++gdHwTK5GhubeG+b7bFv8uYiGlPiivQBLai4rDjCleEVW0LspsOjOnXSsH8O92 GODftsepxJU7Pqm+GhPiE1R8pj6ZLqKsZFMvqozhWuA5oU2F2Imc7S7T3Ce30aKdhnrd 41aSfu0V2/RT+xXkm4oTOW7lHsbMWVEaH31mhTTYFrrPM3j3o0P7L/AfstWwsj93gmZw lFAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=CMZp74yJ4afPsnw6Yc/ZceAsQ465N4IhpQ4ktRnsEtk=; b=rvXCAC2FMZ8knnYAvxH7JPYsi1fcGcJ234J8clYVn3T6Yy3pd90KN+bSdGDIHZW2qL kSyZNoQ4oPtOizvmf8+x7UFtPsQ0c6THqXpXIdRVb61bUQW+17/aHqlsL2sUvyAsNw0C cRYnxZ+SEnd656DOX0TMVtGHVjI+lO+q42pk9nqmf5Mh9BT++iCa2QgIgKAXf/9DG09J yP6IUcWobG4Km7EHi94FZF29mXwstcpZc3f27fwi114hPfAwyp0oTAYQYmRrPDdfCY0N NsOLiG142l55lypEnH3QMNPoUQC2HDq60B2lEncIhqSxPXJAdxOVlsK2DY0WKgCZRJ4T 0dxw== X-Gm-Message-State: AO0yUKXbuUzsrCRZ5ca83iwhcMDM3HR1hvxzwoDon7jdSwZxAMyJNvlI uShqEDuK1UtFghm0euyAQZgo+w7r1tPqxCI7 X-Received: by 2002:adf:ff90:0:b0:2c3:f0a6:43e3 with SMTP id j16-20020adfff90000000b002c3f0a643e3mr983048wrr.39.1675703646851; Mon, 06 Feb 2023 09:14:06 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id y10-20020a05600015ca00b002bfd137ecddsm9529841wry.11.2023.02.06.09.14.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 09:14:06 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , "Dr. David Alan Gilbert" , Laurent Vivier , Thomas Huth , Warner Losh , Kyle Evans , Markus Armbruster Subject: [RFC PATCH 4/5] softmmu: Add '-one-insn-per-tb' option equivalent to '-singlestep' Date: Mon, 6 Feb 2023 17:13:58 +0000 Message-Id: <20230206171359.1327671-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206171359.1327671-1-peter.maydell@linaro.org> References: <20230206171359.1327671-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The '-singlestep' option is confusing, because it doesn't actually have anything to do with single-stepping the CPU. What it does do is force TCG emulation to put one guest instruction in each TB, which can be useful in some situations. Create a new command line argument -one-insn-per-tb, so we can document that -singlestep is just a deprecated synonym for it, and eventually perhaps drop it. Signed-off-by: Peter Maydell --- softmmu/vl.c | 1 + qemu-options.hx | 14 ++++++++++++-- tcg/tci/README | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index dbe5124b5e7..61335ec7bc0 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2957,6 +2957,7 @@ void qemu_init(int argc, char **argv) qdict_put_str(machine_opts_dict, "firmware", optarg); break; case QEMU_OPTION_singlestep: + case QEMU_OPTION_one_insn_per_tb: one_insn_per_tb = 1; break; case QEMU_OPTION_S: diff --git a/qemu-options.hx b/qemu-options.hx index 88e93c61031..184f8cc36d0 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4158,11 +4158,21 @@ SRST from a script. ERST +DEF("one-insn-per-tb", 0, QEMU_OPTION_one_insn_per_tb, \ + "-one-insn-per-tb run with one guest instruction per emulated TB\n", QEMU_ARCH_ALL) +SRST +``-one-insn-per-tb`` + Run the emulation with one guest instruction per translation block. + This slows down emulation a lot, but can be useful in some situations, + such as when trying to analyse the logs produced by the ``-d`` option. + This only has an effect when using TCG, not with KVM or other accelerators. +ERST + DEF("singlestep", 0, QEMU_OPTION_singlestep, \ - "-singlestep always run in singlestep mode\n", QEMU_ARCH_ALL) + "-singlestep deprecated synonym for -one-insn-per-tb\n", QEMU_ARCH_ALL) SRST ``-singlestep`` - Run the emulation in single step mode. + This is a deprecated synonym for the -one-insn-per-tb option. ERST DEF("preconfig", 0, QEMU_OPTION_preconfig, \ diff --git a/tcg/tci/README b/tcg/tci/README index f72a40a395a..751558f2892 100644 --- a/tcg/tci/README +++ b/tcg/tci/README @@ -49,7 +49,7 @@ The only difference from running QEMU with TCI to running without TCI should be speed. Especially during development of TCI, it was very useful to compare runs with and without TCI. Create /tmp/qemu.log by - qemu-system-i386 -d in_asm,op_opt,cpu -D /tmp/qemu.log -singlestep + qemu-system-i386 -d in_asm,op_opt,cpu -D /tmp/qemu.log -one-insn-per-tb once with interpreter and once without interpreter and compare the resulting qemu.log files. This is also useful to see the effects of additional From patchwork Mon Feb 6 17:13:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 650945 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp2393357pva; Mon, 6 Feb 2023 09:15:12 -0800 (PST) X-Google-Smtp-Source: AK7set8yz/NhAaCgDCAlweftfmYSaLRzfkRxpv99yqcio3MARlDkJSyIaeRFUyn5ZMv1melWaBJh X-Received: by 2002:a05:6214:21e8:b0:56b:561:cab3 with SMTP id p8-20020a05621421e800b0056b0561cab3mr20961800qvj.44.1675703712184; Mon, 06 Feb 2023 09:15:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675703712; cv=none; d=google.com; s=arc-20160816; b=ync4wS088DeQAZ/vuCmw2hmqSi87BdJ/0UsBvxJphJ1Pdw9DSVMQlqMnA622S8K7k5 JZ5u4YVzWL0n142c/wb5bBCUCEtNPlLxlaDuS2CVWtRBSYkAded/D/gaqUe2g8SnVr7x eTyiW3O2GKSFA4AOwAdryv4HUK4fWEdj1lip7rjj/cr9qZ7cnflLnIS53ayGnFItlrMD t4XNtHHSA5YP/CMApG1L8pCuR5canbBpFCcovXz8XSQLVkgbD/uxuv7+Xwnrz/l9XT1M VGmek1d47VnmBWNE5SXXGJmqJRnOFi2pH/AcBqLnUQ1WKJOAMwvdG6IJ8eL5LcURS1zl AnHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aqub2Ln/xHWuYzGV026+az3A7a2YzS+9nE8r5yCljvE=; b=V87+i8XfSUJmW8L3pQgH+7CpByJP1YxFlMIUZjx/VCZTNsaIMAVXzfAAPLmZ+nnN9a 5Mn+keOKZ9D40U+q4FKbBh3xFG9/Sjzz7ddNfz2Ni0gjhyO6amEM1kOfR5v+9BZhw2R1 yPGVrmxBgdQLNO9IYJUJa3ijtKH48y8VcscksrgTubRcJwx4Jhsuobl6iFfHaSub7whu HhV6/pAprBaAag5E17VNK+Elc6SfMLG9wKz2PPJmF8nN42WSxH4+x29Bg3CcR9Rec92h a/oYk8xHywK4x/ne2Ww+oArP3F8Lxyd3vsAIAQtzyyHl2IR3zxjGuvwzGVvDzjK3knBO WXRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="m/n5cJx5"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k7-20020a05620a414700b0072c8c425119si10085352qko.630.2023.02.06.09.15.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Feb 2023 09:15:12 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="m/n5cJx5"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pP54I-0000j2-TU; Mon, 06 Feb 2023 12:14:14 -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 1pP54G-0000hx-2x for qemu-devel@nongnu.org; Mon, 06 Feb 2023 12:14:12 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pP54D-0001R4-Ga for qemu-devel@nongnu.org; Mon, 06 Feb 2023 12:14:11 -0500 Received: by mail-wr1-x429.google.com with SMTP id r2so11061121wrv.7 for ; Mon, 06 Feb 2023 09:14:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=aqub2Ln/xHWuYzGV026+az3A7a2YzS+9nE8r5yCljvE=; b=m/n5cJx5nwPw2FA0hmYUOnj/TmfU5kTviyj9uv76kDOcPvfiXXmjc1fXJG4HVOwq7y LnAyVXlGd2n6gB0v3lpwHx0WasqAW6R7QuxaQ5OG6fp4ZZ3sQ2zPZfm+WQCsJCnOxLzx OML9wPLMaay+y1xxGvjRabSbRZg+yNjlti0V8Zv5daNR+meucdn0/qQcQEwniNN2ESlz aNpyn02+k1vDjch3X39EYj62lvTKLBpNXaOwu7GBohLQ0T8kmVaILAB6ZAu2oi5xUq32 Kd7g1IB/wtVazPghHGIo0uD+LP7eUwAQ6c28hgi0yyhf5qODUEweVqqO4KUk3aE/QB/Y VOSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=aqub2Ln/xHWuYzGV026+az3A7a2YzS+9nE8r5yCljvE=; b=xZqyB9z//42nqZYwbRtdqEVHpgdL9CSqG7W75ImLdXzFXl9sIvtuuqkv1oYMzs9R4T fX4+9p3tpC9n25OvuJEUPg3s4Of5o+mraUSd/kL7nxY08MtyrLQ3IatLAyjaxSLLnbU/ B6tX8WXbcyWLYjoy/yXOST97u5w2YHQFw/1dxP9HwHFLHeaZKDsFz1vqLRVzdGhpAUXv 4USyOViz6iS7bKBncHHYq83pcytiyzBznK1d6lOKgKWfvuJTPTYtp6xmfTDzCeA3sWgJ 8FN3ENkhcQE6OLqTKsvdn2vyG1HsrP5KRsy/StGFwhc/DdfHPp9Z8Ax/3cBleT3r5c7H 6WOQ== X-Gm-Message-State: AO0yUKUjp8ayJDPx55J0LfvqeBosBYN+wpTbm/7NV4o3xoG24SIzeqr6 zecdzCb/mnYic5wkXBkeAvjrdwxwl2AilU7z X-Received: by 2002:a5d:6d05:0:b0:2bf:ee65:b0b0 with SMTP id e5-20020a5d6d05000000b002bfee65b0b0mr24515766wrq.41.1675703647904; Mon, 06 Feb 2023 09:14:07 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id y10-20020a05600015ca00b002bfd137ecddsm9529841wry.11.2023.02.06.09.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 09:14:07 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , "Dr. David Alan Gilbert" , Laurent Vivier , Thomas Huth , Warner Losh , Kyle Evans , Markus Armbruster Subject: [RFC PATCH 5/5] hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep' Date: Mon, 6 Feb 2023 17:13:59 +0000 Message-Id: <20230206171359.1327671-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206171359.1327671-1-peter.maydell@linaro.org> References: <20230206171359.1327671-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The 'singlestep' HMP command is confusing, because it doesn't actually have anything to do with single-stepping the CPU. What it does do is force TCG emulation to put one guest instruction in each TB, which can be useful in some situations. Create a new HMP command 'one-insn-per-tb', so we can document that 'singlestep' is just a deprecated synonym for it, and eventually perhaps drop it. Signed-off-by: Peter Maydell --- include/monitor/hmp.h | 2 +- softmmu/runstate-hmp-cmds.c | 2 +- tests/qtest/test-hmp.c | 1 + hmp-commands.hx | 25 +++++++++++++++++++++---- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 2220f14fc98..e66c8c63799 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -156,7 +156,7 @@ void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict); void hmp_human_readable_text_helper(Monitor *mon, HumanReadableText *(*qmp_handler)(Error **)); void hmp_info_stats(Monitor *mon, const QDict *qdict); -void hmp_singlestep(Monitor *mon, const QDict *qdict); +void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict); void hmp_watchdog_action(Monitor *mon, const QDict *qdict); void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict); void hmp_info_capture(Monitor *mon, const QDict *qdict); diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c index 29c9a038863..da218aa4b86 100644 --- a/softmmu/runstate-hmp-cmds.c +++ b/softmmu/runstate-hmp-cmds.c @@ -40,7 +40,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict) qapi_free_StatusInfo(info); } -void hmp_singlestep(Monitor *mon, const QDict *qdict) +void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict) { const char *option = qdict_get_try_str(qdict, "option"); if (!option || !strcmp(option, "on")) { diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c index b4a920df898..cb3530df722 100644 --- a/tests/qtest/test-hmp.c +++ b/tests/qtest/test-hmp.c @@ -64,6 +64,7 @@ static const char *hmp_cmds[] = { "screendump /dev/null", "sendkey x", "singlestep on", + "one-insn-per-tb on", "wavcapture /dev/null", "stopcapture 0", "sum 0 512", diff --git a/hmp-commands.hx b/hmp-commands.hx index fbb5daf09be..88933567845 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -378,18 +378,35 @@ SRST only *tag* as parameter. ERST + { + .name = "one-insn-per-tb", + .args_type = "option:s?", + .params = "[on|off]", + .help = "run emulation with one guest instruction per translation block", + .cmd = hmp_one_insn_per_tb, + }, + +SRST +``one-insn-per-tb [off]`` + Run the emulation with one guest instruction per translation block. + This slows down emulation a lot, but can be useful in some situations, + such as when trying to analyse the logs produced by the ``-d`` option. + This only has an effect when using TCG, not with KVM or other accelerators. + + If called with option off, the emulation returns to normal mode. +ERST + { .name = "singlestep", .args_type = "option:s?", .params = "[on|off]", - .help = "run emulation in singlestep mode or switch to normal mode", - .cmd = hmp_singlestep, + .help = "deprecated synonym for one-insn-per-tb", + .cmd = hmp_one_insn_per_tb, }, SRST ``singlestep [off]`` - Run the emulation in single step mode. - If called with option off, the emulation returns to normal mode. + This is a deprecated synonym for the one-insn-per-tb command. ERST {