[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260202162948.4e743216@kernel.org>
Date: Mon, 2 Feb 2026 16:29:48 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Cosmin Ratiu <cratiu@...dia.com>
Cc: "andrew+netdev@...n.ch" <andrew+netdev@...n.ch>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>, Tariq Toukan
<tariqt@...dia.com>, Gal Pressman <gal@...dia.com>, Mark Bloch
<mbloch@...dia.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, Moshe Shemesh <moshe@...dia.com>,
"pabeni@...hat.com" <pabeni@...hat.com>, "edumazet@...gle.com"
<edumazet@...gle.com>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Saeed Mahameed <saeedm@...dia.com>, "leon@...nel.org" <leon@...nel.org>,
"horms@...nel.org" <horms@...nel.org>
Subject: Re: [PATCH net V2 2/4] net/mlx5: Fix deadlock between devlink lock
and esw->wq
On Mon, 2 Feb 2026 14:48:28 +0000 Cosmin Ratiu wrote:
> > And having a refount on (I presume) struct mlx5_esw_functions
> > so that work can hold a ref is not an option?
> > Are you planning to revisit this in -next?
>
> Currently, mlx5_eswitch_disable_locked (with the devlink lock held)
> waits for esw_vfs_changed_event_handler to finish.
> The event handler needs to acquire the same lock and load/unload all
> VFs, which touches the entire esw.
> I don't currently see how to use reference counting on the esw to avoid
> waiting for the handler.
struct my_thing_with_work {
work;
refcount;
dead;
};
work() {
lock()
if (my_thing->dead)
goto out;
/* .. add code here .. */
out:
unlock()
my_thing_put(my_thing)
}
some_op() {
// assuming lock() held
if (!work_queued(my_thing->work)) {
refcount_inc(my_thing->refcount);
queue_work(my_thing->work)
}
}
shutdown_op() {
// assuming lock() held
if (cancel_work())
my_thing_put(my_thing)
my_thing->dead = true;
my_thing_put(my_thing)
}
Powered by blists - more mailing lists