From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: David Marchand <david.marchand@redhat.com>,
Anatoly Burakov <anatoly.burakov@intel.com>,
Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>,
stable@dpdk.org
Subject: [PATCH v4 5/9] net/ixgbe/base: fix lock checker errors
Date: Fri, 28 Mar 2025 11:16:17 +0000 [thread overview]
Message-ID: <20250328111621.2665257-6-bruce.richardson@intel.com> (raw)
In-Reply-To: <20250328111621.2665257-1-bruce.richardson@intel.com>
When building on FreeBSD, errors are reported in the base code by the
lock checker (-Wthread-safety). For example:
../drivers/net/intel/ixgbe/base/ixgbe_osdep.c:42:1: error: mutex 'lock->mutex' is still held at the end of function [-Werror,-Wthread-safety-analysis]
42 | }
| ^
These errors are due to the checker not recognising the lock wrapper
functions. We can avoid these errors by converting these functions into
macros. While converting the lock macros, we can also convert the memory
allocation functions too, which allows us to remove the osdep.c file
entirely from the build.
Fixes: 30b19d1b5c43 ("net/ixgbe/base: add definitions for E610")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/intel/ixgbe/base/ixgbe_osdep.c | 47 ----------------------
drivers/net/intel/ixgbe/base/ixgbe_osdep.h | 18 +++++----
drivers/net/intel/ixgbe/base/meson.build | 1 -
3 files changed, 10 insertions(+), 56 deletions(-)
delete mode 100644 drivers/net/intel/ixgbe/base/ixgbe_osdep.c
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.c b/drivers/net/intel/ixgbe/base/ixgbe_osdep.c
deleted file mode 100644
index d3d7e8e116..0000000000
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2024 Intel Corporation
- */
-
-#include <stdlib.h>
-
-#include <rte_common.h>
-
-#include "ixgbe_osdep.h"
-
-void *
-ixgbe_calloc(struct ixgbe_hw __rte_unused *hw, size_t count, size_t size)
-{
- return malloc(count * size);
-}
-
-void *
-ixgbe_malloc(struct ixgbe_hw __rte_unused *hw, size_t size)
-{
- return malloc(size);
-}
-
-void
-ixgbe_free(struct ixgbe_hw __rte_unused *hw, void *addr)
-{
- free(addr);
-}
-
-void ixgbe_init_lock(struct ixgbe_lock *lock)
-{
- pthread_mutex_init(&lock->mutex, NULL);
-}
-
-void ixgbe_destroy_lock(struct ixgbe_lock *lock)
-{
- pthread_mutex_destroy(&lock->mutex);
-}
-
-void ixgbe_acquire_lock(struct ixgbe_lock *lock)
-{
- pthread_mutex_lock(&lock->mutex);
-}
-
-void ixgbe_release_lock(struct ixgbe_lock *lock)
-{
- pthread_mutex_unlock(&lock->mutex);
-}
diff --git a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
index 398c38bffd..53d0422193 100644
--- a/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/intel/ixgbe/base/ixgbe_osdep.h
@@ -11,6 +11,8 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdbool.h>
+#include <malloc.h>
+
#include <rte_common.h>
#include <rte_debug.h>
#include <rte_cycles.h>
@@ -50,7 +52,7 @@
#define false 0
#define true 1
#ifndef RTE_EXEC_ENV_WINDOWS
-#define min(a,b) RTE_MIN(a,b)
+#define min(a,b) RTE_MIN(a,b)
#endif
#define EWARN(hw, S, ...) DEBUGOUT1(S, ##__VA_ARGS__)
@@ -163,13 +165,13 @@ struct ixgbe_lock {
pthread_mutex_t mutex;
};
-void *ixgbe_calloc(struct ixgbe_hw *hw, size_t count, size_t size);
-void *ixgbe_malloc(struct ixgbe_hw *hw, size_t size);
-void ixgbe_free(struct ixgbe_hw *hw, void *addr);
+#define ixgbe_calloc(hw, c, s) ((void)hw, calloc(c, s))
+#define ixgbe_malloc(hw, s) ((void)hw, malloc(s))
+#define ixgbe_free(hw, a) ((void)hw, free(a))
-void ixgbe_init_lock(struct ixgbe_lock *lock);
-void ixgbe_destroy_lock(struct ixgbe_lock *lock);
-void ixgbe_acquire_lock(struct ixgbe_lock *lock);
-void ixgbe_release_lock(struct ixgbe_lock *lock);
+#define ixgbe_init_lock(lock) pthread_mutex_init(&(lock)->mutex, NULL)
+#define ixgbe_destroy_lock(lock) pthread_mutex_destroy(&(lock)->mutex)
+#define ixgbe_acquire_lock(lock) pthread_mutex_lock(&(lock)->mutex)
+#define ixgbe_release_lock(lock) pthread_mutex_unlock(&(lock)->mutex)
#endif /* _IXGBE_OS_H_ */
diff --git a/drivers/net/intel/ixgbe/base/meson.build b/drivers/net/intel/ixgbe/base/meson.build
index 64e0bfd7be..2af8a55e92 100644
--- a/drivers/net/intel/ixgbe/base/meson.build
+++ b/drivers/net/intel/ixgbe/base/meson.build
@@ -12,7 +12,6 @@ sources = [
'ixgbe_e610.c',
'ixgbe_hv_vf.c',
'ixgbe_mbx.c',
- 'ixgbe_osdep.c',
'ixgbe_phy.c',
'ixgbe_vf.c',
'ixgbe_x540.c',
--
2.45.2
next prev parent reply other threads:[~2025-03-28 11:17 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
2025-03-26 15:52 ` [PATCH 1/7] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-26 15:52 ` [PATCH 2/7] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-26 15:52 ` [PATCH 3/7] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-26 15:52 ` [PATCH 4/7] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-26 15:52 ` [PATCH 5/7] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-26 15:52 ` [PATCH 6/7] net/ice/base: reduce warnings for unused variables Bruce Richardson
2025-03-26 15:52 ` [PATCH 7/7] net/intel: simplify base code builds Bruce Richardson
2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
2025-03-26 16:05 ` [PATCH v2 1/8] net/fm10k/base: fix compilation warnings Bruce Richardson
2025-03-26 16:05 ` [PATCH v2 2/8] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-26 16:05 ` [PATCH v2 3/8] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-26 16:05 ` [PATCH v2 4/8] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-26 16:05 ` [PATCH v2 5/8] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-26 16:05 ` [PATCH v2 6/8] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-26 16:05 ` [PATCH v2 7/8] net/ice/base: reduce warnings for unused variables Bruce Richardson
2025-03-26 16:05 ` [PATCH v2 8/8] net/intel: simplify base code builds Bruce Richardson
2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
2025-03-27 14:51 ` [PATCH v3 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
2025-03-27 14:51 ` [PATCH v3 2/9] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-27 14:51 ` [PATCH v3 3/9] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-27 14:51 ` [PATCH v3 4/9] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-27 14:51 ` [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors Bruce Richardson
2025-03-28 8:20 ` David Marchand
2025-03-28 10:43 ` Bruce Richardson
2025-03-28 11:13 ` Bruce Richardson
2025-03-28 11:48 ` David Marchand
2025-03-27 14:51 ` [PATCH v3 6/9] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-27 14:51 ` [PATCH v3 7/9] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-27 14:52 ` [PATCH v3 8/9] net/ice/base: reduce warnings for unused variables Bruce Richardson
2025-03-27 14:52 ` [PATCH v3 9/9] net/intel: simplify base code builds Bruce Richardson
2025-03-28 8:21 ` [PATCH v3 0/9] net/intel: clean up base code build David Marchand
2025-03-28 9:01 ` Bruce Richardson
2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
2025-03-28 11:16 ` [PATCH v4 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
2025-03-28 12:53 ` Burakov, Anatoly
2025-03-28 11:16 ` [PATCH v4 2/9] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-28 13:00 ` Burakov, Anatoly
2025-03-28 11:16 ` [PATCH v4 3/9] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-28 13:01 ` Burakov, Anatoly
2025-03-28 11:16 ` [PATCH v4 4/9] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-28 13:02 ` Burakov, Anatoly
2025-03-28 11:16 ` Bruce Richardson [this message]
2025-03-28 13:05 ` [PATCH v4 5/9] net/ixgbe/base: fix lock checker errors Burakov, Anatoly
2025-03-28 11:16 ` [PATCH v4 6/9] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-28 13:07 ` Burakov, Anatoly
2025-03-28 15:21 ` Andre Muezerie
2025-03-28 15:26 ` Bruce Richardson
2025-03-28 11:16 ` [PATCH v4 7/9] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-28 13:08 ` Burakov, Anatoly
2025-03-28 11:16 ` [PATCH v4 8/9] net/ice/base: reduce warnings for unused variables Bruce Richardson
2025-03-28 13:09 ` Burakov, Anatoly
2025-03-28 11:16 ` [PATCH v4 9/9] net/intel: simplify base code builds Bruce Richardson
2025-03-28 13:09 ` Burakov, Anatoly
2025-03-28 16:05 ` [PATCH v4 0/9] net/intel: clean up base code build Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250328111621.2665257-6-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--cc=vladimir.medvedkin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).