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 B3F4D45CE3 for ; Mon, 11 Nov 2024 07:29:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC0614067A; Mon, 11 Nov 2024 07:29:31 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2081.outbound.protection.outlook.com [40.107.220.81]) by mails.dpdk.org (Postfix) with ESMTP id 257524067A for ; Mon, 11 Nov 2024 07:29:30 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=O985iwvR26pepRdwJIR1UmnvT7iYbdkEJqrFR1lAe/mGYxP9qhfxPtuOZ3pp9EhlZFzNzQfRCOZfTjenN3eSm29ZMHU0+VSjjfwAveZ7V0x7cRWbb3QByR+OPAtTnPKLg2AWF3AfJG9Q28QQyUfAtz0qokZkzFmUmuH9OKjHqHbQEgLrTOphzPIla6TrOCAYVnHO6hdJrUnIgHNruxpsf1xpPDwzTLsbng3AL4Pp4gEumC1P1e7bBCSMdhIoL5gyq7IbZbZGj34LadcI3GmIr++RWi9lUa64wmirAoTeaADR9aWMnj17+TRoY/OGvvSdnrmyCUPf96rL+Lw+zyt8Mw== 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=RoIQFJezNsCW5LqtP6o37r9Cv6MXk98Rf/mYWnCdj/Y=; b=MzQ6oxmlmljcHt06VFU/0XEYfjYP76XT4xOhVROZXlPFvmDF4hdH2pt0Y2mH2jAA4eIkKnBkfueLgjyF4j0goLFkShbFxXp7bmUq6ykZ6iuw0CKzhP/uob5zvWRp6BS0v9jzOFINmpKFQMFhyAUUoe4yM5H85wOlTQqv93VQleTnOvPcCG8OGuAQR6rigLgF8Ub87h7PZGAvmA+5wmXW5aBzqLRyZTD9NMynDz3UW0e1K0ZWS1bcfqFvHZITw2zrEaTgRefABOLG+rVtr3++KLGQtEkj4Thd/zstGw911epIi3+gHDGUXLZ4cbqj+7rZjRDt9kJggvRKldrydYpcJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com 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 (0) 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=RoIQFJezNsCW5LqtP6o37r9Cv6MXk98Rf/mYWnCdj/Y=; b=tkAjW5X+kTlfur0GTXqQDO3MHCicVkP59qrNqQNx24ZbO67S4YzGxWrvU3KsEhzpZNSAq+NCT3wQOAuGuygi+def3LU3BtgIulFp/FYLd06jMEyp08cLo+NdC7na9azTlRkv3LdsahjgcwCRvhYJsyTOjnkOOajicU2v9YTSxxoiVT+REkgISIQWAXzVwbRd2ci44XuYmZDOqv06dVJK5f5M1oKRNVyg3eH7zU+AZ9UqTTl3VXwvWBijrz+bbs8j9ehsw2wTVGghwj0GHQnXhAfq1uvhEiL9fB6MD5XzrwiIWZbufsFSkt2TfCZhGDWWB+TSlsjdaYnE5U+TD19dpA== Received: from BL0PR05CA0020.namprd05.prod.outlook.com (2603:10b6:208:91::30) by PH7PR12MB6635.namprd12.prod.outlook.com (2603:10b6:510:210::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Mon, 11 Nov 2024 06:29:24 +0000 Received: from BN2PEPF000055E1.namprd21.prod.outlook.com (2603:10b6:208:91:cafe::4f) by BL0PR05CA0020.outlook.office365.com (2603:10b6:208:91::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.15 via Frontend Transport; Mon, 11 Nov 2024 06:29:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN2PEPF000055E1.mail.protection.outlook.com (10.167.245.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.1 via Frontend Transport; Mon, 11 Nov 2024 06:29:23 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 10 Nov 2024 22:29:10 -0800 Received: from nvidia.com (10.126.231.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.1544.4; Sun, 10 Nov 2024 22:29:07 -0800 From: Xueming Li To: David Marchand CC: , Stephen Hemminger , Chengwen Feng , dpdk stable Subject: patch 'log: add a per line log helper' has been queued to stable release 23.11.3 Date: Mon, 11 Nov 2024 14:26:48 +0800 Message-ID: <20241111062847.216344-3-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241111062847.216344-1-xuemingl@nvidia.com> References: <20241111062847.216344-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000055E1:EE_|PH7PR12MB6635:EE_ X-MS-Office365-Filtering-Correlation-Id: b4287da4-f10d-42a7-caf7-08dd021a2f3c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?fuQOGpdCj/1cj+lL3ZzmSYclqcDRiw9MLJ+GzPII9hIFQ50Uqh8qF5HWzxnV?= =?us-ascii?Q?tFddA3Vi1K5XQjwlO+MPUG7oR+r59pSLov1GysXapxWbpPIPslaFZcpU/REK?= =?us-ascii?Q?gPoAKlNn/edV2nSZ4DO3jDpuhhGBRapcSet0VQbWO/e0Kkq/slEETC207Y3x?= =?us-ascii?Q?/LjxY2CW2GSpLO9CX3CIFTLXNmc0sF+Z30fMvTPNInpOsOpMp/Jswo0tuCXW?= =?us-ascii?Q?nEAuh3LJ20aoeL1FpCYWHPB7Ehm7mufFF6rYP2QajJ7O98R55JWzvGWUuXHJ?= =?us-ascii?Q?6h6mTpqSHpknLw2ggI0J4FzYxs3cmXau37sbSQ086UyOsiKEm8VpbmZ0usre?= =?us-ascii?Q?kSN3PB/EYFucbUwD/Nkbf8ZK/HrV1AUTMOMXzAlOFVKuwQYy1Z6ahwKNsTCD?= =?us-ascii?Q?YSR+aTwcUEUvo5MPIc3w1KU10snCMpe/s3GkYjftTHWuVvH7nl3OtaTV5zTN?= =?us-ascii?Q?sZ4cvJpwr6mCdc2glReaeQDZ58xBfhhqWtwrss9Ai/L4rgdJUNZOJJjc5A4t?= =?us-ascii?Q?cTZPPskN5MIiFudBF7aZtTPUxAiQrvrgnxf+zfAM1MdbObxXTNYVplm8adf/?= =?us-ascii?Q?QO+D9Nz7ZLHXssPe/QuYfJ0e8z6dSz+d/aYyS4tmTYgYvzcdqO4O0Umms5p+?= =?us-ascii?Q?tW0viaphXSWu1NI1Y0so2efB+yGPsN0OFNt/rC7Ixz8v5tNvwlOnlhgjhcx9?= =?us-ascii?Q?LFAnEEPxP5XitEXzkA0h4iZHX6e5npJWKqAoiikkBqgowQzQ2CQun5Qn/qLb?= =?us-ascii?Q?CKVMUV5cwAh9pn1JrPAEKFsA4f5wJfacRIF3l3WXsROnLPAnCUhapK3vN+1J?= =?us-ascii?Q?6bE+BonEO+lAE0tWCWbuPMsVck0PklpihYV70QpyFT4G3wosk/RTGUEtUh8V?= =?us-ascii?Q?0NPXM6curEL6G6NZODwTgIGAac6jR+ctIkptIbK+BmXuTkIlm+QB/7qXhZf1?= =?us-ascii?Q?34MMzwrUNL6ryVu9wwaONm4NA17s3bLswo3s+qNVB+0YGW1AkFeQ6yFH9B1T?= =?us-ascii?Q?FO6mBDHOSDpHhkg/C+m/dKWjkrnkzA2ZtAZNTMV5dMp9UnsuR2xsU6cbeJ+K?= =?us-ascii?Q?9BS5OG59JCZcYQdWSAJAWXSZL9tIosS9YLcGzY8JNlQ1MNo99H+VPtOGgi+e?= =?us-ascii?Q?VEcivTWPqegdJIPv45LhYv2WS3kq9AGZ4IBID4mKoC79vr4PDeI2K4zsjQqm?= =?us-ascii?Q?kNtRz7PNiSKHRr4Xgg46oZypZfFKHgQUqRATHxjbZUkQvTBp6Jr7An/4Gaw3?= =?us-ascii?Q?u+P1htWICmKjnmDu+kUPGWDJXo7wi71jawt8OveLid9TIxfsaEeRLom8sCie?= =?us-ascii?Q?7G2B2jLopGCkf/EjM7omKVOqJ4tLyxFW4u+ib0mggjn3Vnh8R6PkAHCJg7KJ?= =?us-ascii?Q?P3wKvovYse0NbSXsNd6G2Vxq0vfoL3ZFBuZRHlOKbJPujWGDEA=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 06:29:23.9209 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b4287da4-f10d-42a7-caf7-08dd021a2f3c 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF000055E1.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6635 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 23.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/30/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=b6d04ef865b12f884aaf475adc454184cefae753 Thanks. Xueming Li --- >From b6d04ef865b12f884aaf475adc454184cefae753 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Fri, 17 Nov 2023 14:18:23 +0100 Subject: [PATCH] log: add a per line log helper Cc: Xueming Li [upstream commit ab550c1d6a0893f00198017a3a0e7cd402a667fd] gcc builtin __builtin_strchr can be used as a static assertion to check whether passed format strings contain a \n. This can be useful to detect double \n in log messages. Signed-off-by: David Marchand Acked-by: Stephen Hemminger Acked-by: Chengwen Feng --- devtools/checkpatches.sh | 8 ++++++++ lib/log/rte_log.h | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index 10b79ca2bc..10d1bf490b 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -53,6 +53,14 @@ print_usage () { check_forbidden_additions() { # res=0 + # refrain from new calls to RTE_LOG + awk -v FOLDERS="lib" \ + -v EXPRESSIONS="RTE_LOG\\\(" \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Prefer RTE_LOG_LINE' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + # refrain from new additions of rte_panic() and rte_exit() # multiple folders and expressions are separated by spaces awk -v FOLDERS="lib drivers" \ diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h index f7a8405de9..584cea541e 100644 --- a/lib/log/rte_log.h +++ b/lib/log/rte_log.h @@ -17,6 +17,7 @@ extern "C" { #endif +#include #include #include #include @@ -358,6 +359,26 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) : \ 0) +#if defined(RTE_TOOLCHAIN_GCC) && !defined(PEDANTIC) +#define RTE_LOG_CHECK_NO_NEWLINE(fmt) \ + static_assert(!__builtin_strchr(fmt, '\n'), \ + "This log format string contains a \\n") +#else +#define RTE_LOG_CHECK_NO_NEWLINE(...) +#endif + +#define RTE_LOG_LINE(l, t, ...) do { \ + RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \ + RTE_LOG(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \ + RTE_FMT_TAIL(__VA_ARGS__ ,))); \ +} while (0) + +#define RTE_LOG_DP_LINE(l, t, ...) do { \ + RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \ + RTE_LOG_DP(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \ + RTE_FMT_TAIL(__VA_ARGS__ ,))); \ +} while (0) + #define RTE_LOG_REGISTER_IMPL(type, name, level) \ int type; \ RTE_INIT(__##type) \ -- 2.34.1