* [PATCH] eal: prevent socket closure before MP sync
@ 2025-03-14 10:36 Yang Ming
2025-03-17 13:56 ` Stephen Hemminger
2025-04-07 5:25 ` [PATCH v2 1/2] " Yang Ming
0 siblings, 2 replies; 6+ messages in thread
From: Yang Ming @ 2025-03-14 10:36 UTC (permalink / raw)
To: Morten Brørup, Bruce Richardson, Kevin Laatz; +Cc: dev, Yang Ming, stable
The secordary process should not close socket file for MP
channel before performing MP request synchronization.
This prevents error logs when the secondary process exits
without any operation on the crypto device while the primary
process starts the device.
Case situation:
eal_bus_cleanup has been added in rte_eal_cleanup. But for the
secondary process, rte_eal_cleanup firstly performs
rte_mp_channel_cleanup, which closes socket file for the MP
channel, making mp_fd invalid. Subsequently, eal_bus_cleanup
triggers vdev_cleanup, which calls mp_request_sync to send a
message via the MP channel. Since mp_fd is invalid, error logs
occur.
Error logs occur as below when the secordary process exit:
EAL: failed to send to (/tmp/dpdk/l2hicu/mp_socket) due to Bad
file descriptor
EAL: Fail to send request /tmp/dpdk/l2hicu/mp_socket:
ipsec_mb_mp_msg
USER1: Create MR request to primary process failed.
Function call trace:
1. rte_eal_cleanup->rte_mp_channel_cleanup->close_socket_fd
2. rte_eal_cleanup->eal_bus_cleanup->vdev_cleanup->
rte_vdev_driver->ipsec_mb_remove->ipsec_mb_qp_release->
ipsec_mb_secondary_qp_op->rte_mp_request_sync->mp_request_sync->
send_msg->sendmsg(mp_fd, &msgh, 0);
Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")
Cc: kevin.laatz@intel.com
Cc: stable@dpdk.org
Signed-off-by: Yang Ming <ming.1.yang@nokia-sbell.com>
---
lib/eal/linux/eal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index b1e63e37fc..73ea47b12d 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1318,11 +1318,11 @@ rte_eal_cleanup(void)
rte_memseg_walk(mark_freeable, NULL);
rte_service_finalize();
+ eal_bus_cleanup();
#ifdef VFIO_PRESENT
vfio_mp_sync_cleanup();
#endif
rte_mp_channel_cleanup();
- eal_bus_cleanup();
rte_trace_save();
eal_trace_fini();
eal_mp_dev_hotplug_cleanup();
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] eal: prevent socket closure before MP sync
2025-03-14 10:36 [PATCH] eal: prevent socket closure before MP sync Yang Ming
@ 2025-03-17 13:56 ` Stephen Hemminger
2025-03-27 9:28 ` [External] " Yang Ming
2025-04-07 5:25 ` [PATCH v2 1/2] " Yang Ming
1 sibling, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2025-03-17 13:56 UTC (permalink / raw)
To: Yang Ming; +Cc: Morten Brørup, Bruce Richardson, Kevin Laatz, dev, stable
On Fri, 14 Mar 2025 18:36:38 +0800
Yang Ming <ming.1.yang@nokia-sbell.com> wrote:
> The secordary process should not close socket file for MP
> channel before performing MP request synchronization.
> This prevents error logs when the secondary process exits
> without any operation on the crypto device while the primary
> process starts the device.
>
> Case situation:
> eal_bus_cleanup has been added in rte_eal_cleanup. But for the
> secondary process, rte_eal_cleanup firstly performs
> rte_mp_channel_cleanup, which closes socket file for the MP
> channel, making mp_fd invalid. Subsequently, eal_bus_cleanup
> triggers vdev_cleanup, which calls mp_request_sync to send a
> message via the MP channel. Since mp_fd is invalid, error logs
> occur.
>
> Error logs occur as below when the secordary process exit:
> EAL: failed to send to (/tmp/dpdk/l2hicu/mp_socket) due to Bad
> file descriptor
> EAL: Fail to send request /tmp/dpdk/l2hicu/mp_socket:
> ipsec_mb_mp_msg
> USER1: Create MR request to primary process failed.
>
> Function call trace:
> 1. rte_eal_cleanup->rte_mp_channel_cleanup->close_socket_fd
> 2. rte_eal_cleanup->eal_bus_cleanup->vdev_cleanup->
> rte_vdev_driver->ipsec_mb_remove->ipsec_mb_qp_release->
> ipsec_mb_secondary_qp_op->rte_mp_request_sync->mp_request_sync->
> send_msg->sendmsg(mp_fd, &msgh, 0);
>
> Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")
> Cc: kevin.laatz@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Yang Ming <ming.1.yang@nokia-sbell.com>
Looks good, could there be a test?
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Re: [PATCH] eal: prevent socket closure before MP sync
2025-03-17 13:56 ` Stephen Hemminger
@ 2025-03-27 9:28 ` Yang Ming
2025-04-07 3:52 ` Yang Ming
0 siblings, 1 reply; 6+ messages in thread
From: Yang Ming @ 2025-03-27 9:28 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Morten Brørup, Bruce Richardson, Kevin Laatz, dev, stable
On 2025/3/17 21:56, Stephen Hemminger wrote:
> Caution: This is an external email. Please be very careful when clicking links or opening attachments. See http://nok.it/nsb for additional information.
>
> On Fri, 14 Mar 2025 18:36:38 +0800
> Yang Ming <ming.1.yang@nokia-sbell.com> wrote:
>
>> The secordary process should not close socket file for MP
>> channel before performing MP request synchronization.
>> This prevents error logs when the secondary process exits
>> without any operation on the crypto device while the primary
>> process starts the device.
>>
>> Case situation:
>> eal_bus_cleanup has been added in rte_eal_cleanup. But for the
>> secondary process, rte_eal_cleanup firstly performs
>> rte_mp_channel_cleanup, which closes socket file for the MP
>> channel, making mp_fd invalid. Subsequently, eal_bus_cleanup
>> triggers vdev_cleanup, which calls mp_request_sync to send a
>> message via the MP channel. Since mp_fd is invalid, error logs
>> occur.
>>
>> Error logs occur as below when the secordary process exit:
>> EAL: failed to send to (/tmp/dpdk/l2hicu/mp_socket) due to Bad
>> file descriptor
>> EAL: Fail to send request /tmp/dpdk/l2hicu/mp_socket:
>> ipsec_mb_mp_msg
>> USER1: Create MR request to primary process failed.
>>
>> Function call trace:
>> 1. rte_eal_cleanup->rte_mp_channel_cleanup->close_socket_fd
>> 2. rte_eal_cleanup->eal_bus_cleanup->vdev_cleanup->
>> rte_vdev_driver->ipsec_mb_remove->ipsec_mb_qp_release->
>> ipsec_mb_secondary_qp_op->rte_mp_request_sync->mp_request_sync->
>> send_msg->sendmsg(mp_fd, &msgh, 0);
>>
>> Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")
>> Cc: kevin.laatz@intel.com
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Yang Ming <ming.1.yang@nokia-sbell.com>
> Looks good, could there be a test?
>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
>
Hi Thanks Stephen,
We have some findings for this change in our product test line. I will
do more investigation for this patch.
Brs,
Yang Ming
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Re: [PATCH] eal: prevent socket closure before MP sync
2025-03-27 9:28 ` [External] " Yang Ming
@ 2025-04-07 3:52 ` Yang Ming
0 siblings, 0 replies; 6+ messages in thread
From: Yang Ming @ 2025-04-07 3:52 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Morten Brørup, Bruce Richardson, Kevin Laatz, dev, stable
On 2025/3/27 17:28, Yang Ming wrote:
>
> On 2025/3/17 21:56, Stephen Hemminger wrote:
>> Caution: This is an external email. Please be very careful when
>> clicking links or opening attachments. See http://nok.it/nsb for
>> additional information.
>>
>> On Fri, 14 Mar 2025 18:36:38 +0800
>> Yang Ming <ming.1.yang@nokia-sbell.com> wrote:
>>
>>> The secordary process should not close socket file for MP
>>> channel before performing MP request synchronization.
>>> This prevents error logs when the secondary process exits
>>> without any operation on the crypto device while the primary
>>> process starts the device.
>>>
>>> Case situation:
>>> eal_bus_cleanup has been added in rte_eal_cleanup. But for the
>>> secondary process, rte_eal_cleanup firstly performs
>>> rte_mp_channel_cleanup, which closes socket file for the MP
>>> channel, making mp_fd invalid. Subsequently, eal_bus_cleanup
>>> triggers vdev_cleanup, which calls mp_request_sync to send a
>>> message via the MP channel. Since mp_fd is invalid, error logs
>>> occur.
>>>
>>> Error logs occur as below when the secordary process exit:
>>> EAL: failed to send to (/tmp/dpdk/l2hicu/mp_socket) due to Bad
>>> file descriptor
>>> EAL: Fail to send request /tmp/dpdk/l2hicu/mp_socket:
>>> ipsec_mb_mp_msg
>>> USER1: Create MR request to primary process failed.
>>>
>>> Function call trace:
>>> 1. rte_eal_cleanup->rte_mp_channel_cleanup->close_socket_fd
>>> 2. rte_eal_cleanup->eal_bus_cleanup->vdev_cleanup->
>>> rte_vdev_driver->ipsec_mb_remove->ipsec_mb_qp_release->
>>> ipsec_mb_secondary_qp_op->rte_mp_request_sync->mp_request_sync->
>>> send_msg->sendmsg(mp_fd, &msgh, 0);
>>>
>>> Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")
>>> Cc: kevin.laatz@intel.com
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Yang Ming <ming.1.yang@nokia-sbell.com>
>> Looks good, could there be a test?
>>
>> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
>>
> Hi Thanks Stephen,
>
> We have some findings for this change in our product test line. I will
> do more investigation for this patch.
>
> Brs,
>
> Yang Ming
>
>
Hi,
This patch has been tested and functions correctly under normal
conditions. However, during testing, we observed some new error logs in
specific cases. Upon investigation, we identified that these logs
originate from a separate issue, which will be addressed in the next
version of this patch. Additionally, a similar issue may affect FreeBSD,
and I plan to include a fix for that as well in the upcoming patch
series. Please note that the entire patch series has been thoroughly tested.
Brs,
Yang Ming
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] eal: prevent socket closure before MP sync
2025-03-14 10:36 [PATCH] eal: prevent socket closure before MP sync Yang Ming
2025-03-17 13:56 ` Stephen Hemminger
@ 2025-04-07 5:25 ` Yang Ming
2025-04-07 5:25 ` [PATCH v2 2/2] crypto/ipsec_mb: fix QP release in secondary Yang Ming
1 sibling, 1 reply; 6+ messages in thread
From: Yang Ming @ 2025-04-07 5:25 UTC (permalink / raw)
To: dev; +Cc: Yang Ming, kevin.laatz, stable
The secordary process should not close socket file for MP
channel before performing MP request synchronization.
This prevents error logs when the secondary process exits
without any operation on the crypto device while the primary
process starts the device.
Case situation:
eal_bus_cleanup has been added in rte_eal_cleanup. But for the
secondary process, rte_eal_cleanup firstly performs
rte_mp_channel_cleanup, which closes socket file for the MP
channel, making mp_fd invalid. Subsequently, eal_bus_cleanup
triggers vdev_cleanup, which calls mp_request_sync to send a
message via the MP channel. Since mp_fd is invalid, error logs
occur.
Error logs occur as below when the secordary process exit:
EAL: failed to send to (/tmp/dpdk/l2hicu/mp_socket) due to Bad
file descriptor
EAL: Fail to send request /tmp/dpdk/l2hicu/mp_socket:
ipsec_mb_mp_msg
USER1: Create MR request to primary process failed.
Function call trace:
1. rte_eal_cleanup->rte_mp_channel_cleanup->close_socket_fd
2. rte_eal_cleanup->eal_bus_cleanup->vdev_cleanup->
rte_vdev_driver->ipsec_mb_remove->ipsec_mb_qp_release->
ipsec_mb_secondary_qp_op->rte_mp_request_sync->mp_request_sync->
send_msg->sendmsg(mp_fd, &msgh, 0);
Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")
Cc: kevin.laatz@intel.com
Cc: stable@dpdk.org
Signed-off-by: Yang Ming <ming.1.yang@nokia-sbell.com>
---
lib/eal/freebsd/eal.c | 2 +-
lib/eal/linux/eal.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index d07cff8651..d81f12a7b1 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -899,8 +899,8 @@ rte_eal_cleanup(void)
struct internal_config *internal_conf =
eal_get_internal_configuration();
rte_service_finalize();
- rte_mp_channel_cleanup();
eal_bus_cleanup();
+ rte_mp_channel_cleanup();
rte_trace_save();
eal_trace_fini();
rte_eal_alarm_cleanup();
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index b1e63e37fc..73ea47b12d 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1318,11 +1318,11 @@ rte_eal_cleanup(void)
rte_memseg_walk(mark_freeable, NULL);
rte_service_finalize();
+ eal_bus_cleanup();
#ifdef VFIO_PRESENT
vfio_mp_sync_cleanup();
#endif
rte_mp_channel_cleanup();
- eal_bus_cleanup();
rte_trace_save();
eal_trace_fini();
eal_mp_dev_hotplug_cleanup();
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] crypto/ipsec_mb: fix QP release in secondary
2025-04-07 5:25 ` [PATCH v2 1/2] " Yang Ming
@ 2025-04-07 5:25 ` Yang Ming
0 siblings, 0 replies; 6+ messages in thread
From: Yang Ming @ 2025-04-07 5:25 UTC (permalink / raw)
To: dev; +Cc: myang
From: myang <ming.1.yang@nokia-sbell.com>
When a secondary process tries to release a queue pair (QP) that
does not belong to it, error logs occur:
CRYPTODEV: ipsec_mb_ipc_request() line 373: Unable to release
qp_id=0
EAL: Message data is too long
EAL: Fail to handle message: ipsec_mb_mp_msg
EAL: Fail to recv reply for request /tmp/dpdk/l2hi/mp_socket:
ipsec_mb_mp_msg
This patch ensures that a secondary process only frees a QP if
it actually owns it, preventing conflicts and resolving the
issue.
Signed-off-by: myang <ming.1.yang@nokia-sbell.com>
---
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 910efb1a97..50ee140ccd 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -138,6 +138,7 @@ int
ipsec_mb_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
{
struct ipsec_mb_qp *qp = dev->data->queue_pairs[qp_id];
+ uint16_t process_id = (uint16_t)getpid();
if (!qp)
return 0;
@@ -152,8 +153,10 @@ ipsec_mb_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
rte_free(qp);
dev->data->queue_pairs[qp_id] = NULL;
} else { /* secondary process */
- return ipsec_mb_secondary_qp_op(dev->data->dev_id, qp_id,
- NULL, 0, RTE_IPSEC_MB_MP_REQ_QP_FREE);
+ if (qp->qp_used_by_pid == process_id)
+ return ipsec_mb_secondary_qp_op(dev->data->dev_id,
+ qp_id, NULL, 0,
+ RTE_IPSEC_MB_MP_REQ_QP_FREE);
}
return 0;
}
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-04-07 5:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-14 10:36 [PATCH] eal: prevent socket closure before MP sync Yang Ming
2025-03-17 13:56 ` Stephen Hemminger
2025-03-27 9:28 ` [External] " Yang Ming
2025-04-07 3:52 ` Yang Ming
2025-04-07 5:25 ` [PATCH v2 1/2] " Yang Ming
2025-04-07 5:25 ` [PATCH v2 2/2] crypto/ipsec_mb: fix QP release in secondary Yang Ming
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).