From nobody Fri Nov 7 12:58:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153875557141030.289527080956873; Fri, 5 Oct 2018 09:06:11 -0700 (PDT) Received: from localhost ([::1]:35809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8Sc6-0006PG-2s for importer@patchew.org; Fri, 05 Oct 2018 12:06:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8SSH-0005zk-7S for qemu-devel@nongnu.org; Fri, 05 Oct 2018 11:55:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g8SSD-0004f2-Ji for qemu-devel@nongnu.org; Fri, 05 Oct 2018 11:55:53 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:52773) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g8SSD-0004ef-Cv for qemu-devel@nongnu.org; Fri, 05 Oct 2018 11:55:49 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 189-v6so2331470wmw.2 for ; Fri, 05 Oct 2018 08:55:49 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 63-v6sm2675438wmj.39.2018.10.05.08.55.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Oct 2018 08:55:45 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 1C8B13E0248; Fri, 5 Oct 2018 16:49:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yEoC4JPYjoTTbOmow+eMx0SCxkJe38nlMdEtsRlWWgI=; b=UdgudvjJHnpaUsXNyXuqekzUPHpDMs17L9EJXMer20z3YczALoGnqPpY/+UvXbm2AW cV1TfkPZEISiN4LZ6EyIU8i5JQSUcLJBAP52BElsccCKBGYqdy1uv6G9z/Ql4NORLOJG LzlRZtgqBeIEpEtfRXia/QXRv6HtI2wtdIvR4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yEoC4JPYjoTTbOmow+eMx0SCxkJe38nlMdEtsRlWWgI=; b=Pt7mQRyZ0SoJUPLcPPcojJnCVb9e8VqXC1be7K26ysu7z+IQSE0oT+l45x0i3BX8oB ASZbRgPpnOm9zncWeCZjH9V/7a5grleiAeN5UB5NQQrTf/whqsoCfOyDH+x4udFQH0Ar 6YKeIQ84lQNBsgZvZVsqzy3NMrvbXBWgbOSwDBmph592/K6kxZoQoyz1zBEkGH0D/Nq7 jw01G9+9cQ+8PEBZwqjvU6vAURtX7xA8ZwmUT/FoB505ZQ5Hnq2Noh+gNOn+jQkj1sum OHhh/d5OFpREdmBxY0yuUkrieEdV9RhyQPQBHSHmv1byiU6uVNU8XdUVPv5DD7cr88NC EMWw== X-Gm-Message-State: ABuFfohM1U60zFbs55wG4peAToE5VZi0ImuOgm0ZlgI0C29n/EGpgH9i WuLcB8eGMRGvfKIzRe0GVpV91w== X-Google-Smtp-Source: ACcGV62yg77KYLjN/ZaKwX0nu11nA+hqUTMAAsCLf2JthK5q5AIhGiPf2K1TGUqkfy18mSTW4pWNuw== X-Received: by 2002:a1c:a8c2:: with SMTP id r185-v6mr8149887wme.8.1538754948144; Fri, 05 Oct 2018 08:55:48 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 5 Oct 2018 16:49:06 +0100 Message-Id: <20181005154910.3099-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181005154910.3099-1-alex.bennee@linaro.org> References: <20181005154910.3099-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32b Subject: [Qemu-devel] [RFC PATCH 17/21] hmp: expose status of plugins to the monitor X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi , Markus Armbruster , "Dr. David Alan Gilbert" , cota@braap.org, Pavel.Dovgaluk@ispras.ru, =?UTF-8?q?Alex=20Benn=C3=A9e?= , vilanova@ac.upc.edu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Signed-off-by: Alex Benn=C3=A9e --- hmp-commands-info.hx | 17 +++++++++++++++++ include/qemu/plugins.h | 1 + monitor.c | 14 ++++++++++++++ trace/plugins.c | 15 +++++++++++++++ 4 files changed, 47 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index cbee8b944d..e245a852ae 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -683,6 +683,23 @@ STEXI Show available trace-events & their state. ETEXI =20 +#if defined(CONFIG_TRACE_PLUGIN) + { + .name =3D "trace-plugins", + .args_type =3D "name:s?", + .params =3D "[name]", + .help =3D "show available plugins and any extra info " + "(name: plugin name pattern)", + .cmd =3D hmp_info_trace_plugins, + }, + +STEXI +@item info trace-plugins +@findex info trace-plugins +Show available trace-plugins & their state. +ETEXI +#endif + { .name =3D "tpm", .args_type =3D "", diff --git a/include/qemu/plugins.h b/include/qemu/plugins.h index c86bb7ae67..44f2ec8c98 100644 --- a/include/qemu/plugins.h +++ b/include/qemu/plugins.h @@ -6,6 +6,7 @@ void qemu_plugin_parse_cmd_args(const char *optarg); void qemu_plugin_load(const char *filename, const char *args); void qemu_plugins_init(void); +GString *qemu_plugin_status(const char *name); =20 #else =20 diff --git a/monitor.c b/monitor.c index d8229cd2b0..0d0de9ece7 100644 --- a/monitor.c +++ b/monitor.c @@ -67,6 +67,9 @@ #ifdef CONFIG_TRACE_SIMPLE #include "trace/simple.h" #endif +#ifdef CONFIG_TRACE_PLUGIN +#include "qemu/plugins.h" +#endif #include "exec/memory.h" #include "exec/exec-all.h" #include "qemu/log.h" @@ -1429,6 +1432,17 @@ static void hmp_info_trace_events(Monitor *mon, cons= t QDict *qdict) qapi_free_TraceEventInfoList(events); } =20 +#ifdef CONFIG_TRACE_PLUGIN +static void hmp_info_trace_plugins(Monitor *mon, const QDict *qdict) +{ + const char *name =3D qdict_get_try_str(qdict, "name"); + GString *status =3D qemu_plugin_status(name); + + monitor_printf(mon, "%s", status->str); + g_string_free(status, true); +} +#endif + void qmp_client_migrate_info(const char *protocol, const char *hostname, bool has_port, int64_t port, bool has_tls_port, int64_t tls_port, diff --git a/trace/plugins.c b/trace/plugins.c index 25aec2ff70..05630b02e6 100644 --- a/trace/plugins.c +++ b/trace/plugins.c @@ -58,6 +58,21 @@ void qemu_plugin_parse_cmd_args(const char *optarg) qemu_opt_get(opts, "args")); } =20 +GString *qemu_plugin_status(const char *name) +{ + QemuPluginInfo *info; + GString *status =3D g_string_new(""); + + QLIST_FOREACH(info, &qemu_plugins, next) { + if (info->status) { + char *pstatus =3D info->status(); + g_string_append_printf(status, "%s: %s\n", info->filename, pst= atus); + g_free(pstatus); + } + } + return status; +} + static int bind_to_tracepoints(GModule *g_module, GPtrArray *events) { int count =3D 0; --=20 2.17.1