From patchwork Wed Jun 28 11:09:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 129046 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B807642D7F; Wed, 28 Jun 2023 13:10:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 894E040151; Wed, 28 Jun 2023 13:10:30 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2059.outbound.protection.outlook.com [40.107.92.59]) by mails.dpdk.org (Postfix) with ESMTP id 73580400EF for ; Wed, 28 Jun 2023 13:10:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SMF1p3eA8o9yNwkD4EIKAXMKa/rdcX4pcW++WFj8Dx+WXjEReUmizGiDrn/+x1gNjM9ThlhTu+3wckX+FFMtgdmRTO63/FzwATnQrYp+L0AlQfkGrDOQq7x+ZM6fW4m1MFwF/t/wodziNRveLD09dz99pxw5fV4K58ZdXB8i8OyArgIyqpTBnPzQUjsm6cAAEU3WrZ3ryk5XsXT0tEMN6jrjQiVWdq4pk2FvjM8x/pyokzkXN6PaHlLu26vft1cR7pLyZPriV0ynBTIlxR9HxfcGiKB0N1r1XIjN00Za0psd5PkcjsEI8rBZgBOJJS4P/n7C629UkZ96Lx9A0NgiYw== 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=5JTXkoFdVVtKSontNUnLeOMY86k4BvhHK9k/gTElLG8=; b=LG8DT+aZGJqWspO/9tGduUugrIXoVDJ7TXYDVhp1Bon4zYOyeWYploZ8/eZ//htBLvDLQJ20mOL3rE8+RV2WZeBxHNy3Ic7hORy/qc9hsmroBGJwXetIYkF9irtSzO0xKGoVdVfeA3C2lehVRp7OUZVsWoIZh3xnXBSmL6HQ/jDhUubTeq2rdIE4mghRu729WOBLN1GgPVmKSHOSj+yAQMkgK3oLBnz247H0X9p6R2GbpjKlh12PwJfQ8/KLzmeY/DY/G0LRB5X6Y2KbHfFRNWrT9MQmJax8EfonpVMcB1fDOhRCFWxrv+s0g6I+RpMxIWS7MvR5qBMGcTkdpY9WJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5JTXkoFdVVtKSontNUnLeOMY86k4BvhHK9k/gTElLG8=; b=Vg0xsg4oIYWER7zAi2Trg3OmxdZ0tfEIvMeqkeDtFyxW834O+tDDLIzIhN/8SJ0iTULA16QNWc618ekD21bOZMotJAv7Ov7St7XOGAnZIuUPGzXMBKA5kGiQJ0nVxp8dXO4WewbqD2w3jrRWiuc7M+qNz5FKj6bkl313fVWrY0+drHq6Z2PsxGO152UjdLneb3WgtBnwr+hAHJaAwPVYvwznhzaJrSh8MU+DcisWyRQRG9ulg7ouodbSSdaBhQqD6soZSHBPkpGRNHmr0f7O3RELWn94qYy/iofYTZU1qAhZyIj+ecub0pi4UWcdTJkV76WdSDrl2QxcPKxhjZbMwg== Received: from BN8PR03CA0030.namprd03.prod.outlook.com (2603:10b6:408:94::43) by PH7PR12MB6720.namprd12.prod.outlook.com (2603:10b6:510:1b3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Wed, 28 Jun 2023 11:10:25 +0000 Received: from BN8NAM11FT093.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::41) by BN8PR03CA0030.outlook.office365.com (2603:10b6:408:94::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.20 via Frontend Transport; Wed, 28 Jun 2023 11:10:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT093.mail.protection.outlook.com (10.13.177.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.48 via Frontend Transport; Wed, 28 Jun 2023 11:10:25 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 28 Jun 2023 04:10:13 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 28 Jun 2023 04:10:12 -0700 From: Viacheslav Ovsiienko To: Subject: [PATCH v3 0/4] net/mlx5: introduce Tx datapath tracing Date: Wed, 28 Jun 2023 14:09:54 +0300 Message-ID: <20230628110958.1403-1-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230420100803.494-1-viacheslavo@nvidia.com> References: <20230420100803.494-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT093:EE_|PH7PR12MB6720:EE_ X-MS-Office365-Filtering-Correlation-Id: 23b99686-fa6a-4f68-df9b-08db77c845f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RkB7wXlX6i59dAllkC6LrBRSWkaX2lhq3ww+NhsntCx3XmZzZE6S29vgZk3pxygLA0X+arNoq4kwYPVwh2HoeQalEswt0PmMSvwX9Y7iLcyXk8uDmzcFhy3MbZb4TFXNedjAB+wNp9tqr4UFCBldSe9pp/C+I/C78D3DtZbx7ien5A2z60wuNOmYz6LgPhMv3iiJd0LW9htVCs6Jsz0f3lLqGn2Os00KyLzBV11OfH6rIfy/8OLdiydyI2gkptZSnYPB1JWuIW9fgp6orYpeBBGMOBxoT/4D3vuu/9Dx2IfP79eulw8X1+3TeyNJw58EnIt7NkSXAT3QzfEgHwY2GE97Ih8RPt3xw+BWekrGdTz8+IPRevJ02crCDJ51olkj2+R9wdokDYONphV8pxsv9+4UrNrXqskg8wQ5iYkyF8+jTwcCuVEqzfZ7xy3ke/Bz2gGiEov7YMdGTqaHaQ+LUhp0ARBjaG2OV41Dt8IoOqRXSE+fEFm1Z6hlIO0kxw67pa6/BlWym6Cn0YHAaWF+YIf0D2DwBF7V8wRVi3prl3T9yLLRiUnyw3J9lKDkrpYo5Gg/WH4n+W4/+VDTagQeGm++McX0ciil1046pRmg6smEil/OqJY7fPi5ByU94vD7ar6xYtp9PkdBqneQP/r/mgYbFBhLcQOv5xej3Uf5GuwkPmwwT2QShA3iRlY+S3sUMZmjNUaSTJTjliGiebiSPhxeoddbC+DU1jL/69LgNmvOn1NktctXKOnNcaA1rhlL8r8dxd0tYTeLSPIVtVr17Rc7rC5mm/eHolHAzXatJ7g= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(346002)(396003)(376002)(451199021)(46966006)(36840700001)(40470700004)(356005)(7636003)(82740400003)(47076005)(36756003)(36860700001)(426003)(83380400001)(86362001)(2616005)(8936002)(7696005)(40460700003)(6666004)(966005)(41300700001)(55016003)(70206006)(8676002)(70586007)(316002)(1076003)(6916009)(336012)(26005)(16526019)(6286002)(186003)(82310400005)(40480700001)(478600001)(2906002)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 11:10:25.2194 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23b99686-fa6a-4f68-df9b-08db77c845f9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT093.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6720 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The mlx5 provides the send scheduling on specific moment of time, and for the related kind of applications it would be extremely useful to have extra debug information - when and how packets were scheduled and when the actual sending was completed by the NIC hardware (it helps application to track the internal delay issues). Because the DPDK tx datapath API does not suppose getting any feedback from the driver and the feature looks like to be mlx5 specific, it seems to be reasonable to engage exisiting DPDK datapath tracing capability. The work cycle is supposed to be: - compile appplication with enabled tracing - run application with EAL parameters configuring the tracing in mlx5 Tx datapath - store the dump file with gathered tracing information - run analyzing scrypt (in Python) to combine related events (packet firing and completion) and see the data in human-readable view Below is the detailed instruction "how to" with mlx5 NIC to gather all the debug data including the full timings information. 1. Build DPDK application with enabled datapath tracing The meson option should be specified: --enable_trace_fp=true The c_args shoudl be specified: -DALLOW_EXPERIMENTAL_API The DPDK configuration examples: meson configure --buildtype=debug -Denable_trace_fp=true -Dc_args='-DRTE_LIBRTE_MLX5_DEBUG -DRTE_ENABLE_ASSERT -DALLOW_EXPERIMENTAL_API' build meson configure --buildtype=debug -Denable_trace_fp=true -Dc_args='-DRTE_ENABLE_ASSERT -DALLOW_EXPERIMENTAL_API' build meson configure --buildtype=release -Denable_trace_fp=true -Dc_args='-DRTE_ENABLE_ASSERT -DALLOW_EXPERIMENTAL_API' build meson configure --buildtype=release -Denable_trace_fp=true -Dc_args='-DALLOW_EXPERIMENTAL_API' build 2. Configuring the NIC If the sending completion timings are important the NIC should be configured to provide realtime timestamps, the REAL_TIME_CLOCK_ENABLE NV settings parameter should be configured to TRUE, for example with command (and with following FW/driver reset): sudo mlxconfig -d /dev/mst/mt4125_pciconf0 s REAL_TIME_CLOCK_ENABLE=1 3. Run DPDK application to gather the traces EAL parameters controlling trace capability in runtime --trace=pmd.net.mlx5.tx - the regular expression enabling the tracepoints with matching names at least "pmd.net.mlx5.tx" must be enabled to gather all events needed to analyze mlx5 Tx datapath and its timings. By default all tracepoints are disabled. --trace-dir=/var/log - trace storing directory --trace-bufsz=B|K|M - optional, trace data buffer size per thread. The default is 1MB. --trace-mode=overwrite|discard - optional, selects trace data buffer mode. 4. Installing or Building Babeltrace2 Package The gathered trace data can be analyzed with a developed Python script. To parse the trace, the data script uses the Babeltrace2 library. The package should be either installed or built from source code as shown below: git clone https://github.com/efficios/babeltrace.git cd babeltrace ./bootstrap ./configure -help ./configure --disable-api-doc --disable-man-pages --disable-python-bindings-doc --enbale-python-plugins --enable-python-binding 5. Running the Analyzing Script The analyzing script is located in the folder: ./drivers/net/mlx5/tools It requires Python3.6, Babeltrace2 packages and it takes the only parameter of trace data file. For example: ./mlx5_trace.py /var/log/rte-2023-01-23-AM-11-52-39 6. Interpreting the Script Output Data All the timings are given in nanoseconds. The list of Tx (and coming Rx) bursts per port/queue is presented in the output. Each list element contains the list of built WQEs with specific opcodes, and each WQE contains the list of the encompassed packets to send. Signed-off-by: Viacheslav Ovsiienko --- v2: - comment addressed: "dump_trace" command is replaced with "save_trace" - Windows build failure addressed, Windows does not support tracing v3: - tracepoint routines are moved to the net folder, no need to export - documentation added - testpmd patches moved out from series to the dedicated patches Viacheslav Ovsiienko (4): net/mlx5: introduce tracepoints for mlx5 drivers net/mlx5: add comprehensive send completion trace net/mlx5: add Tx datapath trace analyzing script doc: add mlx5 datapath tracing feature description doc/guides/nics/mlx5.rst | 77 ++++++++ drivers/net/mlx5/linux/mlx5_verbs.c | 8 +- drivers/net/mlx5/mlx5_devx.c | 8 +- drivers/net/mlx5/mlx5_rx.h | 19 -- drivers/net/mlx5/mlx5_rxtx.h | 19 ++ drivers/net/mlx5/mlx5_tx.c | 29 +++ drivers/net/mlx5/mlx5_tx.h | 135 ++++++++++++- drivers/net/mlx5/tools/mlx5_trace.py | 271 +++++++++++++++++++++++++++ 8 files changed, 537 insertions(+), 29 deletions(-) create mode 100755 drivers/net/mlx5/tools/mlx5_trace.py