From patchwork Mon Apr 17 16:40:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 673837 Delivered-To: patch@linaro.org Received: by 2002:adf:fcce:0:0:0:0:0 with SMTP id f14csp1604384wrs; Mon, 17 Apr 2023 09:41:03 -0700 (PDT) X-Google-Smtp-Source: AKy350bfQMbqPoongm4kPHkXbHu4aqMQbqfaWXGgWti92sXBbvHIswPG1Ilcjq+RxKTTrrO5jgax X-Received: by 2002:ad4:5b8b:0:b0:5b4:89b4:1b0a with SMTP id 11-20020ad45b8b000000b005b489b41b0amr13565460qvp.10.1681749663033; Mon, 17 Apr 2023 09:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681749663; cv=none; d=google.com; s=arc-20160816; b=tBvIWFnxw0mApriNBuKW90PyS05md6QbEmxvRBEVUzatXjNBXBjQRpsEPLusu8Nj1b hT1OxBd+ZZnt5uM7e7ol/H+Dkf0X2ZpJwYvHcnY3+4pzv9hfeCP0saowiOs+upBsU3Bs aj6/Wc8p4DYHViaPb+Iu/eKOSYaY5FJ7jmV/DW0VjMDgMPgazH6vN5b/7hsPWlOM3j4N an9/bQRJNPcjMlllhXjXba0fnnE7vnw53ZjJho+1IgYultDXvu+6QND4S1/8yPB3tfYa LU7e/zoyuqFi34nDyJdF5r9mU6blDPucN5feWHwcLYXsb+0qPsDkRnLVL59nnWEExPkY KFVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=XdrcDkwMacIqQO2KUO210mgRUqyMuFKPIP+LZZZwEDs=; b=BfRLzwcVMybRGWmPQH59A3IyNMHwbnA+X1WEJc1n2WqlLye2akBBcy7im1v4IX2rSa o1ycVtln5WFzAFajK6k6J3n3JW4kfNHVBW68VONosrP6jAdcPGyJ68zGriBOEGn1BlI6 HMi3B3EKCvVzZtsEYwkRncdhl+mMh1j1x5rOH3UPif+OsaooB99/Un5bK2YWwjDiiQTe CfHceWZHyl/Dq2oHY7Ri9/G5KHFYaJIib1qQJ/KsuCZX6pDRqoqDk0yWr4MJt0qJPvV4 JFCEiFeF6FhmpmWiQVqToow9PVMgShQqBNyoxhKEkXnKw0kejfnINnLYIl3J7qB1HCFx nCZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NC6VQ7k6; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.129.124]) by mx.google.com with ESMTPS id fn5-20020ad45d65000000b005e625695a7csi1676110qvb.91.2023.04.17.09.41.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 09:41:03 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NC6VQ7k6; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681749662; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XdrcDkwMacIqQO2KUO210mgRUqyMuFKPIP+LZZZwEDs=; b=NC6VQ7k6KxDn7vbiDPbzxfln4VfQSGQgUFN66j0K5KnAclUrku8o03+cGoDCan8j5suPZ2 zlTLI0+A/iPvBlOEnOCfHlPi8P9aRFmXZgm8Pe8/feL/jqL7B2iZ3fDhDEplDGJF6kC5FY nYiqXPp2g79MSr9tDodJemLL11YsbGY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-149-BDSFuX4GMJCdjZprBMahpg-1; Mon, 17 Apr 2023 12:40:59 -0400 X-MC-Unique: BDSFuX4GMJCdjZprBMahpg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4198A3C1024E; Mon, 17 Apr 2023 16:40:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D2B751FF; Mon, 17 Apr 2023 16:40:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1E765194658D; Mon, 17 Apr 2023 16:40:53 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E1454194658C for ; Mon, 17 Apr 2023 16:40:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B7112492B10; Mon, 17 Apr 2023 16:40:50 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF7D3492B0F for ; Mon, 17 Apr 2023 16:40:50 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 961AA85A5B1 for ; Mon, 17 Apr 2023 16:40:50 +0000 (UTC) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-595-Lemr1kyINVu6daztPWDyAQ-1; Mon, 17 Apr 2023 12:40:49 -0400 X-MC-Unique: Lemr1kyINVu6daztPWDyAQ-1 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-3f0a0c4e1ebso17180145e9.3 for ; Mon, 17 Apr 2023 09:40:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681749647; x=1684341647; 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=XdrcDkwMacIqQO2KUO210mgRUqyMuFKPIP+LZZZwEDs=; b=OzeuCkW1jjAhrGUDVq4Xhfkfob8c+ccyH9WRMTUCABXZ9/t+IxOOfsMUxd/EfoEZnV UfYy0LkksXSrFhBpbny+VkR4PPOVZkjuhFA8kEaQs/ikhXfjoTiv90f9Os1kl/XwkslX QqzJR6Ndgy8AZK63G1MxMYCZZ9IUXbEbapxehbltaDfw3lk4RpKc/5YNSjZWhUdr4jec r1L+eOB6f+l3bN9QGZI3e2l850syKjWhBKfbX+mFCLq5rsuGGLNLdwbS6aSdg1MHNt6r Od2CAPTnrkxXKBXLrRF7nM8cmSGWF8oaqMl8AZ7oAQJB1uSCPlA284P5dj8XEzg/ufJK Wyxg== X-Gm-Message-State: AAQBX9frGLgW19sI/Fx/d2RmMgyQttuMhkNoW/hYVRZcd/36tW/d5mdB fEGcJc7Wtk5A5Hj8JC+jnOc5LA== X-Received: by 2002:adf:f547:0:b0:2fb:1d3a:93ff with SMTP id j7-20020adff547000000b002fb1d3a93ffmr2053433wrp.61.1681749647507; Mon, 17 Apr 2023 09:40:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q17-20020a5d61d1000000b002faaa9a1721sm2595103wrv.58.2023.04.17.09.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 09:40:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v3 08/10] hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep' Date: Mon, 17 Apr 2023 17:40:39 +0100 Message-Id: <20230417164041.684562-9-peter.maydell@linaro.org> In-Reply-To: <20230417164041.684562-1-peter.maydell@linaro.org> References: <20230417164041.684562-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: libvir-list@redhat.com, Kyle Evans , Richard Henderson , Markus Armbruster , Laurent Vivier , Eric Blake , Warner Losh Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linaro.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é --- 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 {