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 ED25F45E5B; Mon, 9 Dec 2024 13:58:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B5F54025F; Mon, 9 Dec 2024 13:58:23 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 0A4C74025D for ; Mon, 9 Dec 2024 13:58:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733749101; x=1765285101; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=fenF1iiVA9xIknsfzE/hofy36Sn0Kt7fb4tFJ4sRWK4=; b=N5u9I2c/qc6ZAbFdQtl0QKAVpjvv/ly144P3wqPmw9sfJcqafzQ7fyHg D38oNwLVPPk0TitEI37tt7/W3optUoUZllZXMeL6TMFqEOJAVGe102TRQ Zq6sfRWb3C6HfV7YZuZSsgvOfzpbjFaYdzQM1h4qweo/d2rERAfUXi5T7 OEGj1EBDyukKhPX92NKX2pS/rKVOw1cKtIy6/i46MaCN4vS6eHv+gmwcG viGiWSn1hCVmVlZR+t5xxUJ+2iwTh8PxQ0Jf8xD/qENMmOpRXHQrpQFKx GYqo6bB4Or1+0Ubg3C9FdGI+0ZAM/7km0/NM6n0++YUP6ipcmpPv3WUW3 w==; X-CSE-ConnectionGUID: zqSWqy73SWSD8Ylz3RI5TA== X-CSE-MsgGUID: 6fseagtkTLWTeT8u9HVJXw== X-IronPort-AV: E=McAfee;i="6700,10204,11281"; a="51457405" X-IronPort-AV: E=Sophos;i="6.12,219,1728975600"; d="scan'208";a="51457405" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2024 04:58:20 -0800 X-CSE-ConnectionGUID: CQxYR/otRMi4F2uYvXmf8Q== X-CSE-MsgGUID: aFt4Zu06RXmWW1TSgY3SaA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,219,1728975600"; d="scan'208";a="95527879" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa009.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 09 Dec 2024 04:58:20 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 9 Dec 2024 04:58:19 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Mon, 9 Dec 2024 04:58:19 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.176) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 9 Dec 2024 04:58:19 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=f9j4nwdGRTaoN5olJkejC5rv+zZkyOx1gposg7R2eOOGDAoYbrjHYypE5Smgo21fhazSXdhecFTTm42qiBEpLNwqSZNlfm+sn1QEVOjDPUREtDYc3a/mbqgb42zr05wlfEoZ9VuIGWF0VxUcqer1ON1JDYYaeXDQi7B3P2yQpXpbcIkiRiTVzqT74pSMqsriLV1hKcLZUme3FAFaiTyvJI+PH6IOkhDmrtoEOGQhB+RVBTfp6+d1ru8o2cR+AdXfYo8bSAZ39OiComOlqtf3rHe6NkxtyZnrraNsbDMtSteKTPsBujFL4DmaVJNWilExDWTFJwyZWuDNF4lJTDy96A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=is3zXwKP4cGUmLvWP1AGfzdZU+Ey9zznrVWJ3OX0L5k=; b=PRzFHu2VgzdXuowossDe7sicYcq4pYkeGqygEa3gF3QYODhphSepF5RoEYN6B9hc8F46HnvpbEn2WNgiTz8R6WzPCK/azZU2g1KoflG5lEZ2jxQ9QeYu3Qejb8WCOhtQN78sZvoxxiDOs2QjAfrjTmrKTW9DqJuyWbAeWLwJftRdDuaWJ06ncsZuadV+GrSy/7PoKiT2MkWrCloZtF6zZScm9ErXk0ldY0i62LPlkaeF7dO2EClqRlNl1XXtKcQ8TUx5G9hgB/TUVQfgaLlzDdUw05rgU1NRwn9ZLobWm+nbkYKB/2FP8I+sxFi2S6+ZUY7uD9eTjUh4o8MvcEWMYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by SA2PR11MB5212.namprd11.prod.outlook.com (2603:10b6:806:114::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Mon, 9 Dec 2024 12:58:16 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b%4]) with mapi id 15.20.8093.018; Mon, 9 Dec 2024 12:58:16 +0000 Date: Mon, 9 Dec 2024 12:58:11 +0000 From: Bruce Richardson To: Andre Muezerie , CC: Chengwen Feng , Kevin Laatz , Subject: Re: [PATCH 1/2] lib/dmadev: eliminate undefined behavior Message-ID: References: <1733513273-25550-1-git-send-email-andremue@linux.microsoft.com> <1733513273-25550-2-git-send-email-andremue@linux.microsoft.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1733513273-25550-2-git-send-email-andremue@linux.microsoft.com> X-ClientProxiedBy: DU2PR04CA0236.eurprd04.prod.outlook.com (2603:10a6:10:2b1::31) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SA2PR11MB5212:EE_ X-MS-Office365-Filtering-Correlation-Id: 20a7d051-b6c7-4da9-f91a-08dd185125dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?WyaNoMbLanEJdHHvopqIsJDkRd2zxVnbsgCMIxzZ6Fhl42pi3mQdNHupqKFM?= =?us-ascii?Q?Y/Ew2d0WGGkspTZj3SnAriMurytcvHTg3I+XWxcDrO57X67ovtkQUGSl63/t?= =?us-ascii?Q?fGcnLbe+1GJQXow3qGDkVBGWXmcDdD+7SmGkkv5QdEgEJn3r/BC0HJ33YV+v?= =?us-ascii?Q?rUXCTvbWbtKJ6C0rG4IzqbrFkeEXSZHPt6jD4fTNoD+QAArdQNphHiTj2rP1?= =?us-ascii?Q?E2tKPiPdAekLNkJiGCfQYt4GdjXmEtSKyKOc68AEGVrB+35yWCd/B8nqVs9W?= =?us-ascii?Q?tf8qWPK/hEln1bsb1Fazken5GAofzXsSPy22MffUDTzBxSKPhWg26oWFY0nw?= =?us-ascii?Q?Elp/OmG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= =?us-ascii?Q?pkYdDn5B/vDYkB7cZCpFCjNUhJgF/QzCdUHYZOBVjTGhvA3nYzpQlBCs1q93?= =?us-ascii?Q?FDriDgtEc9swWlBrD7J+4MbPZnB0iQ/a5VHIoh72wReAew=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(7053199007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?H20OwQVCm5WfpputINL2ghxiVaVx6xn7MDw9aAZ0Q/SaibNbm+hIfhpbGiZN?= =?us-ascii?Q?xWBFWH9IaAgc+xvkBpi2kzACpy6hx+e3jECKix6v/YeLdUkZLp+cuUK6zUfa?= =?us-ascii?Q?Z8PhTFF55wvBKW+oyQf5256owxD/avG816VOCio6Fw5SM+uSgFNZ4SxxuZAl?= =?us-ascii?Q?gzU+UnHGDlBzh697r498/ZRQN4JDqtrYvln0KnLRQ3FuvmoOZ2noxJzacQp1?= =?us-ascii?Q?D0nZn1SDHRbO4DnIlGEYpLJA4JIdYZjGe/cx30CTyBwi2TKk8PKvdkc3xPDu?= =?us-ascii?Q?pbq2YrOqUlt0aj8zeoF/Y1JnayQstJcKw2Y4GZoLSWW4mvlbUcDpcfUzU1p3?= =?us-ascii?Q?Uv3/SzV7Asotx7nSaOykAdNERGEfgsAAl5LThHTDTUgvvbaGFwG74oPbJwA1?= =?us-ascii?Q?Ed9Vx0Smr037BQymkjivW32CkKJMfCzqgMM4Q+C643ZiLXdyncdzg70+gIjP?= =?us-ascii?Q?VR9bsmSRr2iauKYt3ALI+UiGhwwF96ls1XvXYw0acXB+gFdW9ug38LQk6bPz?= =?us-ascii?Q?w1k3+ooYAGJW/Px5GKuFIqLiv083l7UPxn3ZQH4cIerDZ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grGwf3TOOYU2cOO8Tm9BH6mE9csN4lHqZJ?= =?us-ascii?Q?CNizPVproQi2RbHSK+zXAdp7/8BJUb8ZieGGm+yd02rQGytWnXfU73yEgpXn?= =?us-ascii?Q?Cl6EZeg/VBBUKksxPYBI+9MTbjV/WmlCFs1yzwYwnUxweoPuYXE7Bhi28r3S?= =?us-ascii?Q?bg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 20a7d051-b6c7-4da9-f91a-08dd185125dd X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 12:58:16.4927 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: b+1JPrBDhiEzlp1LGMMAZUqnKL6gz/N9/pShYHJlzdUjtROUIArKK7gSpdaAdgCH7TfZqnorsmCSoz/H+cOHlCFGn10zFpapYLPkCZDrKjg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5212 X-OriginatorOrg: intel.com 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 On Fri, Dec 06, 2024 at 11:27:52AM -0800, Andre Muezerie wrote: > MSVC compiler issues warnings like the one below: > > lib\dmadev\rte_dmadev_trace_fp.h(36): > warning C5101: use of preprocessor directive in > function-like macro argument list is undefined behavior > > Indeed, looking at C99 section 6.10.3 Macro replacement, paragraph 11: > "If there are sequences of preprocessing tokens within the list of > arguments that would otherwise act as preprocessing directives, the > behavior is undefined." > > The fix proposed in this patch moves the ifdef to the outside. > This results in no perf impact, but some lines end up being > duplicated, which seems to be a reasonable trade-off. > > Signed-off-by: Andre Muezerie > --- > lib/dmadev/rte_dmadev_trace.h | 62 ++++++++++++++++++++++++++++---- > lib/dmadev/rte_dmadev_trace_fp.h | 52 +++++++++++++++++++++++---- > 2 files changed, 102 insertions(+), 12 deletions(-) > > diff --git a/lib/dmadev/rte_dmadev_trace.h b/lib/dmadev/rte_dmadev_trace.h > index be089c065c..264a464928 100644 > --- a/lib/dmadev/rte_dmadev_trace.h > +++ b/lib/dmadev/rte_dmadev_trace.h > @@ -19,13 +19,12 @@ > extern "C" { > #endif > > +#ifdef _RTE_TRACE_POINT_REGISTER_H_ > RTE_TRACE_POINT( > rte_dma_trace_info_get, > RTE_TRACE_POINT_ARGS(int16_t dev_id, struct rte_dma_info *dev_info), > -#ifdef _RTE_TRACE_POINT_REGISTER_H_ > struct rte_dma_info __dev_info = {0}; > dev_info = &__dev_info; > -#endif /* _RTE_TRACE_POINT_REGISTER_H_ */ > rte_trace_point_emit_i16(dev_id); > rte_trace_point_emit_string(dev_info->dev_name); > rte_trace_point_emit_u64(dev_info->dev_capa); > @@ -37,15 +36,30 @@ RTE_TRACE_POINT( > rte_trace_point_emit_u16(dev_info->nb_vchans); > rte_trace_point_emit_u16(dev_info->nb_priorities); > ) > +#else > +RTE_TRACE_POINT( > + rte_dma_trace_info_get, > + RTE_TRACE_POINT_ARGS(int16_t dev_id, struct rte_dma_info *dev_info), > + rte_trace_point_emit_i16(dev_id); > + rte_trace_point_emit_string(dev_info->dev_name); > + rte_trace_point_emit_u64(dev_info->dev_capa); > + rte_trace_point_emit_u16(dev_info->max_vchans); > + rte_trace_point_emit_u16(dev_info->max_desc); > + rte_trace_point_emit_u16(dev_info->min_desc); > + rte_trace_point_emit_u16(dev_info->max_sges); > + rte_trace_point_emit_i16(dev_info->numa_node); > + rte_trace_point_emit_u16(dev_info->nb_vchans); > + rte_trace_point_emit_u16(dev_info->nb_priorities); > +) > +#endif /* _RTE_TRACE_POINT_REGISTER_H_ */ > +Jerin I'm unfortunately not familiar with the internals of the traceing library. Can someone perhaps explain (and maybe add in the code as a comment), why we need conditional compilation here? Specifically, when would _RTE_TRACE_POINT_REGISTER_H_ be defined, and when not defined? (or why not defined?) How does having it defined or not affect the expansion of the macro here? Thanks, /Bruce