From patchwork Tue May 2 12:14:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 678376 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp474385wrs; Tue, 2 May 2023 05:23:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ664e5YT45LVdg7lXRVZSvWso9OQwWQv9n8omCm4WEAa49uc3u30JIOBrkMxZFERBhxQmyf X-Received: by 2002:a05:622a:4d3:b0:3ef:6513:75ff with SMTP id q19-20020a05622a04d300b003ef651375ffmr27086319qtx.7.1683030231966; Tue, 02 May 2023 05:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683030231; cv=none; d=google.com; s=arc-20160816; b=wolu7ccwaqQENyydK1NlelF+3VZsf4gQjl5XtgtqmBpHWQmGHO795VbPvxYalQMIEM 6Ok5/IlCwXkYeGFMGg428cwVhmHdic78EtDDAHRELeTsDgRRz0iYcy6geZkyTEH/guSf J0W4/nop5tcQrHXwGr+axh6bvhPUAxAS7qwbyNYHcEwqpMApCVjp3ZYO+6dZooMsKwEX aBI4J8UxIpDTNBmT4+X7ZgAUgNLWVNoxCoC5dlnu4PSXD5h88nn8TzRihtq/nCLGIAQH N243YmH3YMuNe5Gc4tKal1S7Y/5anHrumFVAMd6RxxhOhGhU+fss5jFcWgLAJG6371BL fv3Q== 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:to:from :dkim-signature; bh=yRpHTF6gUhcift1QfiFZpMBeeq76xSt6EAXJWyDrQZs=; b=w5mbkrdZZaOTk8jFSkT9VWfa4P8v66PvbsepiJVtQnB63SEr1Bu9mIAFrPM3WotFSU yhRDEFeZTjYnVjk+lwDAak2noHghVqxfQMLqgfsdltL/EvR3QRKjOJzKpdnvFqK+Azqb 0TlAnaDRNYRXFAyOX70PR83PntYaUcEG5xJvxGZVPCuqLFei6lf2QY9pvkAoomOns++h qSZgBBic6fAdcDG9c2LnvSyB7enp0g13eTSTKQionrE0Y+REEfDbfVvNvN9Zh0X+7+Ya NxlVVw1nc6xGiwa2jQ1aghGZg544+wPpI8lBLrMiged5QaISqNxS95+5rDYy+v39xAvu y5HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HghBuyKp; 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 e9-20020ac85dc9000000b003e4dcda2644si12546795qtx.12.2023.05.02.05.23.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 May 2023 05:23:51 -0700 (PDT) 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=HghBuyKp; 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 1ptov9-00047a-FJ; Tue, 02 May 2023 08:15:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ptoui-0003od-Vu for qemu-devel@nongnu.org; Tue, 02 May 2023 08:15:36 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ptouX-0003DR-4J for qemu-devel@nongnu.org; Tue, 02 May 2023 08:15:20 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3f182d745deso35924245e9.0 for ; Tue, 02 May 2023 05:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683029711; x=1685621711; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yRpHTF6gUhcift1QfiFZpMBeeq76xSt6EAXJWyDrQZs=; b=HghBuyKp0AKDimEoiO4K6aoM5CUtac7ze/C42CjxQmDRfEH12NdwxZ/hFBADAzwwQU +V/chwrZTSM0680JkTOXkIVA0IgVdrUaX2600sa10R+dPEZyIV5GV32TLMo5B3UkDkun BDmQ4UfkUQ7w6DRq6gbhG9wCTnaXm0f4iWhCERCXBteeosts+mRAFP7+W3jmXDMRSsvj fL44vpLdmJUzZABOnNaB+H/jwfMpvSrOGBOLdwfBN+WIO4v6B4KNb5CZO5xor0GG5FmF izWutXgWFYR21mEJZiavgYVl/5j5ENcV8Y4eazqrhFpaFf056uXad7Lojx/Wzc1PgY+Y vCHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683029711; x=1685621711; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yRpHTF6gUhcift1QfiFZpMBeeq76xSt6EAXJWyDrQZs=; b=NCtSUD0NCgwrOgeN23UXneoqZdH+AVLEm4df9OaXuXzg90ho8Xb610JTxrTwGETAPy elGcQo1SjQnzvlFd1B6Bu2umetS9QNDWxTGWy3l7sr3SBqqwbjVKOrAfTV07uwVKW6GY Ur8vJOGuU9wdkMk9uk3vXFnxMLHyR7TJ1tiBm0no5keUaxzjXFluva53lh6NvGvyAUQJ YXZWrsgUkAkyaDPoIWugEWd7vM/gZkkBsnHaJgNUuLa9sjEfv2Eiu5oMlUgZM1ejEnh2 +4vCHbfS6bqRf9Mrgr5lkkHB6qJ6sShHBipPMRhbne6vAMmC955KQKsx43x6daHNBgTk FIZQ== X-Gm-Message-State: AC+VfDz9BePJ2tA0niKKfxSoga7x2gxKthqLfyHufZgMrTlohH22gzTn tiixdSH/RLWst6mahdLtHkKUiqVXOOs4E2qlQbA= X-Received: by 2002:a05:600c:224e:b0:3ea:d620:570a with SMTP id a14-20020a05600c224e00b003ead620570amr12774710wmm.38.1683029711500; Tue, 02 May 2023 05:15:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id g10-20020a7bc4ca000000b003f171234a08sm35040330wmk.20.2023.05.02.05.15.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 05:15:11 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/35] hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep' Date: Tue, 2 May 2023 13:14:47 +0100 Message-Id: <20230502121459.2422303-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230502121459.2422303-1-peter.maydell@linaro.org> References: <20230502121459.2422303-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+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. We aren't obliged to do deprecate-and-drop for HMP commands, but it's easy enough to do so, so we do. Signed-off-by: Peter Maydell Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-id: 20230417164041.684562-9-peter.maydell@linaro.org --- docs/about/deprecated.rst | 9 +++++++++ include/monitor/hmp.h | 2 +- softmmu/runstate-hmp-cmds.c | 2 +- tests/qtest/test-hmp.c | 1 + hmp-commands.hx | 25 +++++++++++++++++++++---- 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 3c62671dac1..6f5e689aa45 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -199,6 +199,15 @@ accepted incorrect commands will return an error. Users should make sure that all arguments passed to ``device_add`` are consistent with the documented property types. +Human Monitor Protocol (HMP) commands +------------------------------------- + +``singlestep`` (since 8.1) +'''''''''''''''''''''''''' + +The ``singlestep`` command has been replaced by the ``one-insn-per-tb`` +command, which has the same behaviour but a less misleading name. + Host Architectures ------------------ diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index fdb69b7f9ca..13f9a2dedb8 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -158,7 +158,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 a477838dc5a..2df670f0c06 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"); AccelState *accel = current_accel(); diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c index b4a920df898..6704be239be 100644 --- a/tests/qtest/test-hmp.c +++ b/tests/qtest/test-hmp.c @@ -56,6 +56,7 @@ static const char *hmp_cmds[] = { "o /w 0 0x1234", "object_add memory-backend-ram,id=mem1,size=256M", "object_del mem1", + "one-insn-per-tb on", "pmemsave 0 4096 \"/dev/null\"", "p $pc + 8", "qom-list /", diff --git a/hmp-commands.hx b/hmp-commands.hx index bb85ee1d267..9afbb54a515 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 {