From patchwork Tue Dec 21 19:35:00 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: 12690515 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id F103CC433F5 for ; Tue, 21 Dec 2021 19:56:39 +0000 (UTC) Received: from localhost ([::1]:54508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzlFW-0006vS-FD for qemu-devel@archiver.kernel.org; Tue, 21 Dec 2021 14:56:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzlE6-00069F-2U for qemu-devel@nongnu.org; Tue, 21 Dec 2021 14:55:10 -0500 Received: from mail-eopbgr40123.outbound.protection.outlook.com ([40.107.4.123]:30638 helo=EUR03-DB5-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 1mzlE2-0006qn-O6 for qemu-devel@nongnu.org; Tue, 21 Dec 2021 14:55:09 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kEw2xXPMWp4tagjWxtqjlh1AOTaLLo8rwQjn4xMpULHcoxQEfZRxfYtBAWNzPAyHcQX6Jk5Gd+W9WNM4tCMzj+vlCEq1dWeHF8vF7ZhslHDPnSFXtlfbFehAyK8OWocxQ97HARNm5/PTgTuRKM9zCmjMcgiIcA0qGrbPyKxlmBHv5jvHebRn6ixFZMMcOZfZGPUMgl4QNHBBAJa50p0kGiHGbTaFXNhzlnBTV23wNeyfTX9eYX+hq+S6oVOBThaPDz2LlBtvhyED4qr2gv+3qFhVQyHVDWC4KLuGijVJ/5MS0eN9LkJinpvzsqV8P6DA08V3wE6Hru5rhbGwHjz//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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=E4NdJoNHJg3qS9k6I9KyJ9LMF/UeA5lxTavImM7l1fs=; b=LAqh/kS6Hc+sA3vMFrIzJzM97vtmLj3bHHdKxhQGytB1a5cnRVYqsNxFnRCG2YIok0+zLUCwrucY1mIgwzBPmUhwWIYYrZ5FFJOjDzwD2kdU4V9OG0px3Fg7eyvGoQnhrXpH9n4xLrUshsp4IxzfjrOiVra3waO1tZJ96tyzi2spRZEatm5v/4CAbPjaygbFg2LukTJZoS7jxl04ZjWrwc7068cypMe1cvXBevEWmF+k/MvyJNcSDp/dlEJKzCQFIoTIdlw6QKflMCbSpQ2F9U0GlJ4B0BbYAUeBRir8eS+OxiXPDFEYXC/ZeA4awTEXME+mlUmUsZto12qmKvCPwg== 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=E4NdJoNHJg3qS9k6I9KyJ9LMF/UeA5lxTavImM7l1fs=; b=BmAP8miqlJrHRBudmpHtG1OaPz8jyQfBPP2/aw0m1w5nkZ4CjU3RUFfuP8LxC05z2XYxXGYrZdZqP3qRy2K+q/eJsYDms8e6DhMyyifWVCg6HKtsFvlzDUvo0KFRXx2zREYyqIr0pcChs0pU/RfMJxdbV0p6SO/3GpGAmU3XCcI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB4964.eurprd08.prod.outlook.com (2603:10a6:208:157::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.17; Tue, 21 Dec 2021 19:35:14 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.016; Tue, 21 Dec 2021 19:35:14 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, michael.roth@amd.com, armbru@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 1/3] scripts/qapi/commands: gen_commands(): add add_trace_points argument Date: Tue, 21 Dec 2021 20:35:00 +0100 Message-Id: <20211221193502.114296-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211221193502.114296-1-vsementsov@virtuozzo.com> References: <20211221193502.114296-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM5PR0402CA0014.eurprd04.prod.outlook.com (2603:10a6:203:90::24) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d26cf303-0d24-4ed0-0d1f-08d9c4b90249 X-MS-TrafficTypeDiagnostic: AM0PR08MB4964:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:298; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JXKaMvvwJRkBccii6l58iVoEHMzqxsIL/C7Nqtp2QcUKcF4OPtHAPcz5lXnGu40k95TTmtTEiaUzXiIXoDb6ojBV9ZiticEQhaoQ6ev4ydoijlxVMUUilhcX+a+fkKFqsM6hEMNVD42H+yPFAks3kLmYt6BRRfMLqcrWdCdz+ogt3ndetEk20o2CTTN3clFr8viq9eB5Olja2JnjnnrxjbiXLSV1tCOdGVX7q6zOlOCQ/DsYjbnX/d6DAc0NGAsuUaTlCtoz3SvZkCQGgpTmeG2Yw7tsA8GdXim8RVYswKWYp8SF0Lbi764E2O4Zpp7+oKfad9W0+j5/6+4h0fnOSUswo2AwL0lSTdDXE6gMvGKXOL4M8jMes2J7cO1AkVzFCfc0ul5Xe0a3yqG4U4KKiQMFNa8yeAEZirmVYKvK5k4qPAmdrJ2mB8FK43PlEb92XxHnjSWe88B5V70ucKhqdCf8mlu0LAjsNtCr+WMBvdHFlfVLDVjh9oRpldwqXtvQ+v8+sD+2l73lrDz8BES9bTXY82mLXzQr/0Xksgn9KdLYb9OJoN1J5nDL6WD3TSzps71nCwyYgogQX8AjK0pgRH9kvnmN9Le7YjYo3wN57OT8E/rG3xs+lOUWUiM1SBIQDpsTQuI0ty2Ykwm0GAv2oLP6xyIOniEmbVK0mtnOviSznK+r94w2uTd+O+mTRP+b32HTC/5VW/c/D95dCVKJGg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(8936002)(186003)(36756003)(6486002)(38350700002)(6666004)(26005)(66476007)(66556008)(38100700002)(52116002)(86362001)(4326008)(6506007)(83380400001)(107886003)(8676002)(5660300002)(66946007)(2616005)(2906002)(1076003)(6916009)(6512007)(508600001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkC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M6Q43+W/rId+z/rgxylOGn8FJHVkxshpCfJhXBdEU4VuhOmSFeD+BoLa5QvNBH73Qn6QHroZvaSo3SBxRl0WUK1Tvx8KQKZ+wvcxCTyROgL4pyFnOce0aTPY66hdVzT2uabF8X9YmJyReVd32hLyP8G571p5GoMiwWf0pDBqjVXcquEy+5WE0kuFLKf0vPsWGj74dwNU22mIQk4+kdtU2HjCFzFaH6YfwYscJf/L/GVW6+S+UIKnj2aN4x2VdA/PN/68TQdjX6NqkN/RvYD5GY+fsTCFOYAjkFHtuP8+FNKrslKzC8A0G1Le5BYIjdexKU69eZC3H3tiblan1aJCggs6QydR3YwBp9DMxRpPmXy0+xyhYGRltOiUDTAwGYHVppfBHTmQokMQ+i5jqz4YofCYojqKVGbCR34L9ZpWf5FAgXVDVQm/4iwWdKsqxmQhXSFmzAmfZw5x9lBZjI05s/m/tyKpg5njWlbDu3ozU/oM/tFAH86YO/RAJo9Uljr6bv6GyPWLPOlaG6Z2AKiy15yxDNcnRUgx8xadkVLHVWhGEWkAP4nhPovU11R9s0xkQsZHKbyW2FVKAwLvDRvLlMZRiTBkwqBMnunJGaIUfN2F+2j0jMVP9DUJGLNFlSDkPmJBkDK/h/auFjELGlds= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d26cf303-0d24-4ed0-0d1f-08d9c4b90249 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2021 19:35:13.9733 (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: N0/bm6/3i8ARapEAiP1JkH5y5F4YmSrTQ69fZm7edNSRBFIz453rVDuwMGdnCWW3Y2lH8dREEfvsiRXd9IlPTBJZ2JtiqpSprBuryqINhlk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4964 Received-SPF: pass client-ip=40.107.4.123; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-DB5-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, 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.29 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 possibility to generate trace points for each qmp command. We should generate both trace points and trace-events file, for further trace point code generation. Signed-off-by: Vladimir Sementsov-Ogievskiy --- scripts/qapi/commands.py | 84 ++++++++++++++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 11 deletions(-) diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 21001bbd6b..e62f1a4125 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -53,7 +53,8 @@ def gen_command_decl(name: str, def gen_call(name: str, arg_type: Optional[QAPISchemaObjectType], boxed: bool, - ret_type: Optional[QAPISchemaType]) -> str: + ret_type: Optional[QAPISchemaType], + add_trace_points: bool) -> str: ret = '' argstr = '' @@ -71,21 +72,65 @@ def gen_call(name: str, if ret_type: lhs = 'retval = ' - ret = mcgen(''' + qmp_name = f'qmpq_{c_name(name)}' + upper = qmp_name.upper() + + if add_trace_points: + ret += mcgen(''' + + if (trace_event_get_state_backends(TRACE_%(upper)s)) { + g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args)); + trace_%(qmp_name)s("", req_json->str); + } + ''', + upper=upper, qmp_name=qmp_name) + + ret += mcgen(''' %(lhs)sqmp_%(c_name)s(%(args)s&err); - error_propagate(errp, err); ''', c_name=c_name(name), args=argstr, lhs=lhs) - if ret_type: - ret += mcgen(''' + + ret += mcgen(''' if (err) { +''') + + if add_trace_points: + ret += mcgen(''' + trace_%(qmp_name)s("FAIL: ", error_get_pretty(err)); +''', + qmp_name=qmp_name) + + ret += mcgen(''' + error_propagate(errp, err); goto out; } +''') + + if ret_type: + ret += mcgen(''' qmp_marshal_output_%(c_name)s(retval, ret, errp); ''', c_name=ret_type.c_name()) + + if add_trace_points: + if ret_type: + ret += mcgen(''' + + if (trace_event_get_state_backends(TRACE_%(upper)s)) { + g_autoptr(GString) ret_json = qobject_to_json(*ret); + trace_%(qmp_name)s("RET:", ret_json->str); + } + ''', + upper=upper, qmp_name=qmp_name) + else: + ret += mcgen(''' + + trace_%(qmp_name)s("SUCCESS", ""); + ''', + qmp_name=qmp_name) + return ret @@ -122,10 +167,14 @@ def gen_marshal_decl(name: str) -> str: proto=build_marshal_proto(name)) +def gen_trace(name: str) -> str: + return f'qmpq_{c_name(name)}(const char *tag, const char *json) "%s%s"\n' + def gen_marshal(name: str, arg_type: Optional[QAPISchemaObjectType], boxed: bool, - ret_type: Optional[QAPISchemaType]) -> str: + ret_type: Optional[QAPISchemaType], + add_trace_points: bool) -> str: have_args = boxed or (arg_type and not arg_type.is_empty()) if have_args: assert arg_type is not None @@ -180,7 +229,7 @@ def gen_marshal(name: str, } ''') - ret += gen_call(name, arg_type, boxed, ret_type) + ret += gen_call(name, arg_type, boxed, ret_type, add_trace_points) ret += mcgen(''' @@ -238,11 +287,12 @@ def gen_register_command(name: str, class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): - def __init__(self, prefix: str): + def __init__(self, prefix: str, add_trace_points: bool): super().__init__( prefix, 'qapi-commands', ' * Schema-defined QAPI/QMP commands', None, __doc__) self._visited_ret_types: Dict[QAPIGenC, Set[QAPISchemaType]] = {} + self.add_trace_points = add_trace_points def _begin_user_module(self, name: str) -> None: self._visited_ret_types[self._genc] = set() @@ -261,6 +311,15 @@ def _begin_user_module(self, name: str) -> None: ''', commands=commands, visit=visit)) + + if self.add_trace_points and c_name(commands) != 'qapi_commands': + self._genc.add(mcgen(''' +#include "trace/trace-qapi.h" +#include "qapi/qmp/qjson.h" +#include "trace/trace-%(nm)s_trace_events.h" +''', + nm=c_name(commands))) + self._genh.add(mcgen(''' #include "%(types)s.h" @@ -322,7 +381,9 @@ def visit_command(self, with ifcontext(ifcond, self._genh, self._genc): self._genh.add(gen_command_decl(name, arg_type, boxed, ret_type)) self._genh.add(gen_marshal_decl(name)) - self._genc.add(gen_marshal(name, arg_type, boxed, ret_type)) + self._genc.add(gen_marshal(name, arg_type, boxed, ret_type, + self.add_trace_points)) + self._gent.add(gen_trace(name)) with self._temp_module('./init'): with ifcontext(ifcond, self._genh, self._genc): self._genc.add(gen_register_command( @@ -332,7 +393,8 @@ def visit_command(self, def gen_commands(schema: QAPISchema, output_dir: str, - prefix: str) -> None: - vis = QAPISchemaGenCommandVisitor(prefix) + prefix: str, + add_trace_points: bool) -> None: + vis = QAPISchemaGenCommandVisitor(prefix, add_trace_points) schema.visit(vis) vis.write(output_dir) From patchwork Tue Dec 21 19:35:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12690497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E00A3C433F5 for ; Tue, 21 Dec 2021 19:41:19 +0000 (UTC) Received: from localhost ([::1]:38154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzl0g-0003Xc-NH for qemu-devel@archiver.kernel.org; Tue, 21 Dec 2021 14:41:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzkvR-00011f-Ou for qemu-devel@nongnu.org; Tue, 21 Dec 2021 14:35:55 -0500 Received: from mail-vi1eur05on2099.outbound.protection.outlook.com ([40.107.21.99]:22497 helo=EUR05-VI1-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 1mzkvO-0004At-PS for qemu-devel@nongnu.org; Tue, 21 Dec 2021 14:35:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dIZr63Tr5RCkKuAZGoBjUkH/hQ+g/bjTMoOGJ/ucUkSc4b++GOqd9xW6KMuX8Ctm1mnu1IAWZR3zvEyjP08cXts8zwX0L/XAeXqA0pN1tf/GfK4IdqUs9VqO2YT7OTPfTyG9ds5GwxfrR3L2mMECv47V6Xh3/3yeeZScX+Qlm6Ggk568nU1bz+UeqyCkCLWYB5ylAd8PofsvHGmI0eY7rCTxVM3fEYsCRkSWLEP0TcqA1PMX41XnBr2rwIyvJ3LXHGH5M9PpJtc01OoBsZeIXFo3cigUmeNv4N6pmpVTMP/vTxH/1T2THGggeFFPs8+dx3UuUY1VuPtqaP1do3ERkQ== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NuqJJ3XcGN9DjRzQNZ3OREMYcZVrj/PdnrUgy5avHVw=; b=O1wBq7mIsdpHqQUiUiae069Zjtz8fwXFnBCymBZUrxlrCbAxmYit2IUZYlXCCc6QVpj2bzehvb5y/DhrtZf3HwvdS+oxkfcARp8pzDbgGHb8sJufThDI9Zmib8gRqn1nEXrxJa9/2XsXCvf2l3wOPAunpqAUwfJ7to5+Z2fF6137OChRHneEfEY8JbVct87Dtg6S/wr1hU3jce7V/yJp9+xHW8mybsLfEQfJDwAeSyXpAn5FUqGabESPIcBjHeGHxuNtKrF19dmjmlMzFiEDVzCduheHOAgp0WVJgormAHkSWTkz3LUJlgR8wvb+pYmMaXhCQ5ly9hQ1zSEbVVYySg== 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=NuqJJ3XcGN9DjRzQNZ3OREMYcZVrj/PdnrUgy5avHVw=; b=Q1j/EDx5qLN1JiAbPxDpxs6vZNnMOs7qDjOoEC7bK343uzJMbDZe2ZqHxDUHvPSWVnfF7OVxqUsFdG1yzaYDGfA2CIqlPv9Oa+qukJOtPguKCDxY6EPJVFaPjUvpDeHOGocf7IZ6bC7YIjpYPI5qUivpc0TudezD09ueBeu7lQA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB4964.eurprd08.prod.outlook.com (2603:10a6:208:157::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.17; Tue, 21 Dec 2021 19:35:14 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.016; Tue, 21 Dec 2021 19:35:14 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, michael.roth@amd.com, armbru@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 2/3] scripts/qapi-gen.py: add --add-trace-points option Date: Tue, 21 Dec 2021 20:35:01 +0100 Message-Id: <20211221193502.114296-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211221193502.114296-1-vsementsov@virtuozzo.com> References: <20211221193502.114296-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM5PR0402CA0014.eurprd04.prod.outlook.com (2603:10a6:203:90::24) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb255941-11bc-4660-5e01-08d9c4b902ad X-MS-TrafficTypeDiagnostic: AM0PR08MB4964:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yR2Sw3EjKaQg18I4Weyc6AorepvebYsHtx9qvM/lDDK6Xt82OUQOPXJDZCQcoqoxp6CNpOwhtF3De2pmRWJlUtNi0WmEpcbZfLxPWJwXk2C2m/IPt2XnsmU+IvSWjVXCUf7YiM7Xk9NhYn43ITQRRce4LTQrboz6L9THp1oPN7n3QnSUDjawEPPdQghcE261xkJVIwATFzoX9faYzk3gzWY5kqBruEdqkyGveCjc2nra0zPHwVhBmJmrsFvg5/nlIacFo2S36myEghCgtlYmQ3dnm/eNCcC7IiSNp1tDa022wXBKSvDg/qJCdmjAXJfLsjjRr8fv24UqvXdt6wVaGnSDA049B7GXIzNRlS4z+T6J0XH6BUO1Mu/UtFbwHFmWbvepwFkjrzW9yHy4WUHtnyVlY4Alz9WxLjTbFfp/DadzDOk49wuRtdkoA4dS93WU5hnHk3BgvP/JGdjpH0Nhmhkbct4LzSw3ybH4dfLtwi5jGHIh4IHIPe2tUYhrtR0+bNAsAcqlK8sUMY2YckTygl4beU4Ks+dC3vBdRwiZMTsiS49ZeweLHZmqj+mMh4JZIRIEny/mfo+mhqBVrPv6HuYOAPUbGG7VhyexcDHfl8EhwjbDFJkfOxL86WzJBqY35t7wQa6qjFR7vFEXv9HEMkjmDEFFb2t/xpOSanOZuazZ2B33NoKcJ1Nto0ch7bLjCMq/XJ0ZrTcu9qz63TES4Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(8936002)(186003)(36756003)(6486002)(38350700002)(6666004)(26005)(66476007)(66556008)(38100700002)(52116002)(86362001)(4326008)(6506007)(83380400001)(107886003)(8676002)(5660300002)(66946007)(2616005)(2906002)(1076003)(6916009)(6512007)(508600001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OVDfYqD9u4PSvLA0o7f4GVC84saZvkqwCCq97fIoJLucPwHXreLHb9JuPl9Q2X7ElAXFoYtoMOvX1l4pr5DeEW8wYz4conT8qBinLw4LWU3bTgc5dITUH2GMmeD78MB20dQIrzoqyV1/y7E8R1BivbEiINLSjaySJlXx32R3F5hMdjgrdrWwo6JtjR+7RS9Kd0/905rIZpgvIdkmmhDQ4y7/dQS4MTwzee6Itn/4lbdO9ZFsB7V7zSWW+fH7OKSqUwenAz36ho/K2Fcb4u8pl5uV78A0ckCUtk05gKaqApreIGQO9lFu5yWCvYpNPY9q/zg5qMLop1aaZ1A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VYwhfWF/ZRAw9SuhbCqzNw/HjP1fBqlWtpS4dDGD+N49ztu9+QGn9T1ewZZEq9+a03yeS6Gy6sPdPKrXLWOMzWFP3CJe790W6f5Y2usxxYnqtRs8nhacmend3syOT80RezvdrxZuDroPpZ1/H9ZK+JE5YldBU4vf0DbX2ozeAdKdGWUZbxnfhLlzwqIG9ePe527firxNMRYQGlmZe/tvr1nz8nMEG8qc1h0Rzl3LXmEU+dJNyUSQW82og8bUQL2UEWzNkG0rZV9VmRY3+w9kHp0vNBSYdU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb255941-11bc-4660-5e01-08d9c4b902ad X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2021 19:35:14.3795 (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: 5BPqrWGzpHwvICyySCSllaj22Tn43NwrwiDNcu0H0VrYF/QSeGSmJlZM1LlSoeqLYjslFAvrOZpSu9pIvlU21shTGjB9CGZQM6Dh3bq2YTY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4964 Received-SPF: pass client-ip=40.107.21.99; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-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, 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.29 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 and option to generate trace points. We should generate both trace points and trace-events files for further trace point code generation. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Philippe Mathieu-Daudé --- scripts/qapi/gen.py | 13 ++++++++++--- scripts/qapi/main.py | 10 +++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 995a97d2b8..605b3fe68a 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -251,7 +251,7 @@ def __init__(self, self._builtin_blurb = builtin_blurb self._pydoc = pydoc self._current_module: Optional[str] = None - self._module: Dict[str, Tuple[QAPIGenC, QAPIGenH]] = {} + self._module: Dict[str, Tuple[QAPIGenC, QAPIGenH, QAPIGen]] = {} self._main_module: Optional[str] = None @property @@ -264,6 +264,11 @@ def _genh(self) -> QAPIGenH: assert self._current_module is not None return self._module[self._current_module][1] + @property + def _gent(self) -> QAPIGen: + assert self._current_module is not None + return self._module[self._current_module][2] + @staticmethod def _module_dirname(name: str) -> str: if QAPISchemaModule.is_user_module(name): @@ -293,7 +298,8 @@ def _add_module(self, name: str, blurb: str) -> None: basename = self._module_filename(self._what, name) genc = QAPIGenC(basename + '.c', blurb, self._pydoc) genh = QAPIGenH(basename + '.h', blurb, self._pydoc) - self._module[name] = (genc, genh) + gent = QAPIGen(basename + '.trace-events') + self._module[name] = (genc, genh, gent) self._current_module = name @contextmanager @@ -304,11 +310,12 @@ def _temp_module(self, name: str) -> Iterator[None]: self._current_module = old_module def write(self, output_dir: str, opt_builtins: bool = False) -> None: - for name, (genc, genh) in self._module.items(): + for name, (genc, genh, gent) in self._module.items(): if QAPISchemaModule.is_builtin_module(name) and not opt_builtins: continue genc.write(output_dir) genh.write(output_dir) + gent.write(output_dir) def _begin_builtin_module(self) -> None: pass diff --git a/scripts/qapi/main.py b/scripts/qapi/main.py index f2ea6e0ce4..3adf0319cf 100644 --- a/scripts/qapi/main.py +++ b/scripts/qapi/main.py @@ -32,7 +32,8 @@ def generate(schema_file: str, output_dir: str, prefix: str, unmask: bool = False, - builtins: bool = False) -> None: + builtins: bool = False, + add_trace_points: bool = False) -> None: """ Generate C code for the given schema into the target directory. @@ -49,7 +50,7 @@ def generate(schema_file: str, schema = QAPISchema(schema_file) gen_types(schema, output_dir, prefix, builtins) gen_visit(schema, output_dir, prefix, builtins) - gen_commands(schema, output_dir, prefix) + gen_commands(schema, output_dir, prefix, add_trace_points) gen_events(schema, output_dir, prefix) gen_introspect(schema, output_dir, prefix, unmask) @@ -74,6 +75,8 @@ def main() -> int: parser.add_argument('-u', '--unmask-non-abi-names', action='store_true', dest='unmask', help="expose non-ABI names in introspection") + parser.add_argument('--add-trace-points', action='store_true', + help="add trace points to qmp marshals") parser.add_argument('schema', action='store') args = parser.parse_args() @@ -88,7 +91,8 @@ def main() -> int: output_dir=args.output_dir, prefix=args.prefix, unmask=args.unmask, - builtins=args.builtins) + builtins=args.builtins, + add_trace_points=args.add_trace_points) except QAPIError as err: print(f"{sys.argv[0]}: {str(err)}", file=sys.stderr) return 1 From patchwork Tue Dec 21 19:35:02 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: 12690499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 94311C433F5 for ; Tue, 21 Dec 2021 19:41:41 +0000 (UTC) Received: from localhost ([::1]:38352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzl12-0003gx-G9 for qemu-devel@archiver.kernel.org; Tue, 21 Dec 2021 14:41:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzkvX-00015C-I1 for qemu-devel@nongnu.org; Tue, 21 Dec 2021 14:35:59 -0500 Received: from mail-vi1eur05on2099.outbound.protection.outlook.com ([40.107.21.99]:22497 helo=EUR05-VI1-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 1mzkvS-0004At-CF for qemu-devel@nongnu.org; Tue, 21 Dec 2021 14:35:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H4YpI5wuBsz4P4df1dvJdbxYIskJSbI1PGhYr7UY4P++TQWtLH8OszPSjbOSthgvHNWvwh5ynjnM0gYo11m8bGPZDutPa7rJPx2lTvrz2kdriGpAb199HeAUu10PAwying+COs4IarXfKjpOLVsEJXJMZ155u3JVhe/ZB28ym6Oqecut9Qac5dSjE2Lez8PfTgRctdVinnu61dWEasiEMUy43i6t0rHN5lXDp391r6JsUN2JfUtqVHBPkI7th1SpWdkM8Y71jIGmV04+uYYNQDOelNZ7DBIxYqaCTIbE9xfLXnJP5lHI2sYvepd9NziQk49cKBUox0R0fz44fRSUqg== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OgxUkeFo+74cIaNpDd2ONDxizJpRhU+Hx3FyhxoqNgU=; b=d8HWBeJB7D78/Plv0Pnn/P9rI0P3Flq7DlwdKTqe3Tf/jP6vCWwcUXJd8kvhkzq5cSozPrLHP1zSumkObq78GqvYRc8dZOe1E0JqAWtMuSJVOkKUA3skd9xqn1vZpKWxaJQFpyBvvBPe9byhpmgb3lp4zQg6il/TzasUe7bWXsNBE82Aw46gYNhIMGY6RasEeAsTVFivUDT2uIgHzjHeww6Vi/t6OPS/U9unHchPBW/pQi1Xf6MOyhWmelkmeYsrzmBGEMTYOTV2C+N33Y/M63FlDGEGTBS5AG0j5al0U+XPxANbGaW6IugcEirCTQLLc7QEjq5yIE0LJz/DV8yR8w== 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=OgxUkeFo+74cIaNpDd2ONDxizJpRhU+Hx3FyhxoqNgU=; b=rzxK9xVY5f1LR1Rtk2ygB2LFwr/jPJVHjdl8jHoNb0F82dUMStHIBOVl/Moi55/zmDBPHejQkf4NlikVv0s5GODFRK4BQ6UIKJ3KAYuI+rZnL1YTkKS1AJXE0aSHJYwTwnBMSEwPSyE2r+gfxR97Z/lqB1nCjGdsx8M7fK55Vug= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM0PR08MB4964.eurprd08.prod.outlook.com (2603:10a6:208:157::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.17; Tue, 21 Dec 2021 19:35:14 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.016; Tue, 21 Dec 2021 19:35:14 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, michael.roth@amd.com, armbru@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 3/3] meson: generate trace points for qmp commands Date: Tue, 21 Dec 2021 20:35:02 +0100 Message-Id: <20211221193502.114296-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211221193502.114296-1-vsementsov@virtuozzo.com> References: <20211221193502.114296-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM5PR0402CA0014.eurprd04.prod.outlook.com (2603:10a6:203:90::24) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5cfef31b-bac2-49cb-9419-08d9c4b902e6 X-MS-TrafficTypeDiagnostic: AM0PR08MB4964:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +3Ywr1gLeZEroKhLRN/CC0HipFoCnJPmnATtCx8wyAVbWhMSuvgbN54iN+vqVLDQOQMDNjFDiw/Zp8PJlC3KGlN3NT5kh4hdNR/hD2rVmK6Mmt/Njek1MWI8LuLcVtSDl6TtlE8/sH6sYU16Lw8uTGfhGfaSdcnTksGT46iMxGleZat8QP4Q/zYjmmuYteCJjJLWctY7j6ltZV/cgdJBNiYYFE28kwqvfwmBq7hbmHNWZSCNV5uFBunO/jooyvtDo9Aebm3XAwz3ZK4eiGhnNqMa0C3MEBAXaXhNPKKBFggZUYOHULb9SX4Q1Fr6EZIU624m4QMz40WlcI3iixdmG0lSm5dvcvF3+OBSa9SQAs5a831SsdnYq/bTRkKGW4JwJ4kAk6UOHpZJ1gTgLAxoUVvBOsHxzfnGhLPypdtHHrugdu2/NTNQPUfIXM82uzLij37NyrpzLuJdP5KI/Zfq9VLZuy106HEDOMbGF3szG2RatiO4AAs9IujGe0crl2wDGA8z2rrCh9oDX2MyWES460zYpBdKx1o5CQDDjPysVkkPKeReqf7GVuGB78GUX3M9qjSFoYhmVKplxb5Ol+dsw5YGjYr7poEJRL7RYlA9w6k1MHwiW9g5jg+timWrD3OGxs8nac6M5rcmq/qgVaTBG4KyNqJt8DrX6BBjhiGWdOXAq8xgeqDtI3/0Q2W4FOggOfde9ogDj05nZ6kn6cM5qg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(8936002)(186003)(36756003)(6486002)(38350700002)(6666004)(26005)(66476007)(66556008)(38100700002)(52116002)(86362001)(4326008)(6506007)(83380400001)(107886003)(8676002)(5660300002)(66946007)(2616005)(2906002)(1076003)(6916009)(6512007)(508600001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Wk/XpaZWrJ4by1bwTtOeB+qmgg6I4feptf9gp5dqyQm8tFN1xRjduqmScJV0Y+A3ukpFOcWSD6KniQcJb7Zc4Ktm+WplZM9RbThQU1I5MIl16XpSzIfWhBz61xnkbUN0VdeYiuELBg0HwW/0ZacxpcyqXg8vSRdWXrCeaUeZ3ebGJcr5H934yz/bUZ22HKPeDbIjieq1gKE/f+b05v55/SW/VeQPFejH7PB1lKp9kZUyQi6KxpN0difkrwCIGt++cwXC3+Qr8hI1b/nA+ETPi0ShOCmKUX0VwdJl4wJ7bbwrTcempD/rIDFlD8baDHEYpn04n7GdrPpotMfkiYaCZNXlTmj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T/aefkg63p+I+lBotWivf999c5MZrMR/HXleQVvvohQJ5QOJhi79gLkzsX1+fmmXsOhp2D2or0yaEGLJymhVim5rPK2/FtxlFkoq6Dn0IRo8lDdX1c3XQmWHxLw/icixzIEGcA2WJ+/K1YdRHv3PwrQ8cUxFV3A/OaEOJ6KUONOaAH5ffeZulYy4x6a8bg1VEtiN6obON2wFO9/mq0ScNqhUo63aVH6X1OlZOgaa0LUPkrsMfqBghTsGUYv3jznsP/ufLdEx3i8zQjFwc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cfef31b-bac2-49cb-9419-08d9c4b902e6 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2021 19:35:14.7545 (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: zK+dxRSqUtOn6eP0LuqUawg5kOHjluNn36hCv7kSzAKVvhV0/bT1o7W2h8Wf5vaxO65fHNemckzumQU2F3g02yDDPpggdXEjeprabfd1Kf0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4964 Received-SPF: pass client-ip=40.107.21.99; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FORGED_SPF_HELO=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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" I need help with this thing. Now it works like this: make -j9 ninja: error: '/work/src/qemu/up/up-trace-qmp-commands/build/qapi/qapi-commands-authz.trace-events', needed by 'trace/trace-events-all', missing and no known rule to make it make[1]: *** [Makefile:162: run-ninja] Error 1 make[1]: Leaving directory '/work/src/qemu/up/up-trace-qmp-commands/build' make: *** [GNUmakefile:11: all] Error 2 OK, let's try to make it by hand: make qapi/qapi-commands-authz.trace-events changing dir to build for make "qapi/qapi-commands-authz.trace-events"... make[1]: Entering directory '/work/src/qemu/up/up-trace-qmp-commands/build' GIT ui/keycodemapdb meson tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc capstone slirp [1/1] Generating shared QAPI source files with a custom command make[1]: Leaving directory '/work/src/qemu/up/up-trace-qmp-commands/build' It works! So meson doesn't understand that absolute path is the same as relative.. But I failed to make it the correct way :( And after it, just run "make" again and it build the whole project. Signed-off-by: Vladimir Sementsov-Ogievskiy --- meson.build | 1 + qapi/meson.build | 4 +++- trace/meson.build | 10 +++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index f45ecf31bd..20d32fd20d 100644 --- a/meson.build +++ b/meson.build @@ -38,6 +38,7 @@ qemu_icondir = get_option('datadir') / 'icons' config_host_data = configuration_data() genh = [] +qapi_trace_events = [] target_dirs = config_host['TARGET_DIRS'].split() have_linux_user = false diff --git a/qapi/meson.build b/qapi/meson.build index c0c49c15e4..333ca60583 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -114,7 +114,9 @@ foreach module : qapi_all_modules 'qapi-events-@0@.h'.format(module), 'qapi-commands-@0@.c'.format(module), 'qapi-commands-@0@.h'.format(module), + 'qapi-commands-@0@.trace-events'.format(module), ] + qapi_trace_events += ['qapi-commands-@0@.trace-events'.format(module)] endif if module.endswith('-target') qapi_specific_outputs += qapi_module_outputs @@ -126,7 +128,7 @@ endforeach qapi_files = custom_target('shared QAPI source files', output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs, input: [ files('qapi-schema.json') ], - command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ], + command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@', '--add-trace-points' ], depend_files: [ qapi_inputs, qapi_gen_depends ]) # Now go through all the outputs and add them to the right sourceset. diff --git a/trace/meson.build b/trace/meson.build index 573dd699c6..77e44fa68d 100644 --- a/trace/meson.build +++ b/trace/meson.build @@ -2,10 +2,14 @@ specific_ss.add(files('control-target.c')) trace_events_files = [] -foreach dir : [ '.' ] + trace_events_subdirs - trace_events_file = meson.project_source_root() / dir / 'trace-events' +foreach path : [ '.' ] + trace_events_subdirs + qapi_trace_events + if path.contains('trace-events') + trace_events_file = meson.project_build_root() / 'qapi' / path + else + trace_events_file = meson.project_source_root() / path / 'trace-events' + endif trace_events_files += [ trace_events_file ] - group_name = dir == '.' ? 'root' : dir.underscorify() + group_name = path == '.' ? 'root' : path.underscorify() group = '--group=' + group_name fmt = '@0@-' + group_name + '.@1@'