Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Mar 2026 01:52:32 +0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a7182edc1025 - stable/15 - mlx5: postpone freeing the completed command entity to taskqueue
Message-ID:  <69c5e2e0.1ea8f.1329565@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=a7182edc1025e4e55bba3fa67a9c57896abc8cb9

commit a7182edc1025e4e55bba3fa67a9c57896abc8cb9
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-03-10 07:32:00 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-03-26 23:42:57 +0000

    mlx5: postpone freeing the completed command entity to taskqueue
    
    (cherry picked from commit f0d5f46a1e42b801d96447e544cc3820612748b1)
---
 sys/dev/mlx5/driver.h             |  1 +
 sys/dev/mlx5/mlx5_core/mlx5_cmd.c | 12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h
index cdefe7e013f6..ba6714c5c7b6 100644
--- a/sys/dev/mlx5/driver.h
+++ b/sys/dev/mlx5/driver.h
@@ -890,6 +890,7 @@ struct mlx5_cmd_work_ent {
 	u16			op;
 	u8			busy;
 	bool			polling;
+	struct work_struct	freew;
 };
 
 struct mlx5_pas {
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
index 86c721a83cb7..e314a04c294f 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
@@ -802,6 +802,15 @@ static void cb_timeout_handler(struct work_struct *work)
         mlx5_cmd_comp_handler(dev, 1UL << ent->idx, MLX5_CMD_MODE_EVENTS);
 }
 
+static void
+cmd_free_work(struct work_struct *work)
+{
+	struct mlx5_cmd_work_ent *ent = container_of(work,
+	    struct mlx5_cmd_work_ent, freew);
+
+	free_cmd(ent);
+}
+
 static void complete_command(struct mlx5_cmd_work_ent *ent)
 {
 	struct mlx5_cmd *cmd = ent->cmd;
@@ -856,7 +865,8 @@ static void complete_command(struct mlx5_cmd_work_ent *ent)
 		free_msg(dev, ent->in);
 
 		err = err ? err : ent->status;
-		free_cmd(ent);
+		INIT_WORK(&ent->freew, cmd_free_work);
+		schedule_work(&ent->freew);
 		callback(err, context);
 	} else {
 		complete(&ent->done);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69c5e2e0.1ea8f.1329565>