From patchwork Mon Apr 3 14:46:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 669786 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp1925597wrt; Mon, 3 Apr 2023 07:47:50 -0700 (PDT) X-Google-Smtp-Source: AKy350Zc47BK/T+ZEQOa+xl5VNgPyKCPHyoTWD1X7CQGEvZTZYlEVz/h3NLppVBQXK79HLwakvgK X-Received: by 2002:a05:6402:2027:b0:4fd:1f7b:9fbd with SMTP id ay7-20020a056402202700b004fd1f7b9fbdmr16908684edb.6.1680533270297; Mon, 03 Apr 2023 07:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680533270; cv=none; d=google.com; s=arc-20160816; b=XYrJZYnoUC5Trwt38do3cEKz1ZWN2nm02P19FyQV0qnOJWFPOcGyhV9hN+FqtyBxV7 vmn3GzJqAk03Sw+SeeN8JJbflLeRYR8mDbjUg2meuHQpRLSxNR4rFWP6qx92MqsfrqZv nwMUOcEZQgkY11+MakfAhOlfgRFVTme0AET+35Fw3tOZgJDUb2mJ4L/D1QM8c/3Lu632 unT+qEbab+MNXhiibKFFxhM0HjaZLelB4ppS0NwedmCqmRCuCZl2Dp13yNdtVsedFb6r qfNzF+AkQaru/BHrnIzJo8wVuGoQHKerI0jyFhlfpH6ewDWqYFp9bCGe4QU//j5+OZk0 QCIA== 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=YO9m3UJpoeAUuVfDe6PY7fBDGyKIbPa3OPAs5QubE+o=; b=F37QkU8Fv2IpN7e1e7fasEIF83AYb8dar+qhPDkr/gG1+OWQxPTNU6YryG172Wual7 vz0Y8FDsrZI7hN/FfeIALPv0kd2t/VLSlm1Zr3CgWX8sHPCETObvzm1FMXnvULR/Km3p SHKgUZ4ERnFvoGLhQwQwAcHR+yG7pimxC5+pxjZ+fwdw5aFs7HPfFrVT1znCClgLhpYx idX7JiwzMBSm+ms9F3n/2LMF/u75EMPT3hVvdMUP18QUz1jwJt4xnIuKYCJuBd+JOA36 ghsK5rUfsN9lpe5IGKg6wzoboxvsD/OjoIMbLkGaHY4NMAPINuksZWBATHfyKGCqVl5/ 42xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="V3kMkiI/"; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.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.133.124]) by mx.google.com with ESMTPS id w23-20020a50fa97000000b004aac683bad9si613594edr.379.2023.04.03.07.47.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 07:47:50 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="V3kMkiI/"; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.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=1680533269; 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=YO9m3UJpoeAUuVfDe6PY7fBDGyKIbPa3OPAs5QubE+o=; b=V3kMkiI/rQhQy0xOul45cyoc7F78vBvJBJkWxCB0ojOSELEndGkOou+ap2RUv15YXvcXTv JqKMAucwqJr+YVvC0aK5Ujg8H7Xd6DZ89VHlvq9foQWyDcWF44nJoXfrhwFvu2qKPNQipp 2xsnp+XI3qG+I1zemc8aUxeGA79ntZQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-628-tBnT4LVfPB-grgrThUj47Q-1; Mon, 03 Apr 2023 10:47:43 -0400 X-MC-Unique: tBnT4LVfPB-grgrThUj47Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 615A4185A7A2; Mon, 3 Apr 2023 14:47:40 +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 4C558C15BA0; Mon, 3 Apr 2023 14:47:40 +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 262FE1946A78; Mon, 3 Apr 2023 14:46:50 +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-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A4D0119465A8 for ; Mon, 3 Apr 2023 14:46:43 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 84D1A2166B29; Mon, 3 Apr 2023 14:46:43 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D4DF2166B26 for ; Mon, 3 Apr 2023 14:46:43 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 5D4C68030DC for ; Mon, 3 Apr 2023 14:46:43 +0000 (UTC) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-201-RVXxcWOGPWap2ojD48vORQ-1; Mon, 03 Apr 2023 10:46:41 -0400 X-MC-Unique: RVXxcWOGPWap2ojD48vORQ-1 Received: by mail-wm1-f52.google.com with SMTP id v6-20020a05600c470600b003f034269c96so8046486wmo.4 for ; Mon, 03 Apr 2023 07:46:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680533200; 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=YO9m3UJpoeAUuVfDe6PY7fBDGyKIbPa3OPAs5QubE+o=; b=uptDy/4BeAHxZKl/pIIUAYmsIuWr0Cy+zKdGJh3WIKTiZ7isdzrBgCQUjkZdsdfMVd 4nLr5Gc+0MTSzCBq/E1+o2iSnj1j+5jPLG+unKJ+ukfgaor4vXYxERujHA0FQCEHlORU L099c1xFy/FnmjmlLYfeJ6DXET571+ZfQ12568mdZfBtE3Pd2jI2ilieqkcBxrooJ1Po k2cyuE5l5GBLSOJEoc5YYRF8Ng+bK+kbmQKnboQdfAjPUlrfBLUOdFnCB6Fiotq1HQxQ OmlX66UeDyfEKyySbHqEo5Nwtdbe1JORwhKO1T9a1os7EdNmLcoDkvXnB/TT9APObWcC PExg== X-Gm-Message-State: AAQBX9frxwV0c1DWTyXTrTxlAqbSYbtz3hXW2cj7lmyJweFTEIzD7l9j rkBSSFXFQ+UlxQeWAsSNPlS/Tw== X-Received: by 2002:a7b:c7cb:0:b0:3ed:5d41:f998 with SMTP id z11-20020a7bc7cb000000b003ed5d41f998mr14325423wmk.15.1680533200589; Mon, 03 Apr 2023 07:46:40 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id p4-20020a056000018400b002c56013c07fsm9786747wrx.109.2023.04.03.07.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 07:46:40 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 02/10] softmmu: Don't use 'singlestep' global in QMP and HMP commands Date: Mon, 3 Apr 2023 15:46:29 +0100 Message-Id: <20230403144637.2949366-3-peter.maydell@linaro.org> In-Reply-To: <20230403144637.2949366-1-peter.maydell@linaro.org> References: <20230403144637.2949366-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.6 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 , "Dr. David Alan Gilbert" , Eric Blake , Warner Losh , Laurent Vivier Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linaro.org The HMP 'singlestep' command, the QMP 'query-status' command and the HMP 'info status' command (which is just wrapping the QMP command implementation) look at the 'singlestep' global variable. Make them access the new TCG accelerator 'one-insn-per-tb' property instead. This leaves the HMP and QMP command/field names and output strings unchanged; we will clean that up later. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- softmmu/runstate-hmp-cmds.c | 18 ++++++++++++++++-- softmmu/runstate.c | 10 +++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c index d55a7d4db89..127521a483a 100644 --- a/softmmu/runstate-hmp-cmds.c +++ b/softmmu/runstate-hmp-cmds.c @@ -20,6 +20,7 @@ #include "qapi/error.h" #include "qapi/qapi-commands-run-state.h" #include "qapi/qmp/qdict.h" +#include "qemu/accel.h" void hmp_info_status(Monitor *mon, const QDict *qdict) { @@ -43,13 +44,26 @@ void hmp_info_status(Monitor *mon, const QDict *qdict) void hmp_singlestep(Monitor *mon, const QDict *qdict) { const char *option = qdict_get_try_str(qdict, "option"); + AccelState *accel = current_accel(); + bool newval; + + if (!object_property_find(OBJECT(accel), "one-insn-per-tb")) { + monitor_printf(mon, + "This accelerator does not support setting one-insn-per-tb\n"); + return; + } + if (!option || !strcmp(option, "on")) { - singlestep = 1; + newval = true; } else if (!strcmp(option, "off")) { - singlestep = 0; + newval = false; } else { monitor_printf(mon, "unexpected option %s\n", option); + return; } + /* If the property exists then setting it can never fail */ + object_property_set_bool(OBJECT(accel), "one-insn-per-tb", + newval, &error_abort); } void hmp_watchdog_action(Monitor *mon, const QDict *qdict) diff --git a/softmmu/runstate.c b/softmmu/runstate.c index d1e04586dbc..2f2396c819e 100644 --- a/softmmu/runstate.c +++ b/softmmu/runstate.c @@ -40,6 +40,7 @@ #include "qapi/error.h" #include "qapi/qapi-commands-run-state.h" #include "qapi/qapi-events-run-state.h" +#include "qemu/accel.h" #include "qemu/error-report.h" #include "qemu/job.h" #include "qemu/log.h" @@ -234,9 +235,16 @@ bool runstate_needs_reset(void) StatusInfo *qmp_query_status(Error **errp) { StatusInfo *info = g_malloc0(sizeof(*info)); + AccelState *accel = current_accel(); + /* + * We ignore errors, which will happen if the accelerator + * is not TCG. "singlestep" is meaningless for other accelerators, + * so we will set the StatusInfo field to false for those. + */ + info->singlestep = object_property_get_bool(OBJECT(accel), + "one-insn-per-tb", NULL); info->running = runstate_is_running(); - info->singlestep = singlestep; info->status = current_run_state; return info; From patchwork Mon Apr 3 14:46:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 669790 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp1926000wrt; Mon, 3 Apr 2023 07:48:40 -0700 (PDT) X-Google-Smtp-Source: AKy350b4ZKLqKHTjDRFJXRNg3rrFcHsCd9UvkPupPQNEgsRo8FkT8d0VZKk/mXE/22bX3xPNS3Mx X-Received: by 2002:ad4:5961:0:b0:56e:a6bb:47ae with SMTP id eq1-20020ad45961000000b0056ea6bb47aemr59563287qvb.12.1680533320465; Mon, 03 Apr 2023 07:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680533320; cv=none; d=google.com; s=arc-20160816; b=lFUNuWyMoyu1ifEhuIFn6h0L9LQdEp1kg4vK5oXcrmKfyXyQXO4ou7ukBki588j2Z9 oInq+BTUi1S0IgV00IC1FXV+9iLYUq2m6ke4FBPRum8YH3mpdtA0VF7ChCF4oSbr7keF RaHEc9rmeHZ1WJ5xvDW3SZgaqNeV/qOPA66cf++rP6LGkHV7LiwvJIXkaSvABJhv2G5c j5OpbZzc1eyuQjRAZjXVzLwVGBH+6lVofrp69Azi+1I/yoYfqQcAlbxcic8uqbHvDlej u7TVG9Z1xRQvdvvqPEaxuyFpvrm70Iqvdqv4ukTFO7kT2ShqNDr06nawAZYHlx8915tI c+OQ== 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=3epTQBYW6Jzl8bhA8JL/NwcO0wptisWs4DJRdCAPoII=; b=jgZJBKyDmGtzgfZEZ9ge4XFgDkpgPnTumNsojO6RyrqBTYCCMxTX2J73JqVqVikLTb ONiseF4z8/R/keQGjXPs6VYka55sp+r7XgHpAZ5FxOq5m3BNCK9KD1lU2V8YZmSakF+E ysyDV7/9Cw6UCWtLBuUFR9weYFAQw3F4Nvl7XqhOlOGSZCn0W7TgCqkbk1ZtVARDhVvU ZCArY0WP0O0vPRELvgElXLwOzcxTelVgBNkr3fbJvQTLoDGM318ZZZe6SGkdKFUIAkfP B670NQmgbVp/pAVJAnW6bUAx8vdFsjX1had+bRPvgvjDWMz+7gXYw7tfOqsNp2+D0ELf 8t/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EoGEqf2B; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.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.133.124]) by mx.google.com with ESMTPS id o5-20020a375a05000000b007484a622bbbsi5910026qkb.174.2023.04.03.07.48.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 07:48:40 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EoGEqf2B; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.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=1680533320; 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=3epTQBYW6Jzl8bhA8JL/NwcO0wptisWs4DJRdCAPoII=; b=EoGEqf2BiUbFVgVcTCR3NU3TCGNDQuyH6IvLHNGNl9SN5wZxFz/oHshDXfMSUFc0iGyKn6 Q7/VlwbXDw7o/39jFcnI1CJHlNfY6ilDNZxUhZHvsc0bbMjc05BEvcmVW+iB3o1wWr3IQE oNeGizyrNvNO2zrFtq62wpupyOXVi2A= 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-140-tv5fYmkXOYWP-2mCbTcf7A-1; Mon, 03 Apr 2023 10:48:36 -0400 X-MC-Unique: tv5fYmkXOYWP-2mCbTcf7A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 424413C11787; Mon, 3 Apr 2023 14:48:33 +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 2E1CD112131E; Mon, 3 Apr 2023 14:48:33 +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 02C3019472F9; Mon, 3 Apr 2023 14:46:58 +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-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CDA8419465A8 for ; Mon, 3 Apr 2023 14:46:46 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A0CD62166B29; Mon, 3 Apr 2023 14:46:46 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 992FF2166B26 for ; Mon, 3 Apr 2023 14:46:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.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 7DA4E185A7A9 for ; Mon, 3 Apr 2023 14:46:46 +0000 (UTC) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-201-LVRihizGOdutN6dRWj2ckQ-2; Mon, 03 Apr 2023 10:46:43 -0400 X-MC-Unique: LVRihizGOdutN6dRWj2ckQ-2 Received: by mail-wm1-f52.google.com with SMTP id v6-20020a05600c470600b003f034269c96so8046598wmo.4 for ; Mon, 03 Apr 2023 07:46:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680533203; 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=3epTQBYW6Jzl8bhA8JL/NwcO0wptisWs4DJRdCAPoII=; b=qR+mf94YUQXt48nc9VJAJGdBBH/lENfi95r64jqGBRmjOzm5bfwsgUfT6Lj52BEc+Y hJODOHaVXMx0HNoi/VO6JmfFt2TgOx9XYjLTT19XYrmDsF/THKp/Fi5jvckBWNe43KZJ 7FvltqrP+r8dF5GIKpICh0wdi80cbXNRCtJimupTsycK9+9VWdNn2XCMaMaZttvnh18w iuSB/QjRBTFNJEnCs/R2aDJV4QDlc6CS60/mMZqTgHNinW3OIC4isgVZGCgGY/GhG5ME ggJieBx2FrakFLb6mXCxswIVhZ4cZfDfppQDYMkPU5y8eq2A2VYqg6D5PCwRveoV/6m7 hk2A== X-Gm-Message-State: AO0yUKWJvnHEKbhM1zdxaLLbFfKWCUBmckwrouz46CvC+Z1XJrIBd8YD DGTZIcZVOv6lBCGD/zELJJSJkA== X-Received: by 2002:a1c:4b07:0:b0:3eb:2b88:a69a with SMTP id y7-20020a1c4b07000000b003eb2b88a69amr27060975wma.14.1680533203364; Mon, 03 Apr 2023 07:46:43 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id p4-20020a056000018400b002c56013c07fsm9786747wrx.109.2023.04.03.07.46.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 07:46:43 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 07/10] hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep' Date: Mon, 3 Apr 2023 15:46:34 +0100 Message-Id: <20230403144637.2949366-8-peter.maydell@linaro.org> In-Reply-To: <20230403144637.2949366-1-peter.maydell@linaro.org> References: <20230403144637.2949366-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.6 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 , "Dr. David Alan Gilbert" , Eric Blake , Warner Losh , Laurent Vivier Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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 --- 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 127521a483a..76d1399ed85 100644 --- a/softmmu/runstate-hmp-cmds.c +++ b/softmmu/runstate-hmp-cmds.c @@ -41,7 +41,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..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 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 {