Skip to content

Hck rss bsod work in progress #1333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 27 commits into from

Conversation

ybendito
Copy link
Collaborator

For comments and testing only.

@ybendito ybendito requested a review from YanVugenfirer as a code owner March 23, 2025 06:19
@ybendito ybendito force-pushed the hck_rss_bsod_work branch 7 times, most recently from 0f6cab4 to 7896d63 Compare March 26, 2025 18:28
@ybendito ybendito force-pushed the hck_rss_bsod_work branch 6 times, most recently from 484fb1a to dc5a7cc Compare March 30, 2025 17:34
class NBLHistory : public CNdisAllocatable<NBLHistory, 'NBLH'>
{
DECLARE_CNDISLIST_ENTRY(NBLHistory);
public:
Copy link
Contributor

@Jedoku Jedoku Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this case there should be extra line before access specifiers

DECLARE_CNDISLIST_ENTRY(NBLHistory);
public:
NBLHistory(LPCSTR Func, LPCSTR Title, LPCSTR ParameterMeaning, PVOID Parameter, LPCSTR ValueMeaning, ULONG Value);
protected:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jedoku is this behavior configurable? I ask because this does not make too much sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's configured in .clang-format
EmptyLineBeforeAccessModifier: LogicalBlock
If we change it it will affect whole project

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jedoku If there is an option "don't mind" this will not request any change, correct? Is it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave option should work

@kostyanf14 kostyanf14 requested a review from Copilot March 31, 2025 11:02
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Files not reviewed (14)
  • NetKVM/Common/DebugData.h: Language not supported
  • NetKVM/Common/ParaNdis-TX.h: Language not supported
  • NetKVM/Common/ParaNdis-Util.h: Language not supported
  • NetKVM/Common/ParaNdis-VirtQueue.h: Language not supported
  • NetKVM/Common/ParaNdis_Debug.cpp: Language not supported
  • NetKVM/Common/ParaNdis_DebugHistory.h: Language not supported
  • NetKVM/Common/ParaNdis_TX.cpp: Language not supported
  • NetKVM/Common/ParaNdis_VirtQueue.cpp: Language not supported
  • NetKVM/Common/ndis56common.h: Language not supported
  • NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.cpp: Language not supported
  • NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.vcxproj: Language not supported
  • NetKVM/wlh/ParaNdis6_Driver.cpp: Language not supported
  • NetKVM/wlh/ParaNdis6_Impl.cpp: Language not supported
  • NetKVM/wlh/ParaNdis6_Oid.cpp: Language not supported

ybendito added 12 commits April 7, 2025 21:10
When the device has one queue we do not need to analyze the
hash and send NBLs one by one.

Signed-off-by: Yuri Benditovich <[email protected]>
This feature is disabled in production, we just fix the
compilation problems when it is enabled.

Signed-off-by: Yuri Benditovich <[email protected]>
Move the last TX completion timestamp from per-adapter
context to per-queue context for better visibility.

Signed-off-by: Yuri Benditovich <[email protected]>
Note that this is unsafe method and the result can be
used only for information / tracking, not for decisions.

Signed-off-by: Yuri Benditovich <[email protected]>
The new logic to support chains is placed under ifdef currently
and the driver works in backward compatible mode when all the
procedures related to chain information in the NBL are stubs.
The new logic that takes in account NBL chain is:
- Before we start mapping the NBL chain - all the CNBLs after
  first one have a reference to first CNBL in the chain.
  At this point the first CNBL has a counter of NBLs that
  follow it in the chain
- The check whether the NBL is 'done' now modified.
  The mandatory condition, as before, is that all the NBs
  of the NBL are completed. Additional condition will be
  enabled in future when we define NBL_CHAINS.
  Then all the NBLs related to the same chain become 'done' at the same
  moment, when all of them are done.

Signed-off-by: Yuri Benditovich <[email protected]>
Signed-off-by: Yuri Benditovich <[email protected]>
Connection is src:dest IP addresses and ports, so
for all the packets sent to specific connection the
hash should be the same. We collect NBL chain till all
the indirection indices are the same, then flush
the chain to the TX queue and start a new chain.

Signed-off-by: Yuri Benditovich <[email protected]>
@ybendito ybendito force-pushed the hck_rss_bsod_work branch from dc5a7cc to a8a6e3a Compare April 7, 2025 19:16
ybendito added 12 commits April 7, 2025 22:29
If defined (by default disabled by compilation) we keep the
NBL history in the CNBL as a list of events. Especially
useful for stuck NBL that has not completed. From the
dump we'll be able to read the history.

Signed-off-by: Yuri Benditovich <[email protected]>
Signed-off-by: Yuri Benditovich <[email protected]>
Signed-off-by: Yuri Benditovich <[email protected]>
This is useful for logging of chained NBLs.

Signed-off-by: Yuri Benditovich <[email protected]>
If one NB failed, the entire NBL is not send, so we need
to reflect this in TX errors. Also adding printout in such
a case.

Signed-off-by: Yuri Benditovich <[email protected]>
Chain NBLs from the list of completed CNBLs as they appear
in the list and do not invert them. Later we're going to
add NBL chains from the 'first in chain' CNBLs.

Signed-off-by: Yuri Benditovich <[email protected]>
Keep the order of NBLs wherever possible, i.e. push them at
the end of waiting list and then process waiting list and
remove from it all the completed NBLs, so that earlier NBLs
are removed first.

Signed-off-by: Yuri Benditovich <[email protected]>
Now we enable NBL chain support.
Deliver entire NBL chain if one was provided in Send() call.
Each CNBL created for each 'next' NBL (following to the first
one) on completion of all it's NBs detaches it's NBL and
attaches it to the m_NBL of the first one. Such a way when
all the CNBLs related to the same chain are ready, only first
one has m_NBL (with all the rest of NBLs chained to it).
For all the rest of CNBLs the m_NBL is NULL.
The order of NBLs in the chain might be slightly different
than original one (due to NB completions running simultaneously
in different flows), for that the chain is tested and repaired
if needed before it is indicated up.

Signed-off-by: Yuri Benditovich <[email protected]>
Signed-off-by: Yuri Benditovich <[email protected]>
Signed-off-by: Yuri Benditovich <[email protected]>
@ybendito ybendito force-pushed the hck_rss_bsod_work branch from 5aeca9f to c2d4571 Compare April 7, 2025 19:29
Signed-off-by: Yuri Benditovich <[email protected]>
@ybendito
Copy link
Collaborator Author

ybendito commented Apr 9, 2025

@kostyanf14 Win2022x64:

