lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABbqxmfMLAFT8vMeCz4dXY5RfgZ-65VYXZm+P1-sO_pqKR-sPw@mail.gmail.com>
Date: Tue, 30 Sep 2025 14:50:52 +0800
From: yuanli fu <fuyuanli0722@...il.com>
To: jdmason@...zu.us
Cc: dave.jiang@...el.com, allenbh@...il.com, ntb@...ts.linux.dev, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] ntb: Add mutex to make link_event_callback executed linearly.

Hi Jon

just a gentle ping on patch, Is there anything else needed from my side?
Thank you!

Best regards,
Yuanli Fu

fuyuanli <fuyuanli0722@...il.com> 于2025年8月25日周一 17:15写道:
>
> Since the CPU selected by schedule_work is uncertain, multiple link_event
> callbacks may be executed at same time. For example, after peer's link is
> up, it is down quickly before local link_work completed. If link_cleanup
> is added to the workqueue of another CPU, then link_work and link_cleanup
> may be executed at the same time. So add a mutex to prevent them from being
> executed concurrently.
>
> Signed-off-by: fuyuanli <fuyuanli@...iglobal.com>
> ---
> v2:
> 1) use guard() instead of lock & unlock functions.
>
> v1:
> Link: https://lore.kernel.org/all/aKiBi4ZDlbgzed%2Fz@didi-ThinkCentre-M930t-N000/
> ---
>  drivers/ntb/ntb_transport.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 4f775c3e218f..eb875e3db2e3 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -59,6 +59,7 @@
>  #include <linux/slab.h>
>  #include <linux/types.h>
>  #include <linux/uaccess.h>
> +#include <linux/mutex.h>
>  #include "linux/ntb.h"
>  #include "linux/ntb_transport.h"
>
> @@ -241,6 +242,9 @@ struct ntb_transport_ctx {
>         struct work_struct link_cleanup;
>
>         struct dentry *debugfs_node_dir;
> +
> +       /* Make sure workq of link event be executed serially */
> +       struct mutex link_event_lock;
>  };
>
>  enum {
> @@ -1024,6 +1028,7 @@ static void ntb_transport_link_cleanup_work(struct work_struct *work)
>         struct ntb_transport_ctx *nt =
>                 container_of(work, struct ntb_transport_ctx, link_cleanup);
>
> +       guard(mutex)(&nt->link_event_lock);
>         ntb_transport_link_cleanup(nt);
>  }
>
> @@ -1047,6 +1052,8 @@ static void ntb_transport_link_work(struct work_struct *work)
>         u32 val;
>         int rc = 0, i, spad;
>
> +       guard(mutex)(&nt->link_event_lock);
> +
>         /* send the local info, in the opposite order of the way we read it */
>
>         if (nt->use_msi) {
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