From patchwork Thu Sep 23 19:54:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12513625 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E6CAC433F5 for ; Thu, 23 Sep 2021 19:57:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCB9360F94 for ; Thu, 23 Sep 2021 19:57:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CCB9360F94 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:34216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTUqh-0005vV-1l for qemu-devel@archiver.kernel.org; Thu, 23 Sep 2021 15:57:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTUoR-0003pL-KB for qemu-devel@nongnu.org; Thu, 23 Sep 2021 15:55:19 -0400 Received: from mail-db8eur05on2123.outbound.protection.outlook.com ([40.107.20.123]:59503 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTUoN-0002vM-MR for qemu-devel@nongnu.org; Thu, 23 Sep 2021 15:55:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=epG/CbgQSUbD8FRIY4MOmKb6r5DA1X21P634urAYsT93xPQ0sHnBzckDyPqvxA2vhqVcCA+Sz2Mu3r6LUOCdB7Z+CQIB35j7jZ8Q5zKYUq2cs4hcRVJvrd+QHN+cDqtBuYtQahn/nmFjdx0d382YGW2FBDRyI/D6fdfxq+MQ6QN2xk8BIJWjA2jx6+KeMVK5hRs9z636JxrjdFk2n/ccORk9vm4+AyhZmnYUl72n23Fs02mYcPcXiN/7jWapgrolJSRm16gfH2SdkCSBWZ4LRYa1x4q7TectELq3CkY8MLOjViNIDZwIuuRGiPvwROXF0dm9h0ZWG9Aa4ivc6j41/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Zn4Rj6hJhXUTdMBpQN1TmWTZh+eTAAs8HnPBLKENpZ4=; b=VCRcdTPiuXCPxubCQ+jx3JmL4Nul2acYmbZYLWmQ9P+NVLw9Yl6gsZACeSAQbUWMbRauUwb4X7WpCLAGU0o2amPxcctLuKqQ4vD4ncuQouBtlZ8VIN3nzJNxTMKuxRDyAslS9WKLL1dquCwILcHQPZimSEyHZQqzzIyElGtsp0Fc/diUUbNcHa38veC5uE8Gl51I57KExzB2DyXuNxCTgaQez31WvqlvMc4jwwQXjnR8OLeJocBPYF9NCMCQ7EbyDPcoxScI3hDIfc/Is+OEPAhJ+UzoJE3h9CEPyoZd5fAwpWfVOcsxQ+KaLnY3OafSqJhZO9upHrcusjmYAKSC2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zn4Rj6hJhXUTdMBpQN1TmWTZh+eTAAs8HnPBLKENpZ4=; b=TsJ1b0ZEpW2lZsCuIrNG1x3pMFjVsxZy64iTfTcuvhYiSvEefYFOcd1g16cvWFli7/N+nHVuXmYMbYQAfdt2kYR87nxAZ/TSOUNQbHqCy6PZLLEtkTKA45cHzr1D+ExBkfoYPY/7OcMk1vz0WB94OVlH/U8k8n36ngqEkUaP+CM= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3224.eurprd08.prod.outlook.com (2603:10a6:209:47::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Thu, 23 Sep 2021 19:55:07 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22%9]) with mapi id 15.20.4544.015; Thu, 23 Sep 2021 19:55:07 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, pbonzini@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, den@openvz.org Subject: [PATCH 1/5] trace/control: introduce trace_opt_parse_opts() Date: Thu, 23 Sep 2021 22:54:47 +0300 Message-Id: <20210923195451.714796-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210923195451.714796-1-vsementsov@virtuozzo.com> References: <20210923195451.714796-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: HE1P18901CA0018.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::28) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 Received: from localhost.localdomain (185.215.60.205) by HE1P18901CA0018.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Thu, 23 Sep 2021 19:55:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a19c213e-53ef-427f-076e-08d97ecc0adf X-MS-TrafficTypeDiagnostic: AM6PR08MB3224: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LWZaC5ibspJFBbl3sBV/qVou9AK6KPuZg7rSm5uOjRQqasT5dEJPRgDMdS1gRhnRtCROI/7dgzMKLlmiWRzoDX5uSc/0NIO83vyOX5lMViMYyLMzc183HLrDMQXFOJ1e3TwPsYq5IL5oaaD7G2JgnpXud5xQo5O3RSdSptezCkeOdGDMC8fLjl9rWQXaoASuSv5KAVsMOAU2i6al0Aelj95D0hNEEsObW5qLuD7g5V/GyhiOnJkqmgu5nZ3he4go+xRHh3o3qMqoZV9dkLfrbrJ9VEOTCEcNWgCNJ4QK8lAhNfOBZOqkvVd2E973ylLfdSV1TXJa1nqkSwW6iUQgzT5EqkIA+ln3qrd6Cg/ES/2aXQZMYdhOh2Ao8pztfsxBasPpAA/71AVqpWixSC47x4SIIenSQvAyFPoDXVaQb5QvNzARWnVZcRyynPKcxUORdcf3+41B4Oamf70E25t4qaLI7OPBK5olgDJk91h9DjXqkA5JZNiga/EpizR8JC3P1LLdg0bFmiArka7C1Qui81zs+99D1oHLbnJw5TkQw2eYExhMzYh+/dDrSTsNcnVYkYBlUC72D9VzS7197sEHCmqSEC6l3cV2LKs8kTBObxt2jF0tUxnXKxelxIRw+yMe8SstK/r9IQPFmgkSXFyzFpy3Q1PM31XVbRkiSIrX/XEX6a3YdhPzKfGsMr+rNeOq9o83QbJMND4/QlDKshIY7g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(508600001)(6486002)(5660300002)(38350700002)(38100700002)(86362001)(52116002)(36756003)(6666004)(66476007)(186003)(66946007)(66556008)(316002)(8676002)(8936002)(107886003)(956004)(2616005)(26005)(83380400001)(1076003)(6512007)(2906002)(4326008)(6916009); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gmN6HnlQ1hdpje3h8Cxi7/1dnw6ZRGb5bARXTFkt6gbIIRGmahtChFIeo2n/JyQqzNZr0CY+PZOOTrg2M9Dh/kt2P5la8t9g6oc+W5EhjydlLdQHT1CaYBB2kXLqmqsOGyNUkbVggF0G0Kft2jaL81IulfQLxSO4Z/fVXxlqc5WgNIk+/vXPdbomJELVOgmisNEJlbZ54xPNFzUO7mJt1m5tHy00zTrJe9lOdMnNgJnpQiDOTL+fXVs/Wy/8p85ial5hjUbs0rgAHuXff51iLsZ2gA/A29zr+x0Q1tMiCU3EiT1kt7MV3c1EAmA8oGBJDi/b5kpjW0qvytJe2lJlfxg4NNyhTf1JrGCIJlmRX8YduK8QSsHC+MLPFYZb4DSod+iMGZS0QsPkdx2jB4c6gidrkhPEmgWKxMRkPFAxQHXHkD53DkhgbKQmKe0yZpcc2GUH1dchSMsTcqmS0PerkVdaW8yF9Cbnlg6Oy2SQizQokQ8Tex27ml3Xh0lnNmYWIs2PdNmEXnr2aR7fz/a2RNU+skw93WO5R6R/QJ/4cICpF3+2bDfJhnEK7tuAaoF4daUmL28mjykWtHslOAcqY+uHUrVnE0oi6d+Pz8XDViB0VxCxtpPdeFfDkoGw+dsYoOnpllBsAt4CCGQgmbr9bqVVGq3mgXFkDcO2VfOo3Juwf2gIJoLtU1qTWV7pRdZkuzquNwB58w+548wqJp1TLJ0ZvgFmYxH/SvbHCXFhoRxFqPLkz8A364ZRt0HDGTePC8QzDQM/9gwht4OMHWdK2a7JFe8fH0uiJeAD7tHNw66KVzBPAyUpq10oZwt7LqL81Rx6T8zH0nU+A9k1AB5Aiq+KO5dCL/1/PC9rDOn9dHes899/f7b6m8DcLwYrM0AT2aGW4sNsqohRNo5rtG4qtqZiWnmMTCJN8HQv+w933tdvk8W2ujnB+Q+L1y/D7U3yH1lssYizoFAldV8zxNeqvlwAhdCQMYLY3EUAkuTkCx5IU0usG5vaeHt7R2YebiI0XldqLbhbJaHrHcCNtIobw0rMkRtXISPFr0LDI5HHIVXyseKdarV6KFv9Qi8EyGzTUxWRcNewCtTLnfi+tkTh/OD4gZbijJg1/8cg9V1Z/dXaTQAVNewoQekml7QkRwx2es6gfI3YO7Ij29XTSiJvgrg2c7qyhPQHsoYZ2uwmISCFuCHJkWNDOcUBADmIYigQYJ/15r6aGPl3WVeJ/HkwyArpRdLVx/8eoQLJie5XzVBI3dGEXqcWIwwxYCx0ZVKOgpRnhcixe9Exc8h76lndM7JcXOTqW6KtkE9Upy8TkWJVksTnzLZfOsxtPajkEdhM X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a19c213e-53ef-427f-076e-08d97ecc0adf X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 19:55:07.4883 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: p5q6NZaclTCpEP3KgZVa+9zkoArhsmrPkOapPHBUrbCB2i/MpCkJMsnv8MRju9Ku7d/6ofuNjm7vNeBHL4+YZ8/FbYdOjDe75+qvffOi9N8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3224 Received-SPF: pass client-ip=40.107.20.123; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add a function same as trace_opt_parse, but parameter is QemuOpts. Signed-off-by: Vladimir Sementsov-Ogievskiy --- trace/control.h | 7 +++++++ trace/control.c | 18 ++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/trace/control.h b/trace/control.h index 23b8393b29..fb898e2c4a 100644 --- a/trace/control.h +++ b/trace/control.h @@ -251,6 +251,13 @@ extern QemuOptsList qemu_trace_opts; */ void trace_opt_parse(const char *optarg); +/** + * Same as trace_opt_parse, but accept QemuOpts instead of options string. + * + * Releases @opts at the end. + */ +void trace_opt_parse_opts(QemuOpts *opts); + /** * trace_get_vcpu_event_count: * diff --git a/trace/control.c b/trace/control.c index d5b68e846e..4bcbd96511 100644 --- a/trace/control.c +++ b/trace/control.c @@ -313,13 +313,8 @@ bool trace_init_backends(void) return true; } -void trace_opt_parse(const char *optarg) +void trace_opt_parse_opts(QemuOpts *opts) { - QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("trace"), - optarg, true); - if (!opts) { - exit(1); - } if (qemu_opt_get(opts, "enable")) { trace_enable_events(qemu_opt_get(opts, "enable")); } @@ -330,6 +325,17 @@ void trace_opt_parse(const char *optarg) qemu_opts_del(opts); } +void trace_opt_parse(const char *optarg) +{ + QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("trace"), + optarg, true); + if (!opts) { + exit(1); + } + + trace_opt_parse_opts(opts); +} + uint32_t trace_get_vcpu_event_count(void) { return next_vcpu_id; From patchwork Thu Sep 23 19:54:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12513633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEF63C433EF for ; Thu, 23 Sep 2021 20:00:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 416E760F6D for ; Thu, 23 Sep 2021 20:00:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 416E760F6D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:40472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTUt5-0001fK-AE for qemu-devel@archiver.kernel.org; Thu, 23 Sep 2021 16:00:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTUoU-0003sE-7D for qemu-devel@nongnu.org; Thu, 23 Sep 2021 15:55:23 -0400 Received: from mail-db8eur05on2123.outbound.protection.outlook.com ([40.107.20.123]:59503 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTUoR-0002vM-EA for qemu-devel@nongnu.org; Thu, 23 Sep 2021 15:55:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ng1Bnv/hhEsVg9tHOOP66279VVKT/iqna9eIbCY6UfZA03BGTNaKruhP0o/53Xyp9ZeoNGhLYHgQYahvZByIcFdOECFV9SsGEFlcNYy3V6c2mtLINpnpU54Lu64sc7AMJCfNMc9ao6tVKz8eMrEitEK/mxSPLiW/ms2SLrQ3/levG5/ltHKyAnJnD9YR2A4GH7n6sawM8G8scVm4O0wvV9L+adLX9k0Kz6OorXyFYLYbtDk1AuZI31eJ39smeBAqQk8LZS0UvovepQAOtRo2IKx2rP+pz/xfNl/ObU+IQWxnsbB6k0nU2+nWYFPwP92GXwY8tcTtr7+tjT983LCOKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=G422sMkG1S3zyHGEaBPi+SV34Vm2oY6ZcrDKHENH6rg=; b=X5x5B+Sg7ldSPCXHVp7u3cW5SzN9GfZApyvJ4AT6b+B9dJ+g9tyvMYchloRGYcKoTbhBm+YHJcObXml5xo8B5sdYSQsHyr0um055f9wfJIxFbZEEvbj9+BnUe0eeq0wH+T/pzVG3+xv6DKW8DyHLfNuhH1P/H7ZaN8tVQIalLq4uLoUJSSjnIL2CCC+KewnJSJzOQ0ScxEa6P2RF0+NnZdvOf6EGxtVzDXRNkRnZn0o9hFDRo/MqQi5XCyATjrct50TNsoooEZEzJlpg2VuKmoJX36gvDfPjwcMysHwp84iKQXlmCoKNQwDNTBmglR+itM5pN4dNf7ffoo3uGkr6fg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G422sMkG1S3zyHGEaBPi+SV34Vm2oY6ZcrDKHENH6rg=; b=l23ea55dgC0nuivtx9TMsnntnvFZNo1mEDkbtU6Emdr/WVjDSbKpqh0MK+ZD9MFHAkiCZZOHr2INyFLeCcanIrvNQOzwu3bzilbfOmNJrriS76ZlCMsIz1GZeuzB3DvcPQzEnCojBBhgPMHfVcyDgv9vY2EarNzZsu9vLUy+Fv8= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3224.eurprd08.prod.outlook.com (2603:10a6:209:47::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Thu, 23 Sep 2021 19:55:08 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22%9]) with mapi id 15.20.4544.015; Thu, 23 Sep 2021 19:55:08 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, pbonzini@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, den@openvz.org Subject: [PATCH 2/5] qapi/qmp: QmpCommand: add .tracing field and API Date: Thu, 23 Sep 2021 22:54:48 +0300 Message-Id: <20210923195451.714796-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210923195451.714796-1-vsementsov@virtuozzo.com> References: <20210923195451.714796-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: HE1P18901CA0018.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::28) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 Received: from localhost.localdomain (185.215.60.205) by HE1P18901CA0018.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Thu, 23 Sep 2021 19:55:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 65da6d78-746f-4c3b-a44a-08d97ecc0bad X-MS-TrafficTypeDiagnostic: AM6PR08MB3224: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7J5YHNxLzL7swy7iqYaz2I0AyH0tNf3DMOihaLjsydMV+KyWsTLQAhB+9RdsQPhU47jGIMM252shn50QzL2BF9pf5F9TbrLtFEUkZGRL0iat2eRJk25k+8g/n9RxTAsY1gButqNpxidmqvjsz7sEB8i2afgKqS2CEWea6prC9SKclR34vF/JTB4NAIWVP9EqDKANHVLLtIbjlbztsAcgOplFHk3vdryPDXN+ptmzfgmasa4Zv7td/MMTDm8ZRhjjOSph1EUt/O9JT0z9c4kIdhinFDtwoUXPjnvpKzghhFq/TYsCyx76GCqWU1nDn/mo4p+u7h2NlnShVQRGJuZjz3kvQwunieyKMRY+QRRItkrt5VwPl2lGAuGY673a+QCFXcecKyDxTsmrW8aOEKme4g4u33ZiaWgMD5WQg7RgSDP90E/N4GzXQgzBysQBtOMF1R+tpwHVR9OuSNxXsVe2aLcApQpvjjLNQEWHIgLEgCFS59cILIX0jEKerf0LUlWVtKYolpFIwqPVtc7R5EqdhbgynCML3xT2mS7wkIDNth3dEYjffSqrtNXY3dzwX1Z7W6FEjSu7ZiGSxeaUR0Op8iyxumgqcd6QNHWh1tvN7r5/OQLA/K14TkzcB9N5qaRAowgdFqxTzkZR3ZrFkPF+VztbfypJLb3JzbdUl5pkDb3y1448h0pI0Uywb1rwYWUJzP/p832oR1dZVoK2JNGLbT18yg817l/KyLQ6Ehwmvjo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(508600001)(6486002)(5660300002)(38350700002)(38100700002)(86362001)(52116002)(36756003)(6666004)(66476007)(186003)(66946007)(66556008)(316002)(8676002)(8936002)(107886003)(956004)(2616005)(26005)(1076003)(6512007)(2906002)(4326008)(6916009)(142923001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: smkWMEhs8EsvBcjmTVrVNXrDf5ahqNZHubHSGczr+O90fnE8MUYES+8PQC7EZgl4pp0PYWUv+TDHR4T9MAcXjomja5KlRpAyWZ9v3YO4AEoGMoWeJNK9uiTx0Ez3QmBe4ZNpsqt/TwhV5nitv+XD/tiQyBZHkSbad2gvrnkh+K21/7VMIVKVNZQwRhEnElXhdeaj2Zqi8b/EV66XHkkcayzhvm4G6ctpXDRQDSM2ByuQ/Lz7gCVIJrG0P4SkUdGAz6GVJHdMn9Yon08hcMhCU3D4PqLp0YSxykENf0EkKato27R3MHT8ZGL/8FSnJGykQVt3FJxys4/nvWQC/QkOLAphvKXFhyhcS1z0jetvnjnHfdN7bfIIYR3QxI/dNCwGlZzPb54CFqpkXw5Qq+wGHpTJR17+aaSDxXz0C778k4mFAYZZJ1lDBCV2HvjZIdYbeDOq1c02ea8gprHgHoisMecWzw7fJnrDA12oYoFqg1votCbVZuJ7ENTXwwSVPtJoF9yO0ocvW/AVuY9zBou4wZbSi+q+rxwIK/Owib5r3sgJfvobbUYWGrEbo8MVPvL7PS208bYVkkzwLwPGqfl97DnAAeRkGU/9rx+2ZtmVF3/rI85p1/4mZ5JsYQw9Rc/9SqKko/ZQ2kMVmJmZDmM6dIslLPktjEV3RJDBoOEWNSvw0SAw4aALIaAhPgg0q5m9sVCMA7BuXqe9HeugeTIM5guTgFBiwWfgsZTqKQ5VNXHzK0DYaEClzYpY5wfJTobWHRJf44BO6LahgbOjNEaFnLpq+J5hs1NmujfsNFabIc3Nt3yvWcpT6D2IiZh05iQTnpx3tpM4EfY0Mh39WeynR3uUgY5vr420CYRUbyIlmtWYDCEW/kJy2uokE8DuBl+9FSlM3wOxuzfoP/+gPGzhwy08E2f/ZHHC3kVK5lPS3Ld2ot79hTv4PxpUVm6/Y1oZcqc+GVA0GstbZq4nDTwn5cYkKbLeTMZ15ExAfVtqyXfeqQ27+lygG4pyw7vcxPV9kWi8hmBYaGBVCWn6IrV1Aan8I9SbtnH7rP9NELMo99hihbGLKFfNekOjMV8MAgd9l5NjJRBJD7On1jFCDYJlTnZMPjDP5sr2u0MGukoL+qVGT3glbUL/ahOlgFWx5wK0GD49d/1a/DwWfH8PoYmhcp1GRgG1J1wtozKyRVmUXqxW/Qf9ovYjXeVBK5iVIfgyyJxQGF9+vv36j/6+jMPIlHAVt26MvKqf9uWfbLET9DwSnSeW9kX9JnyAJU+wJnwcqArpb6HTZoVqil1BAyVWvAyO1SVPNR9vySzSkKIzYE550YvOb/ONVWpwCFOwzD/s X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65da6d78-746f-4c3b-a44a-08d97ecc0bad X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 19:55:08.5556 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: y1uujMP1FYrLsFrK0R1d4RLexFnAN8CuHF/KPD+4pt58hB1wxB1WyqrElGCW6NQKFe5yS/ua8K6ZygjA4Q9kxnF/RJ1O19rVd5zk/0Su6Ps= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3224 Received-SPF: pass client-ip=40.107.20.123; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We are going to add a possibility to trace some qmp commands by user selection. For now add a new field to QmpCommand structure and two functions to manipulate with it. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/qapi/qmp/dispatch.h | 14 ++++++++++++++ qapi/qmp-registry.c | 27 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 075203dc67..5d0df2f984 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -38,6 +38,7 @@ typedef struct QmpCommand QTAILQ_ENTRY(QmpCommand) node; bool enabled; const char *disable_reason; + bool tracing; } QmpCommand; typedef QTAILQ_HEAD(QmpCommandList, QmpCommand) QmpCommandList; @@ -64,4 +65,17 @@ typedef void (*qmp_cmd_callback_fn)(const QmpCommand *cmd, void *opaque); void qmp_for_each_command(const QmpCommandList *cmds, qmp_cmd_callback_fn fn, void *opaque); +/* + * Enable or disable tracing for commands matching the pattern. + * Pattern matching is handled by g_pattern_match_simple(). + */ +void qmp_commands_set_tracing(QmpCommandList *cmds, const char *pattern, + bool enable); + +/* + * Return true if tracing is enabled for any command matching the pattern. + * If pattern is NULL, return true if tracing is enabled for any command. + */ +bool qmp_commands_is_tracing_enabled(QmpCommandList *cmds, const char *pattern); + #endif diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index f78c064aae..56e761857b 100644 --- a/qapi/qmp-registry.c +++ b/qapi/qmp-registry.c @@ -67,6 +67,33 @@ void qmp_enable_command(QmpCommandList *cmds, const char *name) qmp_toggle_command(cmds, name, true, NULL); } +void qmp_commands_set_tracing(QmpCommandList *cmds, const char *pattern, + bool enable) +{ + QmpCommand *cmd; + + QTAILQ_FOREACH(cmd, cmds, node) { + if (g_pattern_match_simple(pattern, cmd->name)) { + cmd->tracing = true; + } + } +} + +bool qmp_commands_is_tracing_enabled(QmpCommandList *cmds, const char *pattern) +{ + QmpCommand *cmd; + + QTAILQ_FOREACH(cmd, cmds, node) { + if (cmd->tracing && + (!pattern || g_pattern_match_simple(pattern, cmd->name))) + { + return true; + } + } + + return false; +} + bool qmp_command_is_enabled(const QmpCommand *cmd) { return cmd->enabled; From patchwork Thu Sep 23 19:54:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12513629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40F63C433EF for ; Thu, 23 Sep 2021 19:57:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BC96860F6D for ; Thu, 23 Sep 2021 19:57:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BC96860F6D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:34458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTUqq-00064t-0z for qemu-devel@archiver.kernel.org; Thu, 23 Sep 2021 15:57:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTUoX-0003tG-8f for qemu-devel@nongnu.org; Thu, 23 Sep 2021 15:55:27 -0400 Received: from mail-db8eur05on2123.outbound.protection.outlook.com ([40.107.20.123]:59503 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTUoV-0002vM-JZ for qemu-devel@nongnu.org; Thu, 23 Sep 2021 15:55:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XHlwvOnkFsXuTQlSh79CFqadC1VwK/wcfOJt6M+l+giptMkKsKzDbcD0p7XVOav5CfhJUI3CrBC7U2pCgn45ynYhjDaQI18cpFVc+x5SP8XmLys6pa3gLCCom5nuFXyVzHgFX+j/5UHnVp1DZkBuNzc+3BDbQnN0cFxSQA/7nW5s5jygPwyfOVD/a68O+1+yqhTrvQbCpCQUKjsmdvwOpxRZZY9aTF88sd2lq/ja6yaU10luwVSokFHXzPrda2HjGC2c7/w0ZqvE5c/rscCne0OUgnzD85GaQaQkPGZiuSJnRiywbm54pTZ1DUyxpp/baWx7Zaakx4znL4S5HnIOEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=KIjDM+6BaYrqq/MK8+l4meIycBWd/NGx7tzi8zOGQA0=; b=PlPVq+TvA1TnuRlofBH+vxk0wq4OpZAk1Cf5kkTwfG69DY7mV33/MbQeQXL93hcKI5d49HoFGPbcD1LD+VvRJGzAlC6YelzO2rE/IKvAzf6kZNzcqxdxI2UNtrF1PcRhMet6evyc2vp93OWmTnO3pwfuc10d+oLulIChap+azU+tnxR36MLVp8QIyrIUBl4EUe35jHueoCjI/4drVDEJqTySnBI5R0/ubQ8w+nTxsyB8wBOBH/0azI38YUzYmQZGzkSUQWfuQ8P4A4zJvqYpjZ7OnaqqTz1bFcXE3Wwb+GQOAFWkRAy+9Hq5DIih830b4Z29Gb0gHhwwxMVnpwXR8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KIjDM+6BaYrqq/MK8+l4meIycBWd/NGx7tzi8zOGQA0=; b=Dv+HysEfyjXEC26Y100ODH7kGVHhsiWuFNrHtzdpI+VqwTtI1J40sPNj6MYooG4iQdA9zmiyzY1D5Pm5rX0blzI2++byp1NvbqApIjQLlq87K6hWUd8ZzfsiRDn6oVYjL29Hwi2cm3RLfj7eggDGDcJxDkWxGE7AkdNCJB/qerc= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3224.eurprd08.prod.outlook.com (2603:10a6:209:47::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Thu, 23 Sep 2021 19:55:09 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22%9]) with mapi id 15.20.4544.015; Thu, 23 Sep 2021 19:55:09 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, pbonzini@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, den@openvz.org Subject: [PATCH 3/5] monitor: add qmp tracing API for qmp_commands Date: Thu, 23 Sep 2021 22:54:49 +0300 Message-Id: <20210923195451.714796-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210923195451.714796-1-vsementsov@virtuozzo.com> References: <20210923195451.714796-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: HE1P18901CA0018.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::28) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 Received: from localhost.localdomain (185.215.60.205) by HE1P18901CA0018.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Thu, 23 Sep 2021 19:55:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ea0407f-5fdf-48a1-01c6-08d97ecc0c4d X-MS-TrafficTypeDiagnostic: AM6PR08MB3224: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1107; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BbZnbrmYBZnqmTVkyCT5coKIkqL7+ZlCUbZeuJsFpuq5Sgw9r/hLGOhbsjqqG0tkHH12x3oZjMkMTGCHhVUmdU8DtMmd1FOdSTabR0a1+hLdlBiqWHkMQLUHfaNvS8zpPzJe9pSoaKEVjVT9Ug2IvfpQuhXvZn3i3XZkm2fZNIRgs4p7PHGM42F5AfzJY0z4l1EGAOLZ3mSNrimAwwEYyo3i4DLrkAX+4xlc09nkiMo/sQREA+4s18qQj5uG9FcRUHXj+qn4Hexj1Kb66ucV4Z+wV5LC1Qw4rpn5eKLFJmlcHfVwE7aHIYPwPU4FCmSq56J+/ZGkVGdoqwXR6smPVXoCspSdWaz4k6/mMtukYH2YfEfDOdzmglZQLRE64ePvkFCMg/o0y8aOLu3jozdFsnIcsn7yB6GmlRrKFIFTLK6Vjy+DLWUveJX0o6W0/UuOjb48m54M4MhL6XqfTqUVvoxjNvYIgq3i3SHlZaH628gNrQfuYzhAsKwNtXf2ZeNT0ZTv0i3SA/W5cPg39XeFt37puDcRlsLIgsVDXcVigCWxkFZtZzi2/goWowdHhNQgdabTph5jwxNXcoxpypTyzN0oSDUoyP1v0eB5NYf33RZAEm7ynPFBVQUK+CLoohFHHgqDNauu9UvjqHR/oL2De65IFsQTt38P6U4buWXlm3vooEan7ERhnbte4qgacTjjbdNGzLw0YO+KNbS5J/kEhA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(508600001)(6486002)(5660300002)(38350700002)(38100700002)(86362001)(52116002)(36756003)(6666004)(66476007)(186003)(66946007)(66556008)(316002)(8676002)(8936002)(107886003)(956004)(2616005)(26005)(1076003)(6512007)(2906002)(4326008)(6916009); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QNVhYlOtgsLTZAJ9kuGf65EIV7xMMKxyyGhLwKQartyruxRhQESgVh6rSGTtmfCQw/VjNIP+9GncTUvbRKJ8BwlRwx4phXxzx+u/Qacs8eOJI05ytcJewTxZ4fxFop90YVX6SahTr0xWUGW0XEiNcfEqHxRBiLk2geu0p0qj9ANj7MV7a3tuOp9YNtmJAFyGpUv1tNVVwziUzwx6l4tj03fNTlqE01psOS3OrW4ryu6XKN/DBNtaQOzbC4joIX+ENfTLUXnQ/yEDEikpZ9omNLeoJfParfHfj2unBGH4lJYIOud7jtjZgglyBOGPt9UWe2CIaidkfIWgdt0B+bQyGMoL8N4zeFevo3NpHnkpGlz9NocAEeVhQBYKX8++xEF6g8qujcxc+hy0uXx0Idq/TzB3k3CBi1bAzRttNyvJS78nYvOP07gdcKmuBqzQz40blOVU6iGDhotDQ/9BFsTZpEluo0ehaebmXrePsE8JKJxLgVfHqPxYthgLEG65agCDYPdLNN10FOHXnG1iF5ZGTyG4s+Sv3wX/vGBaAfLAy6l4yHvhNt5vsEVrBx6I1dJRKW3f6owznB51ikw4YvHb7R0Q3ivK1nQmSEQvXtxWh4JYvnB6jjiMu9yBIVyq+ogqsEJ3/ZyvUHrwUbHrI+HYL2ag0AZpASu7zttqOsl65qtz2PwnLG035pLRmgw2NZeH9tPxfvrMYk5YUjzdZZHQ3mzobaQWXKVbM+Z538NuqTQkReGQBYZuSQZ0sz5OsEY6fEapgBXRYqk4zlyAxQbjPhZs03uPY3YgT0V38T4c4797Hh6F5U54MZqTXqU/sj5tRse6bjNAx1gMTvIzVd6hrbGTEnMbqHutn5apa2OvIS47FO6LU0SKmnAyfb5CTjiT2s65/q/RM5Mt/F6S+/OCNQeBW/ioMQsc9SXjoNu4/h0CYe/LeVtKJ6rRftPC+tZml9iUDh5jHdtxYfcq3ds5VZVajkGtF9CslO9vCoxQWATxBOPV3kMvET83rX+CBk19IRTpL6Hb6iyDogS8o+EAospQt3mW0AkLCJPhs9GDNyO/EzZk6cabk5OdpJT6JVTOIxoTpYVOAZZPTJJSZgVp4S+LzW5N0rkaHZDOnAJbkqAtY9OO5fq8CsIVZwOPLhfLkMOg/jvvZpjeRdzEK97FBz/O0RQQ3yoCfQ2IlzkZLVpjciK9vDrPjzNWo2ZqAgd6L8rJwg9ESlP6d6NUDUj+zZPBqAsVQ9Grnu7vH6US+69wT4KqeRlJAf/1eUtZPU2DRGm4+M0zfYAXpngo5ga4i6+UJE+Y6Q6pp+zknIkyXZrmz0Gdckd4Yfe5Sn7vOHem X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ea0407f-5fdf-48a1-01c6-08d97ecc0c4d X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 19:55:09.5880 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VsSI2OXP+2sYzd6H91s58PzdbJFVG+vIHA1YAGZcuwRRs9Mqi5bWaXIDeXgMfheCMnAy4NQBEXyj9tUk7zCih3EPxcGIWIHSnOzXb8Wbuyc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3224 Received-SPF: pass client-ip=40.107.20.123; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add wrappers to manipulate with .tracing in qmp_commands list. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/monitor/monitor.h | 3 +++ monitor/qmp.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 1a8a369b50..9587998217 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -54,4 +54,7 @@ int64_t monitor_fdset_dup_fd_find(int dup_fd); void monitor_register_hmp(const char *name, bool info, void (*cmd)(Monitor *mon, const QDict *qdict)); +bool monitor_qmp_is_tracing_enabled(const char *pattern); +void monitor_qmp_set_tracing(const char *pattern, bool enable); + #endif /* MONITOR_H */ diff --git a/monitor/qmp.c b/monitor/qmp.c index 092c527b6f..def2c7d1da 100644 --- a/monitor/qmp.c +++ b/monitor/qmp.c @@ -536,3 +536,13 @@ void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp) monitor_list_append(&mon->common); } } + +void monitor_qmp_set_tracing(const char *pattern, bool enable) +{ + qmp_commands_set_tracing(&qmp_commands, pattern, enable); +} + +bool monitor_qmp_is_tracing_enabled(const char *pattern) +{ + return qmp_commands_is_tracing_enabled(&qmp_commands, pattern); +} From patchwork Thu Sep 23 19:54:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12513637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29690C433EF for ; Thu, 23 Sep 2021 20:03:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 75D9C61029 for ; Thu, 23 Sep 2021 20:03:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 75D9C61029 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:43912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTUwE-00046g-FF for qemu-devel@archiver.kernel.org; Thu, 23 Sep 2021 16:03:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTUoc-0003vd-FT for qemu-devel@nongnu.org; Thu, 23 Sep 2021 15:55:31 -0400 Received: from mail-db8eur05on2123.outbound.protection.outlook.com ([40.107.20.123]:59503 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTUoa-0002vM-Vd for qemu-devel@nongnu.org; Thu, 23 Sep 2021 15:55:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ImT1NrFa3CEzZGiRvm9vl+7zrO7OM4AxH31shvg1OzPfi6smLtcLXnYRqGBh2uFR4mdrGE8mlucNbK/3doiBXIKA91cbMpImZSRK1HYvGWGw5hDBZE+T21Ei9G467Bst5txBxJlNhFUeuVdwVD0WGjQaYimL3fKNeeCc2kKzPgVas5FgE9ACl2F9bGAQbHiC8Ikx0rgfBPVBgLEXZIGuDNa7KnXuQcasQMEvr//26IF6G4LBq6nFCpcsBWweDXH/Zh5rRVid6JcmZmAOcqH96X77CW1uXzPzam9j6WmWzgxDtMtijDK7dZMEUkiSIGG9xhcuiRQ05/pPkYbbtzDJIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UptxbLLQFZX4H8r4gf4KL+mSelEaRTjOoGu8qB5pQkE=; b=ODN2rrzx5IhZ6JRB8ZukUy/W5/cEIbSkYnWhZuCEmcX7oCLn53C5rnAKQhD2s/yjIFpOApDnmIlJaIauPll0n+zSWrJ05wKXUIeK6EFihU8i5/MPBSKo7I4Il07yZs/A5nm+r5okkUyaKCKbj4G4Gm+o9PaNO66LXaKdYudaytDgpTWVGAwpz1OyOpj1TP/CI/R9frHIMzab9ox3X9DOH+CkfDVgOmKhnTfF55zOooTL6aaerR9b6Alaler4nxCVbAm6uxSpcbtuMSp/TBJX3Z19C2AIAF8cHHtjX8lQjnGhhoWVnGdgkvuDWeYmYoZMY6rMAjb+4mOcBBObsZgx3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UptxbLLQFZX4H8r4gf4KL+mSelEaRTjOoGu8qB5pQkE=; b=aihX4qUaJA2JMF6HJ9QzvHlHdWEBmmfDJ0I5bjbCE7ZydB+YqBwAphlZRR5C3gVy89GGxcz3W6eM+AIs74gTV+RmH3Ojxuimmk/AEu7XY266Rkg3XFSO1FGXAT2dtJ0gT4RpKsf2QC04aKu7UgghebJqhvllUTqk6Af4irNJhBI= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3224.eurprd08.prod.outlook.com (2603:10a6:209:47::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Thu, 23 Sep 2021 19:55:10 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22%9]) with mapi id 15.20.4544.015; Thu, 23 Sep 2021 19:55:10 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, pbonzini@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, den@openvz.org Subject: [PATCH 4/5] util/qemu-option: make qemu_opt_del_all() function public Date: Thu, 23 Sep 2021 22:54:50 +0300 Message-Id: <20210923195451.714796-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210923195451.714796-1-vsementsov@virtuozzo.com> References: <20210923195451.714796-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: HE1P18901CA0018.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::28) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 Received: from localhost.localdomain (185.215.60.205) by HE1P18901CA0018.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Thu, 23 Sep 2021 19:55:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d18a7ff-29c9-4381-2b90-08d97ecc0cf0 X-MS-TrafficTypeDiagnostic: AM6PR08MB3224: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:397; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DFDrHbxRj+Omey4tf1qBWyU7f8cyHKzGr07CrTWYFF7gSkMfuxPZeyOnhKoE49jHGZBAkpmVUlxPQ0+kCh0DXBOgVm9ilPjGyQjuvmUqveTwNPCfT6LikP80yQNRgJVTYr26SJaT/CZbHtxK8jeccm8OahclY4JpQdPDMWKJmbt4itilXlQfwcEeRFKWGrsbjQC57mCq4aWIpNHm349F8Auv15DgBYJW+deilyKmDQ3z6fo8yqplWRyxxZdbMCorlkfh2VrBJi+wSFNZldFl/bMgUMN8uwSXVRJDTsm5oQiXVpKxILynQ4cQj/Ep8rwisvp0OI7iDhXl2/vYx67egj0iGJ7Fa4fAon749LBEwGouITgduUntuJNYZ39m4tLDw2TSuYTOnh6CphuTrHIGOqEIomWzxSnlXWalizHl/WmOc/IRO18d6nsMcNieGxP4sFCAEBUqexfTj/rN/knOw/eTeCmqZPfhC+8Q+RsYLTkbWBXwlILidx0jVryiG517ghKSuj0FirTJYrUQYizVUi6UqiLZ0clhuQnFsCF2Pj+bVkib4Fw/3gQzQgePChGLQO3VAplWYNWVwINNml9Gq2xm2w3JmhQCL63hGwES9fnx2T/vAkIg0DK4mR5lm9vsuDSzzTvwE2LxojOoUqQY6+0sqnAB013ICuDX5fw99k46K0mPUkOCCgX92LaVo6giOA2wCULpDo3Sti/dEJkdJA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(508600001)(6486002)(5660300002)(38350700002)(38100700002)(86362001)(52116002)(36756003)(6666004)(66476007)(186003)(66946007)(66556008)(316002)(8676002)(8936002)(107886003)(956004)(2616005)(26005)(83380400001)(1076003)(6512007)(2906002)(4326008)(6916009); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eCFSRNJGsIApabxQeiw7s8WqgIAavInzRP91FveEnxra8epuHxBIelJFlhoo/GkQRsmJA+sqVhHf0UWePHZhGfeLuOkJ3oW/DOcW6sWLpL/zrdtI0wCX0hsRMqZZedgX4j8/RbPKHBXg+YX5LtQ+ukOoHED4GrR8Jz1CKca6qA2m1RCevC0Y4KWVg9Maol7AaHaNPsYNmD9hoj5oBL59lUKRYgcIosz0St78Q1KfJNSka8BU+sew9D4NwKXwbOUVV+n0QRnAyZxnhRXvg3mG27OMlSpnQTdCttrq6ySdu5r26YT9pTTMeh7k41FNjVm9O0FqcHNSumdUTTh+fwl061QzhWrxy8z9eRt1pVD63+As8r2i6Ne7OWP2b4Er3ocGujdDp48SxUSHXr6z8VO19P7CCUfgBIT1RscePfScZo48se+4OOAMxJlBeq3BxJ4AdTlD4hON3Sb1EtTz8uTyuGrotw7kDTnbl3fHAj/Fg+oP6Shg5MDqCdgvNuJ541o8vUvJcDDO9NOMHzUmcnTgbZzPu5ZiUJXio6ASEwKhxe3/DqkWatMAPMQ/lqWBMqf+tCkqFlXwgLTIrQ202i/lLFfFSNGolcl7PZy5fkubpLpYMtfE4JHdDxr9Uwao/0w/GNadpg8aGPoh/7P3BwjejrXEiZRkbXemflcgyY3q8uBK54uuoteUwBf3kIHA5sRun6/DRMb5lqSzFTakMDqbj+qpHrCi1AskogFsP6I8APS/ZexY/yeSjQ0Q66pUpWYw5wrSdL+0YnLL53kNCemxju29+Ad4nuBuVAPvSJEGcnz+0AN+et8tng8Mdi4/PgJ1xqIb4VdH/Qzw94p1DeOXCJRlyARKqxKq75vsdBYcMlGJY5NS4NuAAWZerd61PiOzqH8t2D+wPI7srS8htjoe/HQOOh3geqr1w1kqsovG9Y4buBZrjHpOrhFV/AYWtswneKVllQaO0G7InEPv52gsk1Gdl8KiBqpAcAhzQhaHfd7idGUo+e90k8UGDALVxSl1rGuyahpiR2+IKKWNud9j1agCZckNiuVqv1OqQgl0EzSiTRcxQNXKS5E61eoxtL5WxmPrd7nYBMTUVA/7xkUTM2/5EMDa0Pf58/XXKUMIg6PmiwnMGqA4WnqnjvqfIs07SWLkud/x1VfaCfaxUyq4CU39Cavd7vqanu4s/lKnpBMPnnbUIc25PhUPSGhy6bvYPgNpLZ76IgC8BIV6NLNzFkme1w2SsTuGTsr5GRUbizHdS+kI+Bxhf6FKa2WIAvkw3b3COrnXeGEcukkL29IQ9jYVKw5nHGNxHCFJ6oW3XOmHrG83i/6Lcfi6RCayFHq1 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d18a7ff-29c9-4381-2b90-08d97ecc0cf0 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 19:55:10.6713 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sk3lM7eKawZGlir22S9JQKeaeog/RiJDs+apvdYgY0S8/syKE0hNOD577JAG72RRYf4X+5MP2PNjpQO4Yv8srqInCgTCiuMDfCnALMB/mRg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3224 Received-SPF: pass client-ip=40.107.20.123; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" To be used in the following commit. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/qemu/option.h | 1 + util/qemu-option.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/qemu/option.h b/include/qemu/option.h index 306bf07575..4ba88f2632 100644 --- a/include/qemu/option.h +++ b/include/qemu/option.h @@ -71,6 +71,7 @@ struct QemuOptsList { const char *qemu_opt_get(QemuOpts *opts, const char *name); char *qemu_opt_get_del(QemuOpts *opts, const char *name); +void qemu_opt_del_all(QemuOpts *opts, const char *name); /** * qemu_opt_has_help_opt: * @opts: options to search for a help request diff --git a/util/qemu-option.c b/util/qemu-option.c index 61cb4a97bd..2c75cc2e46 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -244,7 +244,7 @@ static void qemu_opt_del(QemuOpt *opt) /* qemu_opt_set allows many settings for the same option. * This function deletes all settings for an option. */ -static void qemu_opt_del_all(QemuOpts *opts, const char *name) +void qemu_opt_del_all(QemuOpts *opts, const char *name) { QemuOpt *opt, *next_opt; From patchwork Thu Sep 23 19:54:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12513635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80F99C433EF for ; Thu, 23 Sep 2021 20:00:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2499260F6D for ; Thu, 23 Sep 2021 20:00:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2499260F6D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:40718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTUtS-0001p8-Cd for qemu-devel@archiver.kernel.org; Thu, 23 Sep 2021 16:00:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTUoe-0003vp-Kr for qemu-devel@nongnu.org; Thu, 23 Sep 2021 15:55:33 -0400 Received: from mail-db8eur05on2123.outbound.protection.outlook.com ([40.107.20.123]:59503 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTUoc-0002vM-Qu for qemu-devel@nongnu.org; Thu, 23 Sep 2021 15:55:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fMTQ6vqowlxoYooeEU0+aE38PHer4xuLhH+RGR/OYv7ipyGidSf98YVmOBinOiRU4nwHq5aTcKmOoupStQ7WUezrFxLfu++3J3B3LKQQEjQ4OPPHs76cy9ayPNL/zwF7VcCuCQ2K/Cu39PdQmlXvfNsGk5GNlZR2WsjF1x1JctMMTuUpUwFR1nMw5mbJWPlW7aOmHX6rUbkA3Yd3Z9athp0c9FODcWA+AQLRUnLOXoi3hjx7OOAQ7LgIqz053M3sd8thmyX0jae9TrwzKK5HidVo0Uu0GCv1+jo3DsEhVMaJ3l3MXn3/fJE/A/2zyfi+elbnrGB/36+NCofHxttI0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=n5xHLu+cS5BgP1nfi59gq5iLHT6CRaFYZdUlZjcyW4I=; b=Z5kyWKGSX118aqtHaREmMH0nj1bua743fCklA94jUpOiZyCSPsRiQaNq5snR1BCAJ6efSPpyAUsd01l3FZ529ECF0opfhkpPPdLV1pisW+Ct8oC14a+Wy4VNSvJYQddEw2WRDlAfPD7urYn3wu0j5WAv9M3xsKA9FFp5LIqT1jTmzbgWPlWMFek+QLWomw6u62mhVdeqQGoVAXYp9xIsMnNgX4Cb39GPx7rwg2j8AWOKIK0kANlXVsuYZeeFf6QdO+PbgeJ5tX9DspJJpmuoore+lyhATr0BDREyYGMIZSB4U8LEG8jJITsjHKGVXXMOAlvCDldc2Z2wg7Bk8Ex9tQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n5xHLu+cS5BgP1nfi59gq5iLHT6CRaFYZdUlZjcyW4I=; b=va6XH52DkRifXjxvPgnxhXhaIu5lH84N8txVQFNuW9kH7AIXrYiel8aYrDp9WlxJqs4aqAaSV+3TTltHKiu+4jjOxW4hwyXEny6ikkKZ+gDGGaOq1+/kOi3La9HLAZCEyJB9XV3bZ6tZh/EDJaxzBT7jlPfXZ0JV3dJw1EUreU4= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3224.eurprd08.prod.outlook.com (2603:10a6:209:47::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Thu, 23 Sep 2021 19:55:11 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::2817:53b3:f8b4:fe22%9]) with mapi id 15.20.4544.015; Thu, 23 Sep 2021 19:55:11 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, pbonzini@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, den@openvz.org Subject: [PATCH 5/5] trace: add qmp trace event namespace Date: Thu, 23 Sep 2021 22:54:51 +0300 Message-Id: <20210923195451.714796-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210923195451.714796-1-vsementsov@virtuozzo.com> References: <20210923195451.714796-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: HE1P18901CA0018.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::28) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 Received: from localhost.localdomain (185.215.60.205) by HE1P18901CA0018.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Thu, 23 Sep 2021 19:55:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0ede4b29-5e63-4cc3-c034-08d97ecc0d90 X-MS-TrafficTypeDiagnostic: AM6PR08MB3224: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SZVQrVXvD5MgJXfz01688y7GLuw9LXHsWh1l5eZ7Vug7ffdrBWtkO+wRSfE7p9L5HS6DKUZuM55YbzTFPetC2TNTQHCgtDBGZGRzwruH5pg8DrWk7AEYjjiC7jcn/Bl9lC3VG55A4pqiAHV08YGlF+RaWbCBp6Q1pqtiLpxN+SOyqe41zDSRRErxDrWYbwW6x1UXd9cYbRCAK7vC7ynpJAgEVE/c8ZRdW8yfoygJuSJoaTZRFrBsRHmdeFUu3bPYMsozK1U4d7CnL9pXODsEw5z+wHSbDJ/Z1EMz4ajuGTQodnUkP6XCVfjnPjgrpGepkMuboCrTgZAoEIVMmnVWyIAz6buvgsma3XiUmZt6pZrxXVbLVvCfE7mduuqN4K4QLNNL+HNJX1Na4VNwNn6w2QUmv7OOhaooRr/0jmyMLClxtuy86b0Vj6z81tZ8829VT5yl2IL/HtR8pqwf8sZVrSmreTeIyj7TOGBKu1MmQjgI3sqnUCqB6Xj5n2j3a1nRk0zwF8gx2WG5lqzC9LzPxQAmlea6m6nyn6rad76DwpixuSCpFqv41a3R0nJsEl2Awt2OEwOI+f53G9aP6OV2IGHV/t0eJXvlLA3aOrWXFad4WzzxTjMdh5QyMwZSusSVE7C/9AQNv0Eu7ajgm3aQVqluGdOkD82b8tC1NUh3XMonECiP1E+1iAfUcQMu4EVaZ1r/vOJcgjSiGjFLOLJefw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(508600001)(6486002)(5660300002)(38350700002)(38100700002)(86362001)(52116002)(36756003)(6666004)(66476007)(186003)(66946007)(66556008)(316002)(8676002)(8936002)(107886003)(956004)(2616005)(26005)(83380400001)(1076003)(6512007)(2906002)(4326008)(6916009); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZuV51D3If6TUIa3xFdsoetekmAXuO24IVKQtsLDZkppz8MTGSH3SGVf/JSDOb0MPFK2x/06rImtQhWVbV4h9vL0jRGyuO4/iv8pCe5WBvT1v8GYAKZeAtf1J0cXZ5WuBaRmL94fC+MdadgIcIx8EiQWXYyivVrZi44niTBiOviPBSeJ+35+H7L/aUENui4rbfzHhXwEVHM2Mf1PRHILd3l1y9P4g5xhlUFGnPpiElbM698NKZc8kMOgQtz/W7KMyHzGfMgFCo7BJVo57wHEWuvmFM6Ez1HGjjlj7ddSJnowIbj+7Z+dONArm2PqxnCQzmhIuGUI347SlgTMDL99oUorAy7VBIpy0m+WCSsFE2OU90kPi5Xxl+h0/FF9Yt4ghOUH4b5iQHFBrAU3vWA0FNjfG5BpC9gIAuHBWzZfvzgibmJQK1k/nsyMYuEL+9fnA8r4sCeNQ/sDN5DmewGxXKMxCcBtE1dYUQ3VPcYvLeanJSptU/0ltC34zLMMNB1hbWR30plY+tAwi4hnzExD/rBEdrRaRAk+c2mJb5l5HYSDoatxrHbHe7NxbT1ub4i8QoMVmsyRfqbvbmIDc/8LgFOaJwc4KkBRQeOlBfE1/WUP8Z9BDVUq0j4WS+n9YEK5qWsxIfmTdM2QG53+GN8x/0Stc7XBwgsXjQHhicfvL8aaarJOD3KTOEszNzEQxkE51xJjP7j8AAbf8w1ALn95N1zqso+FWueOQHQgr3Jyv97chadosb0EyPhdZGuAzsglQ2WJ8hp4GobIfWQA+7xH1QCXOLHPLRJnYTNcKneAlZt+jZgvhxAjJn5XwrU36bVghBPiLxgIqj7xNbnoKJITOPQj2Uc1q19Y0G1V/g54lmtnF2C6twsfIuRnrbzTbYSQy/JG1vvXb528MCDbU80uPRALrb8quvh1FdXopZTwl3o8etOGrZYpOl1Hn5vEPIJeiecIiV70NJygqHMe7FwNCwPLthJHSAfqC4W+QI2b+N9R3MgGVW4crOnMbBmVZGJhRLA5Bsh5JJSbthTdNjO4YxiyqybqdB9+7+cuvK6n4k5DLTX3qsP3iRzirW+4OW0+AuHFXH/d5aw5ZWRtOSgTHv+JhHCLxnLJWB3OOapCUv4Fj8vdrZc5i9AXbMg/+tp/TiqdRq+cu0/WAaV9egLDkp3ojY6E5s69CKPkWV5UKdAFY/IPN9xjEsOQ06Z4GjsZYia1IarFWqX3Cnf/ztqVdaZ+K49vclB+Zk5xK9OQKWD/LfXXDn0hUF8Nc1iSWXZwgl78wQFbDFAKDhJ2NIvnf/0FzETr6g9VYc01J0SEcoW6M9NJP5qnye98/J2b4qTdq X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ede4b29-5e63-4cc3-c034-08d97ecc0d90 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 19:55:11.7555 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PCb1P/1lOqWcvm3R0RdvtvCX1MnC2lcBMTtsnUxeL3y3n1CFixZsAbPvPCz0xm7FIdIRGYXa1qEKmCsm+88er7q88yTKtLdjvkQocG3+Ar0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3224 Received-SPF: pass client-ip=40.107.20.123; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add a possibility to trace some qmp commands by user selection. User API is simple: it looks like after this patch we have trace-points for all qmp commands, in format "qmp:". So user may do --trace qmp:drive-backup or run qmp command trace-event-set-state with arguments name="qmp:drive-backup", enable=true Patterns are supported in the same way as for general trace events, for example: --trace "qmp:query-*" to cover query-block, query-block-jobs, and a lot of other query- commands or --trace "qmp:job-*" --trace "qmp:block-job-*" to cover job manipulation commands. Trace event qmp covers both qmp command call and its respond. Implementation details: In qmp_dispatch() we add two trace points, similar to trace_handle_qmp_command. We also check for cmd->tracking field being set, and for handle-qmp-command/monitor-qmp-respond trace points being disabled, to not print same information twice. For qmp trace-event-{get,set}-state and for command line parse additionally new "qmp:" namespace Signed-off-by: Vladimir Sementsov-Ogievskiy --- qapi/qmp-dispatch.c | 20 ++++++++++++++++++++ softmmu/vl.c | 21 ++++++++++++++++++++- trace/qmp.c | 20 ++++++++++++++++++++ qapi/trace-events | 2 ++ 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 59600210ce..40fd008fa8 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -26,6 +26,9 @@ #include "qemu/coroutine.h" #include "qemu/main-loop.h" +#include "trace.h" +#include "trace/trace-monitor.h" + CompatPolicy compat_policy; Visitor *qobject_input_visitor_new_qmp(QObject *obj) @@ -133,6 +136,12 @@ static void do_qmp_dispatch_bh(void *opaque) aio_co_wake(data->co); } +static void do_trace_qmp(const char *what, QObject *obj) +{ + g_autoptr(GString) req_json = qobject_to_json(obj); + trace_qmp(what, req_json->str); +} + /* * Runs outside of coroutine context for OOB commands, but in coroutine * context for everything else. @@ -176,6 +185,11 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request, "The command %s has not been found", command); goto out; } + if (!trace_event_get_state_backends(TRACE_HANDLE_QMP_COMMAND) && + trace_event_get_state_backends(TRACE_QMP) && cmd->tracing) + { + do_trace_qmp(">>", request); + } if (cmd->options & QCO_DEPRECATED) { switch (compat_policy.deprecated_input) { case COMPAT_POLICY_INPUT_ACCEPT: @@ -282,5 +296,11 @@ out: qdict_put_obj(rsp, "id", qobject_ref(id)); } + if (!trace_event_get_state_backends(TRACE_MONITOR_QMP_RESPOND) && + trace_event_get_state_backends(TRACE_QMP) && cmd->tracing) + { + do_trace_qmp("<<", QOBJECT(rsp)); + } + return rsp; } diff --git a/softmmu/vl.c b/softmmu/vl.c index 55ab70eb97..fd452b7013 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2722,6 +2722,25 @@ void qmp_x_exit_preconfig(Error **errp) } } +static void trace_opt_parse_with_qmp(const char *optarg) +{ + const char *pattern; + QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("trace"), + optarg, true); + if (!opts) { + exit(1); + } + + pattern = qemu_opt_get(opts, "enable"); + if (pattern && !strncmp(pattern, "qmp:", 4)) { + monitor_qmp_set_tracing(pattern + 4, true); + qemu_opt_del_all(opts, "enable"); + qemu_opt_set(opts, "enable", "qmp", &error_abort); + } + + trace_opt_parse_opts(opts); +} + void qemu_init(int argc, char **argv, char **envp) { QemuOpts *opts; @@ -3480,7 +3499,7 @@ void qemu_init(int argc, char **argv, char **envp) xen_domid_restrict = true; break; case QEMU_OPTION_trace: - trace_opt_parse(optarg); + trace_opt_parse_with_qmp(optarg); break; case QEMU_OPTION_plugin: qemu_plugin_opt_parse(optarg, &plugin_list); diff --git a/trace/qmp.c b/trace/qmp.c index 3b4f4702b4..87766422d9 100644 --- a/trace/qmp.c +++ b/trace/qmp.c @@ -11,6 +11,7 @@ #include "qapi/error.h" #include "qapi/qapi-commands-trace.h" #include "control-vcpu.h" +#include "monitor/monitor.h" static CPUState *get_cpu(bool has_vcpu, int vcpu, Error **errp) @@ -77,6 +78,14 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name, bool is_pattern = trace_event_is_pattern(name); CPUState *cpu; + if (!strncmp(name, "qmp:", 4)) { + if (!monitor_qmp_is_tracing_enabled(name + 4)) { + return NULL; + } + + return qmp_trace_event_get_state("qmp", has_vcpu, vcpu, errp); + } + /* Check provided vcpu */ cpu = get_cpu(has_vcpu, vcpu, &err); if (err) { @@ -139,6 +148,17 @@ void qmp_trace_event_set_state(const char *name, bool enable, bool is_pattern = trace_event_is_pattern(name); CPUState *cpu; + if (!strncmp(name, "qmp:", 4)) { + monitor_qmp_set_tracing(name + 4, enable); + + if (enable || !monitor_qmp_is_tracing_enabled(NULL)) { + qmp_trace_event_set_state("qmp", enable, has_ignore_unavailable, + ignore_unavailable, has_vcpu, vcpu, errp); + } + + return; + } + /* Check provided vcpu */ cpu = get_cpu(has_vcpu, vcpu, &err); if (err) { diff --git a/qapi/trace-events b/qapi/trace-events index cccafc07e5..753433856c 100644 --- a/qapi/trace-events +++ b/qapi/trace-events @@ -36,3 +36,5 @@ visit_type_str(void *v, const char *name, char **obj) "v=%p name=%s obj=%p" visit_type_number(void *v, const char *name, void *obj) "v=%p name=%s obj=%p" visit_type_any(void *v, const char *name, void *obj) "v=%p name=%s obj=%p" visit_type_null(void *v, const char *name, void *obj) "v=%p name=%s obj=%p" + +qmp(const char *what, const char *json) "%s %s"