From: Orgad Shaneh <orgads@gmail.com>
To: Wei Hu <weh@microsoft.com>
Cc: dev@dpdk.org, Long Li <longli@kernel.org>,
Stephen Hemminger <stephen@networkplumber.org>,
Aditya Garg <gargaditya@microsoft.com>
Subject: Re: [PATCH 2/2] net/mana: fix Rx interrupt enable failing on lock contention
Date: Mon, 9 Nov 2026 14:02:07 +0000 [thread overview]
Message-ID: <20261109140207.4029126-1-orgads@gmail.com> (raw)
In-Reply-To: <SE3P153MB18482F1674C5450AC402E0C5BB732@SE3P153MB1848.APCP153.PROD.OUTLOOK.COM>
Hi Wei,
Wei Hu <weh@microsoft.com> wrote:
> App threads could get stuck as long as 15 seconds waiting for the lock when
> the device is in reset. Is it better to add following?
The 15 s recovery wait in mana_reset_thread() runs with reset_ops_lock
released and dev_state at RESET_EXIT, so a caller in that window takes
the lock, sees the state and returns -EBUSY at once. The lock is held
during teardown (dev_stop, the RESET_ENTER request to secondaries with
its 5 s IPC timeout, dev_close) and during re-probe, and a caller that
arrives then waits for that step.
Your early check fixes that: both steps run with dev_state already
non-ACTIVE, so the caller returns -EBUSY without touching the lock.
One window stays open. A caller can pass the check just before
mana_intr_handler() takes the lock, then block through
mana_reset_enter() and, if the reset thread wins the lock next,
through the whole teardown. Checking the state while waiting closes
that too, and it is no bigger:
static int
mana_reset_lock(struct mana_priv *priv)
{
while (pthread_mutex_trylock(&priv->reset_ops_lock)) {
if (rte_atomic_load_explicit(&priv->dev_state,
rte_memory_order_relaxed) != MANA_DEV_ACTIVE)
return -EBUSY;
rte_pause();
}
if (rte_atomic_load_explicit(&priv->dev_state,
rte_memory_order_acquire) != MANA_DEV_ACTIVE) {
pthread_mutex_unlock(&priv->reset_ops_lock);
return -EBUSY;
}
return 0;
}
Outside a reset the lock is only held by another queue's doorbell
write or event read, so the spin is short. A caller then never waits
on a reset step at all.
I'll send v2 with this, without Cc: stable, unless you prefer your
version.
Thanks,
Orgad
next prev parent reply other threads:[~2026-11-10 13:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 7:08 [PATCH 1/2] net/mana: fix Rx interrupt vector beyond device count Orgad Shaneh
2026-11-02 7:08 ` [PATCH 2/2] net/mana: fix Rx interrupt enable failing on lock contention Orgad Shaneh
2026-11-02 8:12 ` Stephen Hemminger
2026-11-02 8:27 ` Orgad Shaneh
2026-11-09 11:25 ` [EXTERNAL] " Wei Hu
2026-11-09 14:02 ` Orgad Shaneh [this message]
2026-11-10 14:33 ` Stephen Hemminger
2026-11-09 22:21 ` Stephen Hemminger
2026-11-10 9:42 ` [PATCH] net/mana: do not block Rx interrupt calls during a reset Orgad Shaneh
2026-11-10 14:47 ` Stephen Hemminger
2026-11-10 15:13 ` [PATCH v2] " Orgad Shaneh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261109140207.4029126-1-orgads@gmail.com \
--to=orgads@gmail.com \
--cc=dev@dpdk.org \
--cc=gargaditya@microsoft.com \
--cc=longli@kernel.org \
--cc=stephen@networkplumber.org \
--cc=weh@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox