From nobody Fri May 17 06:53:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1675703712; cv=none; d=zohomail.com; s=zohoarc; b=lboVqjOhHE0kPcTmmwKpEloVtwLFbrBAG1jBw+SjaOik5d5rqwifZgpr97rWDZUOGTu5c0/uvV16Rdp351uAibSiBpi9sWjB3kHKNCNOE4/Bdl9geCRU/rbThsCVaCn19YA3TpejBgqOIWJ56cyeOng8l00/5ShL7f5MDc8V9zE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675703712; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=110cMZIFcWWL1/kf503QWtB2fWh8LmnfgN3d4ZXxhlU=; b=n6ABpqE9V5LBMnUXg3X++MRcHLjTXT13ABN+O6vGebCzP3SZl7gNLrN2zX9OFIWS0OvaekBC0D1Fgv9yNS7kRl/yTdBMg37jz40A54TsBx/CeteBzMvoTrGc+iFmtMkAKBk2PjIxSeHf78/ZuViL7SwWWWpJR0tYnnBIn83y+u0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1675703712508750.9300870213799; Mon, 6 Feb 2023 09:15:12 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set/qcbIKgFMM7F4esxMtE8aeNYJod26cIXu+SOAuK8gPrtvTl3PEhgp9Fe03pqGrPR3rU7mqUQ== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1675703713223100002 Content-Type: text/plain; charset="utf-8" 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); =20 /* vl.c */ -extern int singlestep; +extern int one_insn_per_tb; =20 void list_cpus(const char *optarg); =20 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 |=3D CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1; - } else if (singlestep) { + } else if (one_insn_per_tb) { cflags |=3D CF_NO_GOTO_TB | 1; } else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { cflags |=3D 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" =20 -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 =3D optarg; } else if (!strcmp(r, "singlestep")) { - singlestep =3D 1; + one_insn_per_tb =3D 1; } else if (!strcmp(r, "strace")) { do_strace =3D 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 @@ =20 char *exec_path; =20 -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) =20 static void handle_arg_singlestep(const char *arg) { - singlestep =3D 1; + one_insn_per_tb =3D 1; } =20 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 =3D 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 =3D 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 =3D qdict_get_try_str(qdict, "option"); if (!option || !strcmp(option, "on")) { - singlestep =3D 1; + one_insn_per_tb =3D 1; } else if (!strcmp(option, "off")) { - singlestep =3D 0; + one_insn_per_tb =3D 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 =3D g_malloc0(sizeof(*info)); =20 info->running =3D runstate_is_running(); - info->singlestep =3D singlestep; + info->singlestep =3D one_insn_per_tb; info->status =3D current_run_state; =20 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 =3D 1; + one_insn_per_tb =3D 1; break; case QEMU_OPTION_S: autostart =3D 0; --=20 2.34.1 From nobody Fri May 17 06:53:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1675703728; cv=none; d=zohomail.com; s=zohoarc; b=hL19zDVj8ssGjTCxz0BR7/xBNESMbN4P0lBTLpJU3D70UILfutqXx03sTuZzpa2guc6xFWanhMXwDazb5bO1GXwSRK8QbXHl2TLS1GA37f+AyyMzXYhKftU3qosI2IKm3c3bRJ1JXnAewH7KDUsUn8tIcGdwaRI27e351A+2nFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675703728; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i0Jr8DH9OG5vGfeN7iONeP5ImzvUd60F7hUAYLN+I10=; b=fLHwqkrA5uC1UyOkt4xIZwB0k0GG96+FRSeqJbZCJatYWEoW5zWtHmrirczcRwiLunSkznuq6mj20SDOLW+PtZlnbHdr2QRg6owJkuu70gNGP2LXG5FP1wLsSCCcUFt5nWKLFwV5cCjNszZm+wRpVRMwPP+yTnps4QOIFXCfDYk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1675703728074957.9563637245859; Mon, 6 Feb 2023 09:15:28 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set8Rd6K3n4+7KfU93a6MPHZUE4BOi6hx09WTRJ+IocEkGbF3v8dPVQm3avFgZUkQalIdzCaJTw== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1675703729188100003 Content-Type: text/plain; charset="utf-8" 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 =20 +``-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. =20 Environment variables: =20 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) } } =20 -static void handle_arg_singlestep(const char *arg) +static void handle_arg_one_insn_per_tb(const char *arg) { one_insn_per_tb =3D 1; } @@ -486,8 +486,11 @@ static const struct qemu_argument arg_table[] =3D { "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, --=20 2.34.1 From nobody Fri May 17 06:53:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1675703716; cv=none; d=zohomail.com; s=zohoarc; b=MV9g5U3BfGU5r2Ob9hXBov/or7S2x2o7md685pdt4mDUyH7x8JksOtpcRVlwab7CkLgCzayEju4HxvibCy0op3xfMOy4qhKu9dbP/7v1WoR2lpIXA0sGPfkZFbWQ8RPomrv8v76rwZPfpOEI6gLdIZjbketL/Hl1mj8T20J/6Ik= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675703716; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mvKv8MeGCedu3b+fClY2dUyPUXygqJQqulbvcZ7fvCk=; b=Jmnhjm4+9HSdijYFjvrKd19RI+cV+9HHd8IQU3jqOo0HzREkxQJFg7EO0AGZjK+7kZMbFYCqbFPVw6JldJUHA+od0E9saG5MHyyKb3/ywXk7stSqenFq2CtpQSCqnokfFSCcXwgIlo3ruSyoZhrWAmbJLejnFMhwpJpUYff08qY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1675703716226825.5174809828583; Mon, 6 Feb 2023 09:15:16 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set9PYMns/sjMGG+I0GtYbSF1mHqpnPErgzGNGSY3CGWVQi/iUm1yJMRfoWtkYzN8jZc2z4Klhg== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1675703717088100011 Content-Type: text/plain; charset="utf-8" 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 =20 +``-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=3D]][,events=3D][,fi= le=3D]\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 =3D optarg; - } else if (!strcmp(r, "singlestep")) { + } else if (!strcmp(r, "singlestep") || !strcmp(r, "one-insn-per-tb= ") { one_insn_per_tb =3D 1; } else if (!strcmp(r, "strace")) { do_strace =3D 1; --=20 2.34.1 From nobody Fri May 17 06:53:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1675703750; cv=none; d=zohomail.com; s=zohoarc; b=DP0BuSqg5evHOWSJiRk+14JWsskY0FOhCF4VyA2oPPdIDQGt0TaM49/CYxSakJrJVwwOZpxDXjR2qDQFEKVtiydZ0SnSn+8D3nDC/xPn54X0PHlCSS2vNjxQDPyp3APSVpD/Bq2sky0C9/Q+Yul25ggeG/TrUX7KheUn//4Fg+c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675703750; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CMZp74yJ4afPsnw6Yc/ZceAsQ465N4IhpQ4ktRnsEtk=; b=Fr6bOQtFuP/xrLkphJyGfpjaUiqdAodn4YcR0tjTK+qaKVDpldM6q7E1s5+EN1AWwPgwg1IqqGf7UHzVtnM3gFbnsavoF3cbGGuj39fIrihjjbtg582adxxM+Xh3ljoBhE9xS+/bhwRP+wRiDpLmpI/O+tBiSczFZzMTGSrt87w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16757037505963.6136547564974535; Mon, 6 Feb 2023 09:15:50 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set+BOWSkM+yGV1y+/QJsn+DB9DK64jT1G2RR7tQy+JE0wFEcDVWdEYIpg88IQv4H10qY1qyzBQ== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1675703751460100004 Content-Type: text/plain; charset="utf-8" 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 =3D 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 =20 +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 accelera= tors. +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 =20 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 =20 - 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-p= er-tb =20 once with interpreter and once without interpreter and compare the resulti= ng qemu.log files. This is also useful to see the effects of additional --=20 2.34.1 From nobody Fri May 17 06:53:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1675703712; cv=none; d=zohomail.com; s=zohoarc; b=iy2ab35bJoUTZrlTt1d+CNEtlGy2a9BxHuKl1AasnYIPDhK1P8ux2W6tuspYk+VM8vrdeK90ONv01Vlrysb3503SMyO0kSMW3hbN+9rB64QcuF7CE79wJM+VwfFMz/kHj//wf6n7PLoQ8P5N51jJZBRBV8woURdi/8otb8loJgk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675703712; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aqub2Ln/xHWuYzGV026+az3A7a2YzS+9nE8r5yCljvE=; b=LqNpzOC/hhR+GwGOX5cZfIx0I9XfugPlHqrg8JaiqGu/dAaUIXcYyMLzrmlnlKVGMjF5g1DOXoRCN4yhUN32lD70LYFKMdXfiGewJPgh5iXiknmR4OYLBFi7Cnkjqva/1QmKplhyi20miLQ+1V/OvcRZ/yWFoGcoxDgXDok5cG4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1675703712612148.7029292506395; Mon, 6 Feb 2023 09:15:12 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set8o6d846IlQoNjUJdEw12VqTAaNkcg7Tr22OiUISnnrTC6NX0CIUgCkZf2uLH/qMv2IshTXRw== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1675703713095100001 Content-Type: text/plain; charset="utf-8" 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 QDic= t *qdict); void hmp_human_readable_text_helper(Monitor *mon, HumanReadableText *(*qmp_handler)(Erro= r **)); 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); } =20 -void hmp_singlestep(Monitor *mon, const QDict *qdict) +void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict) { const char *option =3D 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[] =3D { "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 =20 + { + .name =3D "one-insn-per-tb", + .args_type =3D "option:s?", + .params =3D "[on|off]", + .help =3D "run emulation with one guest instruction per tran= slation block", + .cmd =3D 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 accelerato= rs. + + If called with option off, the emulation returns to normal mode. +ERST + { .name =3D "singlestep", .args_type =3D "option:s?", .params =3D "[on|off]", - .help =3D "run emulation in singlestep mode or switch to nor= mal mode", - .cmd =3D hmp_singlestep, + .help =3D "deprecated synonym for one-insn-per-tb", + .cmd =3D hmp_one_insn_per_tb, }, =20 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 =20 { --=20 2.34.1