  1. DVL folder not found, probably because there is no DVL file in the package. Is it expected?
  2. Strict property validation: do we need to update something in our env or submit the update to the MS repo? 2025 test passed.

@@ -727,6 +727,11 @@ bool CParaNdisTX::SendMapped(bool IsInterrupt, CRawCNBLList &toWaitingList)
}
}
}
else
{
// carrier loss or removal
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be on a "link loss".

@@ -446,7 +446,7 @@ static VOID ParaNdis6_SendNetBufferLists(NDIS_HANDLE miniportAdapterContext,
}
#ifdef PARANDIS_SUPPORT_RSS
CNdisPassiveReadAutoLock autoLock(pContext->RSSParameters.rwLock);
if (pContext->RSS2QueueMap != nullptr)
if (pContext->nPathBundles > 1 && pContext->RSS2QueueMap != nullptr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@@ -3,6 +3,7 @@
#include "ParaNdis-AbstractPath.h"
#include "ParaNdis_GuestAnnounce.h"
#include "ParaNdis_LockFreeQueue.h"
#include "ParaNdis_DebugHistory.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please submit this as a separate PR. It can already be merged and make future review easier.

Thanks!

@@ -324,7 +324,7 @@ UINT CTXVirtQueue::ReleaseTransmitBuffers(CRawCNBList &listDone)
}
if (i)
{
NdisGetCurrentSystemTime(&m_Context->LastTxCompletionTimeStamp);
UpdateTimestamp(m_LastTxCompletionTimestamp);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, can be submitted as a separate PR (or parts of refactoring/ ready for merge commits).

@@ -41,7 +41,7 @@

FILE *outf = stdout;

typedef CString(*TimeStampConversionFunc)(LONGLONG BaseTime, LARGE_INTEGER TimeStamp);
typedef CString (*TimeStampConversionFunc)(LONGLONG BaseTime, LARGE_INTEGER TimeStamp);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please send it as part of a separate PR already

NBLHolder->SetStatus(NDIS_STATUS_FAILURE);
// this is ok if this CNBL is not first one
m_Context->Statistics.ifOutErrors += NBLHolder->NumberOfBuffers();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW: For the acadenic interest, do you see this in practice? When?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, just to handle the error path and give some visibility in case it happens.

@kostyanf14
Copy link
Member

kostyanf14 commented Apr 9, 2025

1. DVL folder not found, probably because there is no DVL file in the package. Is it expected?

Not expected, some build bug.

Build - Performing SDV checks for NetKVM-VS2015.vcxproj...
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 4/7/2025 3:54:57 PM.
     1>Project "C:\jenkins\workspace\build-virtio-win-EWDK-24H2-21H2\NetKVM\NetKVM-VS2015.vcxproj" on node 1 (sdv target(s)).
     1>sdv:
         staticdv /check /devenv
         SDV: c:\ewdk11\Program Files\Windows Kits\10\TOOLS\SDV
         SMV: c:\ewdk11\Program Files\Windows Kits\10\TOOLS\SDV\smv
         SDVAP: c:\ewdk11\Program Files\Windows Kits\10\TOOLS\SDV\smv\analysisplugins\sdv
         Build environment: msbuild
         [INFO] Cleaning ... 
         [INFO] Setting interceptor platform to x64
         [INFO] Setting platform to x86_amd64
         [INFO] Validating XML against schema: c:\ewdk11\Program Files\Windows Kits\10\TOOLS\SDV\smv\bin\Config.xsd
         [INFO] Running local scheduler with 12 threads
         [INFO] Driver type found: ndis
         [INFO] Currently reading and validating XML settings from c:\ewdk11\Program Files\Windows Kits\10\TOOLS\SDV\data\ndis\sdv-default.xml
         
         [INFO] 1 of 2 jobs remaining. Avg(s): 25.00. Std.Dev(s): 0.00
         [INFO] 1 of 3 jobs remaining. Avg(s): 179.50. Std.Dev(s): 154.50
         Scan ...Done
         
         [INFO] 0 of 3 jobs remaining. Avg(s): 119.67. Std.Dev(s): 151.90
         
         Building ...Done
         [INFO] Using plugin SdvPlugin.SmvSdv for analysis.
         [INFO] Running analysis on 3 precondition(s) & 100 rule(s) ...
         [INFO] Checking preconditions...
         
         [INFO] 3 of 7 jobs remaining. Avg(s): 92.75. Std.Dev(s): 139.57
         [INFO] 3 of 8 jobs remaining. Avg(s): 76.80. Std.Dev(s): 128.84
         
         Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
            at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value)
            at System.Collections.Generic.HashSet`1.Add(T item)
            at SdvPlugin.SdvTelemetry.LogStageStart(String stageName)
            at SdvPlugin.SmvSdv.PreAction(SMVAction action)
            at SmvLibrary.Utility.ExecuteAction(SMVAction action, Boolean fromWorker, Boolean workerUseDb, String workerTaskId)
            at SmvLibrary.LocalSMVActionScheduler.Execute()
            at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
            at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
            at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
            at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
            at System.Threading.ThreadHelper.ThreadStart()
         [INFO] 3 of 9 jobs remaining. Avg(s): 66.17. Std.Dev(s): 120.00
     1>c:\ewdk11\Program Files\Windows Kits\10\build\windowsdriver.Sdv.targets(136,9): error MSB3073: The command "staticdv /check /devenv" exited with code 255. [C:\jenkins\workspace\build-virtio-win-EWDK-24H2-21H2\NetKVM\NetKVM-VS2015.vcxproj]
     1>Done Building Project "C:\jenkins\workspace\build-virtio-win-EWDK-24H2-21H2\NetKVM\NetKVM-VS2015.vcxproj" (sdv target(s)) -- FAILED.
2. Strict property validation: do we need to update something in our env or submit the update to the MS repo? 2025 test passed.

need to update our env.

@@ -941,7 +1070,9 @@ int ParseDumpFile(int argc, TCHAR *argv[])
}
else
{
PRINT("%s", SessionStatusValues[0].name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also can be submited for merge already.

@@ -18,14 +18,14 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be submitted already. Shouldn't trigger HCCK-CI.

@YanVugenfirer
Copy link
Collaborator

@ybendito Can we close this PR?

@ybendito ybendito closed this Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants