Bug 274715 - [ktls] deadlock with mlx5 and KTLS receive
Summary: [ktls] deadlock with mlx5 and KTLS receive
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-net (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-25 17:48 UTC by Martin Matuska
Modified: 2023-11-22 08:35 UTC (History)
1 user (show)

See Also:


Attachments
DDB thread 1 (186.47 KB, image/jpeg)
2023-10-25 17:49 UTC, Martin Matuska
no flags Details
DDB thread 2 (193.40 KB, image/jpeg)
2023-10-25 17:50 UTC, Martin Matuska
no flags Details
DDB lockchain (194.61 KB, image/jpeg)
2023-10-25 17:50 UTC, Martin Matuska
no flags Details
DDB trace (text) (3.57 KB, text/plain)
2023-10-25 18:09 UTC, Martin Matuska
no flags Details
DDB trace (text) (3.65 KB, text/plain)
2023-10-25 18:12 UTC, Martin Matuska
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Matuska freebsd_committer freebsd_triage 2023-10-25 17:48:24 UTC

    
Comment 1 Martin Matuska freebsd_committer freebsd_triage 2023-10-25 17:49:51 UTC
Created attachment 245864 [details]
DDB thread 1
Comment 2 Martin Matuska freebsd_committer freebsd_triage 2023-10-25 17:50:08 UTC
Created attachment 245865 [details]
DDB thread 2
Comment 3 Martin Matuska freebsd_committer freebsd_triage 2023-10-25 17:50:39 UTC
Created attachment 245866 [details]
DDB lockchain
Comment 4 Martin Matuska freebsd_committer freebsd_triage 2023-10-25 18:09:42 UTC
Created attachment 245867 [details]
DDB trace (text)
Comment 5 Martin Matuska freebsd_committer freebsd_triage 2023-10-25 18:12:23 UTC
Created attachment 245868 [details]
DDB trace (text)
Comment 6 Konstantin Belousov freebsd_committer freebsd_triage 2023-10-27 22:47:40 UTC
So who is the owner of the lock blocking other threads?

The min useful set of data for a deadlock is ddb 'show alllocks' and 'alltrace'.
Comment 7 Martin Matuska freebsd_committer freebsd_triage 2023-10-28 10:18:47 UTC
I have written a patch for review:
https://reviews.freebsd.org/D42368
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-11-16 11:17:54 UTC
A commit in branch main references this bug:

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

commit a592812327deaf69ab226afc5c8a01af43dc03c2
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2023-11-13 13:29:27 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2023-11-16 11:17:41 +0000

    mlx5_core: fix deadlock when using RXTLS

    If removing a node of type FS_TYPE_FLOW_DEST we lock the flow group too
    late. This can lead to a deadlock with fs_add_dst_fg().

    PR:             274715
    MFC after:      1 week
    Reviewed by:    kib
    Tested by:      mm
    Differential Revision: https://reviews.freebsd.org/D42368

 sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Comment 9 commit-hook freebsd_committer freebsd_triage 2023-11-22 08:01:24 UTC
A commit in branch stable/14 references this bug:

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

commit ac83e415ef083da400509c6fa434ee59cfe9668f
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2023-11-13 13:29:27 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2023-11-22 08:00:23 +0000

    mlx5_core: fix deadlock when using RXTLS

    If removing a node of type FS_TYPE_FLOW_DEST we lock the flow group too
    late. This can lead to a deadlock with fs_add_dst_fg().

    PR:             274715
    Reviewed by:    kib
    Tested by:      mm
    Differential Revision: https://reviews.freebsd.org/D42368

    (cherry picked from commit a592812327deaf69ab226afc5c8a01af43dc03c2)

 sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)