From patchwork Fri Oct 5 15:49:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 148215 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp631183lji; Fri, 5 Oct 2018 09:06:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Wk7pjDtrrtUUEmRx3O5hMfxyrF5g5ZJ3A3+rKBlHP9Si6NtdV9XrhfNEarXTdKSftHIHo X-Received: by 2002:aed:206e:: with SMTP id 101-v6mr9819724qta.11.1538755615652; Fri, 05 Oct 2018 09:06:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538755615; cv=none; d=google.com; s=arc-20160816; b=pP7EFOw6A/BGsTxmNZz7I9bqSwo8HV4LVqn55gadKa2BsallomZN6aoUvbgRJ3u20p TrZ2UYhndxyMyHlV/wY4LKyWm6AdzhSrMFmszr8WOS6eabDuw7VCD/p4l2TNjmBMN5gZ xea8RkI9ohoeAkiI0wOMbcV3OYhQy6GYL2fo86HN81uZUz6zh0CJTquSQUdnsg9jirg1 knq5f0xxyrBgJu+2LvfETAyPT8F+h6ajA56DO6Frs/vrY5dXy148CnZ81Dt8pcQQP5dC pwdR2PVajU+bSDzzGQnImkf34/ENxy2mPJYfj19NVVFcvx9ONp8NkmVUZpm8h+5kZWVi Vt8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=yEoC4JPYjoTTbOmow+eMx0SCxkJe38nlMdEtsRlWWgI=; b=0nk/CFmA0eoko3J95MwcjuutqDOdnmPAzIp3ZSaL0C5OOFnAju1oYw3BN6gJBOeEJp vEcdQaRlarJORZhRYK6smY8skYXEPPReCJJAb+8ceTlt52BCXgtGkQix7iombuUtXXWz oTMlE9K5FZhauFdtKjNbwXPt7jg2S8tjuT8fH13RSOhwq2UVbjc6NYH6RAY2akSJ1Yuj fM1xBzA7GrKtbM5kSa3ZQYViq49+nPJ83hCW9/fblrem5+WIzo8vmzyj/Rcyp7BOZRDc IPXXB0SJnDafB2msrVk0MNE8mMectcl8J4oxuyvEZil5UYaj9UMV50OaB6yzxGGlQbY3 ozZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UdgudvjJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p1-v6si2726245qta.42.2018.10.05.09.06.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 05 Oct 2018 09:06:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UdgudvjJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35823 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8Scx-0007e9-5M for patch@linaro.org; Fri, 05 Oct 2018 12:06:55 -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) 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-Received: by 2002:a1c:a8c2:: with SMTP id r185-v6mr8149887wme.8.1538754948144; Fri, 05 Oct 2018 08:55:48 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= , vilanova@ac.upc.edu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée --- hmp-commands-info.hx | 17 +++++++++++++++++ include/qemu/plugins.h | 1 + monitor.c | 14 ++++++++++++++ trace/plugins.c | 15 +++++++++++++++ 4 files changed, 47 insertions(+) -- 2.17.1 Reviewed-by: Richard Henderson Reviewed-by: Dr. David Alan Gilbert 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 +#if defined(CONFIG_TRACE_PLUGIN) + { + .name = "trace-plugins", + .args_type = "name:s?", + .params = "[name]", + .help = "show available plugins and any extra info " + "(name: plugin name pattern)", + .cmd = hmp_info_trace_plugins, + }, + +STEXI +@item info trace-plugins +@findex info trace-plugins +Show available trace-plugins & their state. +ETEXI +#endif + { .name = "tpm", .args_type = "", 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); #else 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, const QDict *qdict) qapi_free_TraceEventInfoList(events); } +#ifdef CONFIG_TRACE_PLUGIN +static void hmp_info_trace_plugins(Monitor *mon, const QDict *qdict) +{ + const char *name = qdict_get_try_str(qdict, "name"); + GString *status = 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")); } +GString *qemu_plugin_status(const char *name) +{ + QemuPluginInfo *info; + GString *status = g_string_new(""); + + QLIST_FOREACH(info, &qemu_plugins, next) { + if (info->status) { + char *pstatus = info->status(); + g_string_append_printf(status, "%s: %s\n", info->filename, pstatus); + g_free(pstatus); + } + } + return status; +} + static int bind_to_tracepoints(GModule *g_module, GPtrArray *events) { int count = 0;