From: Stephen Hemminger <stephen@networkplumber.org>
To: Madhuker Mythri <madhukar.mythri@gmail.com>
Cc: longli@microsoft.com, dev@dpdk.org, madhuker.mythri@oracle.com
Subject: Re: [PATCH] net/netvsc: Fix on race condition of multiple commands
Date: Sun, 11 Jan 2026 18:58:09 -0800 [thread overview]
Message-ID: <20260111185809.47d9f7a7@phoenix.local> (raw)
In-Reply-To: <20251212115238.59710-1-madhukar.mythri@gmail.com>
On Fri, 12 Dec 2025 17:22:38 +0530
Madhuker Mythri <madhukar.mythri@gmail.com> wrote:
> When multiple processes issue command requests(like: device info get
> and link-status) at same-time, then we could see the command request
> failures, due to race-condition of common function execution.
>
> So, to avoid such race-condition introduced a new spin-lock to protect
> the code of critical section.
>
> Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
> Signed-off-by: Madhuker Mythri <madhukar.mythri@gmail.com>
AI patch review spotted some minor things and raises vaild question
about overall races in hn_rndis_exec
## Patch Review: net/netvsc Race Condition Fix
Based on the AGENTS.md DPDK review criteria, here's my assessment:
---
### **ERRORS (Must Fix)**
1. **Subject line capitalization** — "Fix" should be lowercase "fix"
- Current: `net/netvsc: Fix on race condition of multiple commands`
- Should be: `net/netvsc: fix race condition in multiple commands`
2. **Missing blank line before Signed-off-by** — Per tag order requirements, there must be a blank line between the `Fixes:` block and the `Signed-off-by:` block:
```
Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Signed-off-by: Madhuker Mythri <madhukar.mythri@gmail.com>
```
---
### **WARNINGS (Should Fix)**
1. **Awkward grammar in subject** — "Fix on race condition" is grammatically incorrect. Should be "fix race condition" (removing "on").
2. **Missing `Cc: stable@dpdk.org`** — This is a bug fix with a `Fixes:` tag, so it's a candidate for stable backport.
3. **Body formatting nit** — Line 89 has `requests(like:` — missing space before the parenthesis. Should be `requests (like:`.
4. **Incomplete protection?** — The spinlock only wraps `hn_rndis_execute()` inside `hn_rndis_query()`, but `hn_rndis_execute()` is likely called from other paths (e.g., `hn_rndis_set()`). If the race condition is in `hn_rndis_execute()` itself, all callers should be protected — or the lock should be inside `hn_rndis_execute()` rather than in `hn_rndis_query()`.
---
### **INFO (Minor/Consider)**
1. **Commit body could be clearer** — Consider specifying which exact functions race (e.g., "concurrent calls to `hn_rndis_query()` from different control paths can corrupt the shared response buffer").
2. **Lock granularity** — Holding a spinlock across `hn_rndis_execute()` which appears to wait for completion could block other threads for extended periods. A mutex might be more appropriate if this isn't a fast-path operation.
---
### **What's Correct** ✓
- Subject length (53 chars ≤ 60)
- Correct component prefix (`net/netvsc:`)
- Imperative mood
- No trailing period
- Body lines within 75 characters
- Body doesn't start with "It"
- `Signed-off-by:` present with real name and email
- `Fixes:` tag present with 12-char SHA and quoted subject
- Code uses proper DPDK APIs (`rte_spinlock_*`)
- Code changes are minimal and focused
---
### **Suggested Revised Commit Message**
```
net/netvsc: fix race condition in RNDIS command execution
When multiple threads issue RNDIS command requests (such as device
info queries and link status checks) simultaneously, command failures
can occur due to concurrent access to shared resources in the RNDIS
execution path.
Add a spinlock to serialize RNDIS command execution and prevent
data corruption.
Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Cc: stable@dpdk.org
Signed-off-by: Madhuker Mythri <madhukar.mythri@gmail.com>
```
---
### **Technical Question for Author**
Is `hn_rndis_query()` the only caller of `hn_rndis_execute()` that can race, or should `hn_rndis_set()` and other callers also be protected? If the race is in the execute function itself, moving the lock inside `hn_rndis_execute()` would provide complete protection.
next prev parent reply other threads:[~2026-01-12 2:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 11:52 Madhuker Mythri
2025-12-19 17:35 ` [EXTERNAL] " Long Li
2025-12-20 18:25 ` Stephen Hemminger
2025-12-21 5:37 ` madhukar mythri
2025-12-31 23:22 ` Long Li
2026-01-01 17:43 ` madhukar mythri
2026-01-12 2:58 ` Stephen Hemminger [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-12-12 11:09 Madhuker Mythri
2025-12-19 22:00 ` Patrick Robb
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=20260111185809.47d9f7a7@phoenix.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=longli@microsoft.com \
--cc=madhukar.mythri@gmail.com \
--cc=madhuker.mythri@oracle.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;
as well as URLs for NNTP newsgroup(s).