From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EFCA842E38; Mon, 10 Jul 2023 08:49:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A4519410EF; Mon, 10 Jul 2023 08:49:44 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by mails.dpdk.org (Postfix) with ESMTP id 327D8410D7 for ; Mon, 10 Jul 2023 08:49:43 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 88FF35C00C8; Mon, 10 Jul 2023 02:49:42 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 10 Jul 2023 02:49:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1688971782; x=1689058182; bh=E63nt0VjwzC//BXqfLgYcZlLjs0iYmhhguv 33iD9AYE=; b=YJyvsNXU6x5x+8OeniwwIto8HgP9IXkFsogO4yRITJjLBDWLEKO iNwXOLJUB18XKp1l6yXnVQDk4d76OJxfelM3EWVSEDBPG14Iut74RMzFKz2rM3ML 9lOcL8IizRnIRusANnQYeFWuzopXTe7446QNiRZ+QV2x9KCwg6jgvlQVdu+rJ7TQ eLf8OYo26LKOxtAohps0LRo6K8w5le2queOCs+/PXaEN7IokhwmmWEDWTrOHtwXr gTFxTpj2xe0ba9YAdUSIDncklk3DB25mMhcxKku4GhLaHCwe3KNT7UsdA1/YiHqE DW1jzOuK2Ez+GSZje3nYVyGFLoA4hYgXEcg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1688971782; x=1689058182; bh=E63nt0VjwzC//BXqfLgYcZlLjs0iYmhhguv 33iD9AYE=; b=DBhRNtK9kABB6eaXlevPCxH5DdCF/ZD4XvIPPiwVmXjV+Cw48PJ RAPv/2VnHaTm71KxZsWN4mGcjejDNDBkDy88fzw7aF9aAGmpQc1iSHSAKc0aq+R8 C0Jst93m/BSucfmr2RlQutQzT03m/KwUWGn5NSTUZ6/fI9yobT/LWQw29W8z9/vu NnYBeWovrB41FM3PngqT41Ft9XHHxNz/G0qZF2/CsbSjwkDHhFauDahEnTdt29pv +qUGyT1imG3WGxcxU5XiVBGArj4w6Y38i5TxOzgbXQxu1yETt25bm9mexvwx/Lpe NBS2JTAZCNXhYXF+Up1a5yqGsfX880Askkw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrvdeigdduudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkjghfggfgtgesthhqredttddtudenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpeefhfejleeuvdevtddutdeutdevhfeijeethfffueejhfetuddu vedtkedtieekffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 10 Jul 2023 02:49:41 -0400 (EDT) From: Thomas Monjalon To: fengchengwen Cc: mb@smartsharesystems.com, Kevin Laatz , Bruce Richardson , dev@dpdk.org, david.marchand@redhat.com Subject: Re: [PATCH v4] dmadev: add tracepoints Date: Mon, 10 Jul 2023 08:49:38 +0200 Message-ID: <7265847.4vTCxPXJkl@thomas> In-Reply-To: <1f0b8df9-6a38-57e1-0d9e-ce031297f191@huawei.com> References: <20230412024808.41339-1-fengchengwen@huawei.com> <3922895.oiGErgHkdL@thomas> <1f0b8df9-6a38-57e1-0d9e-ce031297f191@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" 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 09/07/2023 05:23, fengchengwen: > Hi Thomas, >=20 > On 2023/7/7 18:40, Thomas Monjalon wrote: > > 26/05/2023 10:42, Chengwen Feng: > >> Add tracepoints at important APIs for tracing support. > >> > >> Signed-off-by: Chengwen Feng > >> Acked-by: Morten Br=F8rup > >> > >> --- > >> v4: Fix asan smoke fail. > >> v3: Address Morten's comment: > >> Move stats_get and vchan_status and to trace_fp.h. > >> v2: Address Morten's comment: > >> Make stats_get as fast-path trace-points. > >> Place fast-path trace-point functions behind in version.map. > >=20 > > There are more things to fix. > > First you must export rte_dmadev_trace_fp.h as it is included by rte_dm= adev.h. >=20 > It was already included by rte_dmadev.h: > diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h > index e61d71959e..e792b90ef8 100644 > --- a/lib/dmadev/rte_dmadev.h > +++ b/lib/dmadev/rte_dmadev.h > @@ -796,6 +796,7 @@ struct rte_dma_sge { > }; >=20 > #include "rte_dmadev_core.h" > +#include "rte_dmadev_trace_fp.h" >=20 >=20 > > Note: you could have caught this if testing the example app for DMA. > > Second, you must avoid structs and enum in this header file, >=20 > Let me explain the #if #endif logic: >=20 > For the function: > uint16_t > rte_dma_completed(int16_t dev_id, uint16_t vchan, const uint16_t nb_cpls, > uint16_t *last_idx, bool *has_error) >=20 > The common trace implementation: > RTE_TRACE_POINT_FP( > rte_dma_trace_completed, > RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, > const uint16_t nb_cpls, uint16_t *last_idx, > bool *has_error, uint16_t ret), > rte_trace_point_emit_i16(dev_id); > rte_trace_point_emit_u16(vchan); > rte_trace_point_emit_u16(nb_cpls); > rte_trace_point_emit_ptr(idx_val); > rte_trace_point_emit_ptr(has_error); > rte_trace_point_emit_u16(ret); > ) >=20 > But it has a problem: for pointer parameter (e.g. last_idx and has_error)= , only record > the pointer value (i.e. address value). >=20 > I think the pointer value has no mean (in particular, many of there point= ers are stack > variables), the value of the pointer point to is meaningful. >=20 > So I add the pointer reference like below (as V3 did): > RTE_TRACE_POINT_FP( > rte_dma_trace_completed, > RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, > const uint16_t nb_cpls, uint16_t *last_idx, > bool *has_error, uint16_t ret), > int has_error_val =3D *has_error; // pointer reference > int last_idx_val =3D *last_idx; // pointer reference > rte_trace_point_emit_i16(dev_id); > rte_trace_point_emit_u16(vchan); > rte_trace_point_emit_u16(nb_cpls); > rte_trace_point_emit_int(last_idx_val); // record the value of pointer > rte_trace_point_emit_int(has_error_val); // record the value of pointer > rte_trace_point_emit_u16(ret); > ) >=20 > Unfortunately, the above lead to asan failed. because in: > RTE_TRACE_POINT_REGISTER(rte_dma_trace_completed, > lib.dmadev.completed) > it will invoke rte_dma_trace_completed() with the parameter is undefined. >=20 >=20 > To solve this problem, consider the rte_dmadev_trace_points.c will includ= e rte_trace_point_register.h, > and the rte_trace_point_register.h will defined macro: _RTE_TRACE_POINT_R= EGISTER_H_. >=20 > so we update trace points as (as V4 did): > RTE_TRACE_POINT_FP( > rte_dma_trace_completed, > RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, > const uint16_t nb_cpls, uint16_t *last_idx, > bool *has_error, uint16_t ret), > #ifdef _RTE_TRACE_POINT_REGISTER_H_ > uint16_t __last_idx =3D 0; > bool __has_error =3D false; > last_idx =3D &__last_idx; // make sure the pointer has = meaningful value. > has_error =3D &__has_error; // so that the next pointer r= eference will work well. > #endif /* _RTE_TRACE_POINT_REGISTER_H_ */ > int has_error_val =3D *has_error; > int last_idx_val =3D *last_idx; > rte_trace_point_emit_i16(dev_id); > rte_trace_point_emit_u16(vchan); > rte_trace_point_emit_u16(nb_cpls); > rte_trace_point_emit_int(last_idx_val); > rte_trace_point_emit_int(has_error_val); > rte_trace_point_emit_u16(ret); > ) >=20 > > otherwise it cannot be included alone. > > Look at what is done in other *_trace_fp.h files. > >=20 > >=20 >=20 > Whether enable_trace_fp is true or false, the v4 work well. > Below is that run examples with enable_trace_fp=3Dtrue. >=20 > ./dpdk-test --file-prefix=3Dfeng123 --trace=3Dlib.dmadev.* -l 10-11 This is the test application, not the example. Please make sure examples/dma/ is compiling. Also, the test chkincs must run fine.