<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:12.0pt;
        font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Aptos",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Madhukar,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I suggest caching the result of hn_rndis_query_hwcaps(), as suggested by Stephen. This can be done inside PMD. Do you want me to submit a patch?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For querying link status, the lock should be implemented inside hn_rndis_exec1(). The drawback is that this function can potentially wait for up to 60 seconds on response from host, maybe not suitable for spinlock in production use. But
 I think it’s better to have application retry on BUSY (with some delay logic), as the netvsc is designed in this way since introduced.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Long<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> madhukar mythri <madhukar.mythri@gmail.com>
<br>
<b>Sent:</b> Saturday, December 20, 2025 9:37 PM<br>
<b>To:</b> Stephen Hemminger <stephen@networkplumber.org><br>
<b>Cc:</b> Long Li <longli@microsoft.com>; dev@dpdk.org; Madhuker Mythri <madhuker.mythri@oracle.com><br>
<b>Subject:</b> Re: [EXTERNAL] [PATCH] net/netvsc: Fix on race condition of multiple commands<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" align="left" width="100%" style="width:100.0%">
<tbody>
<tr>
<td width="0" style="width:.3pt;background:#A6A6A6;padding:5.25pt 1.5pt 5.25pt 1.5pt">
</td>
<td width="100%" style="width:100.0%;background:#EAEAEA;padding:5.25pt 3.75pt 5.25pt 11.25pt;aspect-ratio: revert !important;background:revert !important;block-size: revert !important;border:revert !important;bottom: revert !important;color:revert !important;color-scheme: revert !important;content-visibility: revert !important;cursor:revert !important;direction:revert !important;display:revert !important;font-size:revert !important;height:revert !important;hyphens: revert !important;letter-spacing:revert !important;line-height:revert !important;margin:revert !important;opacity: revert !important;order: revert !important;outline: revert !important;overflow:revert !important;padding:revert !important;position:revert !important;resize: revert !important;rotate: revert !important;scale: revert !important;tab-size: revert !important;table-layout:revert !important;text-align:revert !important;text-indent:revert !important;text-orientation: revert !important;text-overflow: revert !important;text-shadow:revert !important;text-transform:revert !important;text-wrap: revert !important;top:revert !important;transition: revert !important;user-select: revert !important;vertical-align:revert !important;visibility:revert !important;white-space:revert !important;width:revert !important;word-break:revert !important;word-spacing:revert !important;writing-mode:revert !important;zoom: revert !important">
<div>
<p class="MsoNormal" style="mso-element:frame;mso-element-frame-hspace:2.25pt;mso-element-wrap:around;mso-element-anchor-vertical:paragraph;mso-element-anchor-horizontal:column;mso-height-rule:exactly">
<span style="font-size:9.0pt;font-family:"Segoe UI",sans-serif;color:#212121">You don't often get email from
</span><span style="color:black"><a href="mailto:madhukar.mythri@gmail.com"><span style="font-size:9.0pt;font-family:"Segoe UI",sans-serif">madhukar.mythri@gmail.com</span></a></span><span style="font-size:9.0pt;font-family:"Segoe UI",sans-serif;color:#212121">.
</span><span style="color:black"><a href="https://aka.ms/LearnAboutSenderIdentification"><span style="font-size:9.0pt;font-family:"Segoe UI",sans-serif">Learn why this is important</span></a></span><span style="font-size:9.0pt;font-family:"Segoe UI",sans-serif;color:#212121">
<o:p></o:p></span></p>
</div>
</td>
<td width="75" style="width:56.25pt;background:#EAEAEA;padding:5.25pt 3.75pt 5.25pt 3.75pt;aspect-ratio: revert !important;background:revert !important;block-size: revert !important;border:revert !important;bottom: revert !important;color:revert !important;color-scheme: revert !important;content-visibility: revert !important;cursor:revert !important;direction:revert !important;display:revert !important;font-size:revert !important;height:revert !important;hyphens: revert !important;letter-spacing:revert !important;line-height:revert !important;margin:revert !important;opacity: revert !important;order: revert !important;outline: revert !important;overflow:revert !important;padding:revert !important;position:revert !important;resize: revert !important;rotate: revert !important;scale: revert !important;tab-size: revert !important;table-layout:revert !important;text-align:revert !important;text-indent:revert !important;text-orientation: revert !important;text-overflow: revert !important;text-shadow:revert !important;text-transform:revert !important;text-wrap: revert !important;top:revert !important;transition: revert !important;user-select: revert !important;vertical-align:revert !important;visibility:revert !important;white-space:revert !important;width:revert !important;word-break:revert !important;word-spacing:revert !important;writing-mode:revert !important;zoom: revert !important;align: left !important">
</td>
</tr>
</tbody>
</table>
<div>
<div>
<p class="MsoNormal">Hi Li and Stephen, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">We have a common DPDK application for all the PMD's, in which we are seeing issue for this Netvsc PMD only.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I mean, for KVM hypervisor with Intel or Mellanox NICs we did not see such sync issues. Also, with failsafe PMD on hyper-v did not seen such sync issues.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">So, i thought this would be better to fix at PMD level using spinlock.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><a href="mailto:stephen@networkplumber.org"><span style="color:#1155CC">@Stephen Hemminger</span></a> , yes we can store the device info get details after probe and reuse it later.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">For Link-status get with multiple threads we can go with retry mechanism.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">However, w.r.t all other PMD's this device info get and Link-status get has issues in multi threaded application.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Madhuker.<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Sat, 20 Dec, 2025, 23:55 Stephen Hemminger, <<a href="mailto:stephen@networkplumber.org">stephen@networkplumber.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal">On Fri, 19 Dec 2025 17:35:33 +0000<br>
Long Li <<a href="mailto:longli@microsoft.com" target="_blank">longli@microsoft.com</a>> wrote:<br>
<br>
> > When multiple processes issue command requests(like: device info get and<br>
> > link-status) at same-time, then we could see the command request failures,<br>
> > due to race-condition of common function execution.  <br>
> <br>
> Hi Madhuker,<br>
> <br>
> I'm not sure if we should use a lock in the driver for this. It's not clear in DPDK documents but in general the calls to query device status are not thread safe.<br>
> <br>
> Is it possible that the application uses a lock to sync calling to this?<br>
> <br>
<br>
I do not know of any restrictions about threads calling query operations.<br>
<br>
For info_get() the transaction is in rndis_get_offload().<br>
There are couple of ways to handle this better. One would to do<br>
the query during probe and remember the result. The hypervisor is<br>
not going to change supported offload. The other and simpler way<br>
would be to just have hardcoded offload values. The code for query<br>
got compute offloads is inherited for BSD and unless someone was trying<br>
to run on Windows 2012 or earlier version of Hyper-V it would never change.<br>
<br>
Link status is a little more complex. Does the hyper-visor ever report<br>
that the software path is down? And reading through the hn_rdis_exec code<br>
it looks like if multiple operations are in process the second one<br>
should return -EBUSY. Application could retry in that case.<o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>