From patchwork Fri Oct 25 06:36:56 2019 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: 177632 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3245233ill; Thu, 24 Oct 2019 23:54:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxljSM3pZ1qU8zKt3TQrfghDJy/Yn5miLn8UeCdVjC9qPaHotKjDTz6XeXT3iRLN3hnQAe5 X-Received: by 2002:a17:906:3746:: with SMTP id e6mr1874435ejc.170.1571986447023; Thu, 24 Oct 2019 23:54:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571986447; cv=none; d=google.com; s=arc-20160816; b=yuePFANYGuLkgI+/irQpgs5I9B73twSryU7jT5uMI8nspwGqDiXpm7VGbXUh+1osEA YFoKTnVjsvxKW7SZze0xksElbn96t7/7bcCG11gDmcj56/6W67yXhb9+pHX5UvvmmuRH GaQgF4rbl0ykFgA+YEinJLRLjm/GAye3He6+V1l97CvJgQ91KCfKONBEjV9uAJtsdyLN v8VsPpFqo1ulXupyMExrNKZ0Q6Po3jSNvIom1+LKJcnsnSaMTOPmKvMN6LiuJonqoREr ExY9sYUpLHmVDLHm9lpBjKk2TOjYTYu6sb/a1xDtul+esvSSxfHUMF2C7jOV9HfExJRh M7zQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ejSGmzKi8yOJXrP8xmGu9NmM/5lE3B8zIrb30U/0RJ0=; b=DH0UhXVcaqll2qV9CJLXK9RQUtHhKrLIZDbrU0IrvbOiSh2ATtnf7A9kONkV6zVMDJ 0OWgkWekRH/FG/6qEH5ewTxp2zaS+0R/XI5sdM6Aiy5vWUc8JnyWlM6mNwxkSUFVGu1T olM5fiRKF1ymvLmvF2BMu452x8ASSSPIM9KmMTSR73NRLu7t4NUf4aTkbV9JW2Mf30DB ai1sVLN+fkZZVTZaWmLJxXoPPp/kAfS0gT8cUQ8k5XFmAGkwd6S9QgGEwbiA0T+CBHLk laibvT89GNH42pCI5TzLFofdgbD7x2BK/bHdTd5hYsivmCs8MNJFpUa02BjrhnuxAnTd kXWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Dkaas+Ru; 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=fail (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 d28si631704edb.10.2019.10.24.23.54.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Oct 2019 23:54:07 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=Dkaas+Ru; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNtU5-00041j-9G for patch@linaro.org; Fri, 25 Oct 2019 02:54:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35622) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNtE6-0003R1-SE for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:37:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNtE5-0008TS-M1 for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:37:34 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:51252) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNtE5-0008ST-Bm for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:37:33 -0400 Received: by mail-wm1-x32e.google.com with SMTP id q70so769195wme.1 for ; Thu, 24 Oct 2019 23:37:32 -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=ejSGmzKi8yOJXrP8xmGu9NmM/5lE3B8zIrb30U/0RJ0=; b=Dkaas+RuFbYXkql0xawrGQmJ2idIvjDSXnSbERjVKJeq0aeh+XyAS2RQG3qv6/TLwu gCxcdpPMQ5Ii6t+sao3aSsbghL4q6df8V7xFmzIXKIv/BZ3cIFDpP9J1ZHosYCQFJJac qp3DpgDVXp0D/+GGLBukLGnRfOFZ2RRglnZBffIkFRaTZsUroLh/kD5SRc5t1iIAVeoK cWCWhrGRCCWnliT1U7+iMQL5Qjb+x45CPATEcqcolM0VOh9crJ8PsTet0W12dJvtzKpG 6EXabIWFHiRsV6N+dKvAOe8E64xC+XfGwfwW+WcNSzbnm2u/zGPua+8VPIMREne/TfBo q6TQ== 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=ejSGmzKi8yOJXrP8xmGu9NmM/5lE3B8zIrb30U/0RJ0=; b=kyIuHh2f6X8wf7Q8FoBddPn2R+5vqevmMphIoVCb1p+kC973JU5FQJIsyvR6l5Yvaj Xvn/y+DFH/eqYih1urkMDdaqqo+9CP7BhXp6ph2hh0PhGu0zkjByrIVddyIDq2dDwYnl 2nBbnSOcLwVF0WVbfVFD28j3OKxP3F/gyjl30Du38/KO/BX0vbJ1Nn3oHC9K0Hyqagf7 DeKaFK+CMAo3a6I9bMTDLwmdJiAzHiKyMWpUa69ScLoMhgqUSEZF1sy+0TwnVrHkzNhg 7fuqk3f8nLGne9Fz01eaW3U2YavRI8+pfnbn0xBCbh0jdX/aHQmJjtisuZTwVyNpZ0iL Qcyg== X-Gm-Message-State: APjAAAVNCwaxKArh65LY5/uFYDVbxLcGbEBfAgwqyrX4jj27ZxjTdUaS 7V+Ei1yoGksen0ETuB/DmZuYQQ== X-Received: by 2002:a1c:49d5:: with SMTP id w204mr1922093wma.111.1571985450983; Thu, 24 Oct 2019 23:37:30 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l26sm455009wmg.3.2019.10.24.23.37.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 23:37:24 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 045201FFCF; Fri, 25 Oct 2019 07:37:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 56/73] plugin: add qemu_plugin_outs helper Date: Fri, 25 Oct 2019 07:36:56 +0100 Message-Id: <20191025063713.23374-57-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191025063713.23374-1-alex.bennee@linaro.org> References: <20191025063713.23374-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::32e X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aaron Lindsay , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Having the plugins grab stdout and spew stuff there is a bit ugly and certainly makes the tests look ugly. Provide a hook back into QEMU which can be redirected as needed. Signed-off-by: Alex Bennée Reviewed-by: Aaron Lindsay -- 2.20.1 diff --git a/include/qemu/log.h b/include/qemu/log.h index b097a6cae11..a91105b2adc 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -45,6 +45,7 @@ static inline bool qemu_log_separate(void) /* LOG_TRACE (1 << 15) is defined in log-for-trace.h */ #define CPU_LOG_TB_OP_IND (1 << 16) #define CPU_LOG_TB_FPU (1 << 17) +#define CPU_LOG_PLUGIN (1 << 18) /* Lock output for a series of related logs. Since this is not needed * for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index ddf267fbfe0..a00a7deb461 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -384,4 +384,10 @@ int qemu_plugin_n_vcpus(void); /* returns -1 in user-mode */ int qemu_plugin_n_max_vcpus(void); +/** + * qemu_plugin_outs() - output string via QEMU's logging system + * @string: a string + */ +void qemu_plugin_outs(const char *string); + #endif /* QEMU_PLUGIN_API_H */ diff --git a/plugins/api.c b/plugins/api.c index 5adc4d25a1e..fa1d9f276d3 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -331,3 +331,11 @@ int qemu_plugin_n_max_vcpus(void) return get_ms()->smp.max_cpus; #endif } + +/* + * Plugin output + */ +void qemu_plugin_outs(const char *string) +{ + qemu_log_mask(CPU_LOG_PLUGIN, "%s", string); +} diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index 267ec381b4a..4bdb381f48e 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -36,4 +36,5 @@ qemu_plugin_vcpu_for_each; qemu_plugin_n_vcpus; qemu_plugin_n_max_vcpus; + qemu_plugin_outs; }; diff --git a/util/log.c b/util/log.c index 1d1b33f7d9f..1ca13059eef 100644 --- a/util/log.c +++ b/util/log.c @@ -273,6 +273,9 @@ const QEMULogItem qemu_log_items[] = { { CPU_LOG_TB_NOCHAIN, "nochain", "do not chain compiled TBs so that \"exec\" and \"cpu\" show\n" "complete traces" }, +#ifdef CONFIG_PLUGIN + { CPU_LOG_PLUGIN, "plugin", "output from TCG plugins\n"}, +#endif { 0, NULL, NULL }, };