From patchwork Sun Apr 10 13:51:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 109555 X-Patchwork-Delegate: david.marchand@redhat.com 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 A8564A00BE; Sun, 10 Apr 2022 15:52:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3B33340685; Sun, 10 Apr 2022 15:52:51 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2084.outbound.protection.outlook.com [40.107.22.84]) by mails.dpdk.org (Postfix) with ESMTP id 786A540042 for ; Sun, 10 Apr 2022 15:52:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GV5g80xx1X0pCji+dhcs6LKRIMB7if7zFtQHDrMoBIRy1H2gaed79DR54jFms0ogbsYDiEnfzcUBy8euOC+XQ8HbiWN1WddlfDm7S1V1i+3LDmRxtXtLuGDOBl/WYUd4IaQJ4GpJ5FWIn78/3SEdiHKSsG+uEreKz4dCsRihy6oxfn/c91CP0PM+DzNwQmNy/LlmVWmN31gX1ORhX26rRJl63C+dm28LwUaYgsXYV1nnoKLWIqRFqJqmUgAq4B2AwFoFvNZyApQn6ei5OGBVAOa42DJha/hz7nf5eYBpat+TyqXo3A0dhcOnSUiqv8rRTBN4e+rCsGnW2WHsGsws2A== 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=sDAD7K0btR9DkGH+ZGLgNC8vzjsCRJN2/dL38FbKxAc=; b=Ohb0sIkvSY+HsbIeaCy3FTNYsaotblymLVGEFfnIs3tiJOkEjGFflbYGgWEKqLspDLoIe56B4yT/V6qdhd6hI7kNvgRduWieuUkoHFrLxMxZ2xFwmdyKz2YJ6CI3HwuoNDMM70HjcSQrzgho2vfOodu4hiSM/nRDcoUWEJ9/iZRE6bkvjYktqlZR7RMA1at5JStcJEICI2XTPqBviwSrBqX0EP0Lp40c0t+Uu5XoXHCiWSL7/ox7oBDJuyYeLTFw+CykTS5wT1Tc9S57QQNEIb9cYZSmwYp0aJagSKhm9HN3oWU6z2gcNJKVtGbXP+TJlkR8Y57L2ggsQHVkA4bFlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sDAD7K0btR9DkGH+ZGLgNC8vzjsCRJN2/dL38FbKxAc=; b=ulYS/ymZVvF8XSrl1NUPtvDk5Or3TPdN3r+sGb/YLQbDWAAcwaZ9nKmJ+TXg2H/3zVFIgMffojUmh1DWuOPc94U/LDai5j6QxLpPdeZzrgN5GFuhs6FrEnarWIDIoViOwbI2gGdKIBjDMPFLYuyUcTKrlMTT4+IOl1YQe3Aa8NE= Received: from AM5PR0601CA0046.eurprd06.prod.outlook.com (2603:10a6:203:68::32) by AM4PR0701MB2116.eurprd07.prod.outlook.com (2603:10a6:200:4a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.16; Sun, 10 Apr 2022 13:52:47 +0000 Received: from AM5EUR02FT072.eop-EUR02.prod.protection.outlook.com (2603:10a6:203:68:cafe::18) by AM5PR0601CA0046.outlook.office365.com (2603:10a6:203:68::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29 via Frontend Transport; Sun, 10 Apr 2022 13:52:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by AM5EUR02FT072.mail.protection.outlook.com (10.152.9.3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5144.20 via Frontend Transport; Sun, 10 Apr 2022 13:52:46 +0000 Received: from ESESSMB504.ericsson.se (153.88.183.165) by ESESBMR501.ericsson.se (153.88.183.129) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Sun, 10 Apr 2022 15:52:46 +0200 Received: from seliiuapp00218.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.192) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Sun, 10 Apr 2022 15:52:46 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliiuapp00218.seli.gic.ericsson.se (Postfix) with ESMTP id 6D794601CB; Sun, 10 Apr 2022 15:52:46 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: Thomas Monjalon , David Marchand , , , , =?utf-8?q?Mattias_R?= =?utf-8?q?=C3=B6nnblom?= Subject: [RFC 1/3] eal: add macro to warn for unused function return values Date: Sun, 10 Apr 2022 15:51:38 +0200 Message-ID: <20220410135140.161842-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62013b02-9a85-40f3-6f46-08da1af96505 X-MS-TrafficTypeDiagnostic: AM4PR0701MB2116:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BogITDHYEBWx4OVT/dJcUMMNafjt8KAd2HFWdyGq9u1KaWFN5ubVAaDe3Diq7F1NkglvtwRmRUkxWlC7UXQ6SzBWqKZtb++VIMWfilyF3WvqTIvyeZW9lKGzP8Dhmt6NazAQQEb6cGamphjsSaeU7rHiCQ6xEGAbtw2pmdTXFSWhvLfiYpD9M4Pw0I3z2Nukw+iAeEzWXnZX+rxT8tQV6x49164xcta14Cw7RN/nk50hGOzH0di0IiGumVLOT0M5gmcMY7eX9iTu0mQyy7WLcfi6cxL/54u8/BUHkWCgGLruufHtqeziizEBFLb/K7+fOH2M5sy6/h1Vf9tysVSi4YkvCPmBCvrM/TJk9fg7gwE57E0s1NOgpFu9I2tamn6qtTX2UI71Ph/5GVXQsTptPHSqFOgdv+GY7iws7+XFcb5q+rvm9rvasruuiO+j/kXe280Fv1Cv6LVZyRu6c8WBdhAbPCMqnJ6gtKaSN8LIwby3vPDRWLXNQYjHVAbISdoloEAijrI6U6hmB5KKNnQSnk6RpO9364Zkzub+JzYUfFh8lqyFP7A3vsoqULn3z2LG0SkuqJynsOiiYQLNG4hiQ2ErVGGfPA8sgYlH0wkuPFRkk0WFi8KkLbsHz3wdwtoT1vG2XVTMMM8vKXklnQG7hKj6sb9X8RBZvKf9/ZdpclIbVxQAd83+9s/tnPzHj2UrhB4G96VVOypBIxFbD/FKGA== X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(1076003)(107886003)(2616005)(34020700004)(70586007)(70206006)(83380400001)(8676002)(4326008)(336012)(26005)(186003)(6266002)(66574015)(86362001)(47076005)(508600001)(5660300002)(36756003)(54906003)(8936002)(82960400001)(4744005)(356005)(82310400005)(7636003)(316002)(36860700001)(40460700003)(6916009)(6666004)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2022 13:52:46.9599 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62013b02-9a85-40f3-6f46-08da1af96505 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT072.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0701MB2116 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 This patch adds a wrapper macro __rte_warn_unused_result for the warn_unused_result function attribute. Marking a function __rte_warn_unused_result will make the compiler emit a warning in case the caller does not use the function's return value. Signed-off-by: Mattias Rönnblom Reviewed-by: Morten Brørup --- lib/eal/include/rte_common.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 4a399cc7c8..544e7de2e7 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -222,6 +222,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) */ #define __rte_noreturn __attribute__((noreturn)) +/** + * Issue warning in case the function's return value is ignore + */ +#define __rte_warn_unused_result __attribute__((warn_unused_result)) + /** * Force a function to be inlined */ From patchwork Sun Apr 10 13:51:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 109556 X-Patchwork-Delegate: david.marchand@redhat.com 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 00397A00BE; Sun, 10 Apr 2022 15:52:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D95C7410F6; Sun, 10 Apr 2022 15:52:57 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140045.outbound.protection.outlook.com [40.107.14.45]) by mails.dpdk.org (Postfix) with ESMTP id C2AC240042 for ; Sun, 10 Apr 2022 15:52:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mXEpMEpPStq7CCAID7QzPlHCbMVwoc0Y2Cvutrwdk5uDx8ch7NIDlVbMW8XfRDjcMQypA6cKhyeCVCcXRkXF+ksIRfqmShgDeMt8aFKdoi8DCfLntoNzFu+Wlz3ahETYasHzjUWDUvbkXSLnu3v9H/+mS0qhX3T4Epgb6HcnUyTSLC/iF8QPJKdKXElK0keql8ks5x1PY7TVx5sEYuShSOUab7LzIVDPk1BXvc1wJ3HpeWMkI99TJuC7/5KRCKhX8DRtQWPQMCkuYcirDcUipT8dUgh/nZqrFaZSDvibYd/CgMo4A3D6PaICDriVVdOm5i1l/ahxsTBYYb8Ya+DJcg== 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=2qlmkWimIBctx47lWnPfIHW8NMKMbKlpDqe9RmA18hg=; b=CMmBNSf0mkgTWVCFD0mahaClSv/PlHy5kmWWGF5XmKkPZol0p/jCQKahAJQzss4fIFypqW5/zZuK3jLEJmOgSzZL38Y58pR8dif0a0w0/I+Me1nKm7vI7GLrnYdKsQtOhb+33KMVE6wShEnMSVimh9sE5rIFO/TxrVyCAyZTIXmLHpBGcbAodl0JC6RYOLCGcax9Tz/P8Z5/i29SdS+4DOQtlHrFd2CZWGCxpZuNwUP0QAmXikvhrhzZZbkOsooVNS6cDQ+DstYI12QJO5Wj03Bf1WLkwCtbkM/n27RtvCo/MmzTANYZyvuLLqIrE0JUfVjKUaDhPNoP+uSA6gNMGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2qlmkWimIBctx47lWnPfIHW8NMKMbKlpDqe9RmA18hg=; b=RvUfSzlEkuSaMvIxbhCsK+DPi+Y/NgzA1KEa7FXkBfr8/oiHYQDSlSIcTtv6lDp6AuPUCiOvfC9TOmEPTdxGRNYmtRZhxa1pqvTnRwoNCQq0UfLaRSkKXDbwVmHJ6xJyxIvVqzIH3Yeu8f84CssGZOFTxclU1YnVLU0TouSdh/w= Received: from AM5PR1001CA0066.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:15::43) by HE1PR07MB3115.eurprd07.prod.outlook.com (2603:10a6:7:31::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Sun, 10 Apr 2022 13:52:55 +0000 Received: from VE1EUR02FT065.eop-EUR02.prod.protection.outlook.com (2603:10a6:206:15:cafe::b1) by AM5PR1001CA0066.outlook.office365.com (2603:10a6:206:15::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29 via Frontend Transport; Sun, 10 Apr 2022 13:52:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by VE1EUR02FT065.mail.protection.outlook.com (10.152.13.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5144.20 via Frontend Transport; Sun, 10 Apr 2022 13:52:54 +0000 Received: from ESESSMB505.ericsson.se (153.88.183.166) by ESESSMR503.ericsson.se (153.88.183.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Sun, 10 Apr 2022 15:52:54 +0200 Received: from ESESBMB503.ericsson.se (153.88.183.170) by ESESSMB505.ericsson.se (153.88.183.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Sun, 10 Apr 2022 15:52:54 +0200 Received: from seliiuapp00218.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.186) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Sun, 10 Apr 2022 15:52:53 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliiuapp00218.seli.gic.ericsson.se (Postfix) with ESMTP id 44A4E601CB; Sun, 10 Apr 2022 15:52:54 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: Thomas Monjalon , David Marchand , , , , =?utf-8?q?Mattias_R?= =?utf-8?q?=C3=B6nnblom?= Subject: [RFC 2/3] eal: emit warning for unused trylock return value Date: Sun, 10 Apr 2022 15:51:39 +0200 Message-ID: <20220410135140.161842-2-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220410135140.161842-1-mattias.ronnblom@ericsson.com> References: <20220410135140.161842-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 189d6775-959b-4e5b-8804-08da1af969cd X-MS-TrafficTypeDiagnostic: HE1PR07MB3115:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +EKig2DEAism31yxF0tFBfZUECC3ssXN4m9lbcMmrwrfyzkM8QtmAUfKviybEOxr3Jz4MNgDZmprYrznZeywkj6htnXyxI07vwiHozd+iLhJX8toawYbwV1ReiBRSPBaf/lGQaXa/4PRyr7mOAK7m0CpELJwLeCFaHAEegVOZYESFhsaGM8+yW9QQH8Ytkzuf5RrFCxq/crKsWA+8cpefeenX/lBDUI7WG8/8ZVgQm8OSxdqddMU2GFvQCY6eego2rH2KAt2/kbaBJnj0Nm8BT/Hh7I4AwACcipHyPp27VZkduaAL/oVao29Zcu6kd6611LJSQGMbjXGTd+NI8H4OypU9E5s9AbgpWOVnUR4B4Icq8+aXmJ9q/7t0auiaqdW2y9H0bOqTIDnFXDA4Z0pqm7gxEZxy4emzBC7rFiBZXyl1Yn8ISNJ1qNsf56/NSsI4nfQoL11VSOeOdiJ5poN39edmOGND+Q+PgTXlPxb48SrEWduxR7yIdT1koC22g3D0I2zZaPRLmK9C5dRInepz3LZ0xLp5EMjB/M0dGdaVWzyUv6FaJqQsra5vE+BZDk3XUeJKd3089cVpyrvcWMeDwfE7ftmZ+t4kgOSxurFAA+6TwNP39fMoCHPPXKxVPTbaDo3C4xy7+kNySjSCVOZuxNo8JZDODQ1TlVsazE3J5pQmm8YD/LhK2GIniJUL5fIXON94z1VIBXkbPp0eu9r+g== X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(7636003)(83380400001)(66574015)(336012)(34020700004)(36860700001)(47076005)(36756003)(4326008)(8676002)(82310400005)(70586007)(70206006)(356005)(508600001)(82960400001)(107886003)(1076003)(2616005)(5660300002)(6666004)(6266002)(26005)(186003)(316002)(86362001)(2906002)(8936002)(54906003)(40460700003)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2022 13:52:54.9977 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 189d6775-959b-4e5b-8804-08da1af969cd X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR02FT065.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB3115 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 Mark the trylock family of spinlock functions with __rte_warn_unused_result. Signed-off-by: Mattias Rönnblom --- lib/eal/include/generic/rte_spinlock.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/eal/include/generic/rte_spinlock.h b/lib/eal/include/generic/rte_spinlock.h index 40fe49d5ad..73ed4bfbdc 100644 --- a/lib/eal/include/generic/rte_spinlock.h +++ b/lib/eal/include/generic/rte_spinlock.h @@ -97,6 +97,7 @@ rte_spinlock_unlock (rte_spinlock_t *sl) * @return * 1 if the lock is successfully taken; 0 otherwise. */ +__rte_warn_unused_result static inline int rte_spinlock_trylock (rte_spinlock_t *sl); @@ -174,6 +175,7 @@ rte_spinlock_unlock_tm(rte_spinlock_t *sl); * 1 if the hardware memory transaction is successfully started * or lock is successfully taken; 0 otherwise. */ +__rte_warn_unused_result static inline int rte_spinlock_trylock_tm(rte_spinlock_t *sl); @@ -243,6 +245,7 @@ static inline void rte_spinlock_recursive_unlock(rte_spinlock_recursive_t *slr) * @return * 1 if the lock is successfully taken; 0 otherwise. */ +__rte_warn_unused_result static inline int rte_spinlock_recursive_trylock(rte_spinlock_recursive_t *slr) { int id = rte_gettid(); @@ -299,6 +302,7 @@ static inline void rte_spinlock_recursive_unlock_tm( * 1 if the hardware memory transaction is successfully started * or lock is successfully taken; 0 otherwise. */ +__rte_warn_unused_result static inline int rte_spinlock_recursive_trylock_tm( rte_spinlock_recursive_t *slr); From patchwork Sun Apr 10 13:51:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 109557 X-Patchwork-Delegate: david.marchand@redhat.com 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 D6D40A00BE; Sun, 10 Apr 2022 15:53:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 41720410E0; Sun, 10 Apr 2022 15:53:05 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10068.outbound.protection.outlook.com [40.107.1.68]) by mails.dpdk.org (Postfix) with ESMTP id D76F140DDB for ; Sun, 10 Apr 2022 15:53:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UO8cS1WSaWr354swYtUHBGienc+ieKhcsmXHl3or964cRjc0JVLNuvuIDPxfykgL4a16wqS9Q+GdWieaIjj4gEpUzKDmoCkNc/1kb7pLKChbZSLjYOJWczFsWQK3IycfZZdDdSqUww5tqSm1YrON48ktfWBxAmHwHzoShkX1UnlGq4P0Tyfq0cbgqiRMHZIHbDZKZcN1LGdtWLJCa9Wiz39vx7uT5VivRPX9c5Gk+/poiBr2rVUdMaVrF44uLHPZYQv46jNDb+wOieBhojbvUJtTOyyeyw7CoFKuH8zKnjNnoXrkfl7k4DmQU9oCxxj+ulGy9Sf2SedyBFxBsm4eNQ== 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=AktmK6NPwf7ZsqIFtOkJEC3Gqt5HF2QHO71Qn9QmkGA=; b=iESwaRcYv/lvq+fQ4QnpDlvJxlReW7RPSdNYcvbiVcqCKeU98GNTqtazzOiHwGijaY7r+YsbTQkixNcDd0xbxSXYEThrF/Ao4kWfLV0hwt8dwSSbgolN7amNkgdKjLxJRwvOsHzkQ1CIkeEO5+R+Xn+/vQs5kRXT4tTlrGf9mb1s6TDS5rADQ6MLPLaCNF3iUOJ71V4AaSW73ke1dGKdpqZRIx8W5Peojc/6YSIdAs7TCq9zduAMrfavS4q0lNhaOmFv2I4FcgoVLgEWQt6uw96RHSGAJpvDMM5Axn6r72FEPwIm/zd1lCTEbn/W4xomFjrBnAsJW1DTXzWzUHKOSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AktmK6NPwf7ZsqIFtOkJEC3Gqt5HF2QHO71Qn9QmkGA=; b=YgkW/vbvqpVymyjLbAIF2J2g8rzbp/xCMKycckLNVXfKTfxplBCmE+21jo6WJAbDsq3Zzm0446os5KrpIU+ED+qffLrcB+1dDI3v3JQfb0kgNS6NyPzQGmEINsw1xQA/khjWLlCKUuYA3k85LFhgq16MTrxoIU409Vowk9D6Luk= Received: from AM6PR0202CA0050.eurprd02.prod.outlook.com (2603:10a6:20b:3a::27) by DBAPR07MB6712.eurprd07.prod.outlook.com (2603:10a6:10:189::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.16; Sun, 10 Apr 2022 13:53:00 +0000 Received: from VE1EUR02FT043.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:3a:cafe::43) by AM6PR0202CA0050.outlook.office365.com (2603:10a6:20b:3a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29 via Frontend Transport; Sun, 10 Apr 2022 13:53:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by VE1EUR02FT043.mail.protection.outlook.com (10.152.13.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5144.20 via Frontend Transport; Sun, 10 Apr 2022 13:53:00 +0000 Received: from ESESBMB501.ericsson.se (153.88.183.168) by ESESBMR502.ericsson.se (153.88.183.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Sun, 10 Apr 2022 15:52:59 +0200 Received: from seliiuapp00218.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.184) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Sun, 10 Apr 2022 15:52:59 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliiuapp00218.seli.gic.ericsson.se (Postfix) with ESMTP id 8E3F1601CB; Sun, 10 Apr 2022 15:52:59 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: Thomas Monjalon , David Marchand , , , , =?utf-8?q?Mattias_R?= =?utf-8?q?=C3=B6nnblom?= , Subject: [RFC 3/3] examples/bond: fix invalid use of trylock Date: Sun, 10 Apr 2022 15:51:40 +0200 Message-ID: <20220410135140.161842-3-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220410135140.161842-1-mattias.ronnblom@ericsson.com> References: <20220410135140.161842-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58c77d29-92d1-4e35-d8fd-08da1af96ce5 X-MS-TrafficTypeDiagnostic: DBAPR07MB6712:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 79Lwo27fFSYtIxvj9Ygih9HBzanpIxLwljsSxbHeJB4fZHehar8J1aFiL0Od5Vo4lFVTIEz2G5IWQxiFu/y7vfTfNV+OYWoqvrYTpd/0jbLoF+eY48fgbqF6w13eZR7OdbZd6HWORyU788OWbrYIl6ggXsxuWHp/9AtU2EIHWPfeg35O1tyESfTp+MPg+yxAQOSFPJo38izxb0xB6SsGMmoAabJwvNOBZVIs30PI7WMwKRk7LL2LbWgkfCM+qJLQkApw5rMemgysajz339uUakBTiepfq1HrfWOQA9y9SXsVC64muhUqWLt7xMotx8IsYoDKgN2izpS06winmpqUJtmFEzkpCFS25w0K8qZWoId1AvmMZ+Xsg/EonyU0Vr7jbM2hMVGwVQNH4oX3VLuFMPjv1vQlDhVKV8V9/mk3bG8Li/5fslgBHwUPI7nboSrMSIZ0qrFGytD0nzTqClkSYt/UBYLniq+HJMFhhnYam0rPzCXr7M9Toai5Tu8d/REYKHeyH45SHHkoFHk2T4c30DPydRDHXdeudtOLzNBIFXLZ/4+YEvXXfjpwhyH9jpDtp16ttQEj7PACs7FidpVLFjj9OhX5uIAkD+wK57njMlz/ZLg+ez2Lybf+dpTt4j2QlDvMVH3yfj1RBKO7yI9OG2udnmEC1EFIwpM2aAx9hi4Mgk8tPDzylLZRdjME4lTpqVTu0AhA+z62biq3juJgp6u21BuXrjFmUkWw1NUzALQ9leIzLX8eEtGHYBDPa3hwvpodkyLQ56EvE7yRAEoDYQ== X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(82310400005)(34020700004)(40460700003)(47076005)(66574015)(36860700001)(336012)(36756003)(2906002)(82960400001)(186003)(1076003)(6266002)(2616005)(26005)(356005)(7636003)(83380400001)(70586007)(6916009)(70206006)(54906003)(5660300002)(8936002)(508600001)(4326008)(8676002)(86362001)(316002)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2022 13:53:00.1903 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58c77d29-92d1-4e35-d8fd-08da1af96ce5 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR02FT043.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR07MB6712 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 conditional rte_spinlock_trylock() was used as if it is an unconditional lock operation in a number of places. Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6") Cc: michalx.k.jastrzebski@intel.com Signed-off-by: Mattias Rönnblom Acked-by: Min Hu (Connor) --- examples/bond/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/bond/main.c b/examples/bond/main.c index 335bde5c8d..4efebb3902 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -373,7 +373,7 @@ static int lcore_main(__rte_unused void *arg1) bond_ip = BOND_IP_1 | (BOND_IP_2 << 8) | (BOND_IP_3 << 16) | (BOND_IP_4 << 24); - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); while (global_flag_stru_p->LcoreMainIsRunning) { rte_spinlock_unlock(&global_flag_stru_p->lock); @@ -456,7 +456,7 @@ static int lcore_main(__rte_unused void *arg1) if (is_free == 0) rte_pktmbuf_free(pkts[i]); } - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); } rte_spinlock_unlock(&global_flag_stru_p->lock); printf("BYE lcore_main\n"); @@ -571,7 +571,7 @@ static void cmd_start_parsed(__rte_unused void *parsed_result, { int worker_core_id = rte_lcore_id(); - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); if (global_flag_stru_p->LcoreMainIsRunning == 0) { if (rte_eal_get_lcore_state(global_flag_stru_p->LcoreMainCore) != WAIT) { @@ -591,7 +591,7 @@ static void cmd_start_parsed(__rte_unused void *parsed_result, if ((worker_core_id >= RTE_MAX_LCORE) || (worker_core_id == 0)) return; - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); global_flag_stru_p->LcoreMainIsRunning = 1; rte_spinlock_unlock(&global_flag_stru_p->lock); cmdline_printf(cl, @@ -659,7 +659,7 @@ static void cmd_stop_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data) { - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); if (global_flag_stru_p->LcoreMainIsRunning == 0) { cmdline_printf(cl, "lcore_main not running on core:%d\n", @@ -700,7 +700,7 @@ static void cmd_quit_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data) { - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); if (global_flag_stru_p->LcoreMainIsRunning == 0) { cmdline_printf(cl, "lcore_main not running on core:%d\n", @@ -762,7 +762,7 @@ static void cmd_show_parsed(__rte_unused void *parsed_result, printf("\n"); } - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); cmdline_printf(cl, "Active_slaves:%d " "packets received:Tot:%d Arp:%d IPv4:%d\n",