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 {