Skip to content

Commit

Permalink
[vioscsi] Implement cold and hot tracing paths
Browse files Browse the repository at this point in the history
1. Introduced three (3) compile-time environment variables:
   RUN_WPP_ALL_PATHS   - Compile WPP for the hot path too.
                         Is the inverse of RUN_COLD_PATH_ONLY, which is the default behaviour.
   FORCE_RUN_UNCHECKED - Run without EVENT_TRACING or DBG. Defines RUN_UNCHECKED.
   FORCE_RUN_DEBUG     - Run with DBG rather than EVENT_TRACING. Undefines EVENT_TRACING.

2. WPP scans for WPP config on a per file basis. Sections of the config file cannot be excluded
    and conditional macros will be ignored. To solve this, we establish two new files with WPP
    configuration data. One holds exclusively cold path data (wpp_cold_path.h) and the other
    holds data for all paths (wpp_all_paths.h). Which file to use is set conditionally per the
    vioscsi.vcxproj project file configuration.

3. The hot path DBG and WPP macro variants are a clone of the cold path macros, but with a "_HP"
    suffix. The exception to this is RhelDbgPrint() which we extend as RhelDbgPrintHotPath().

4. Encapsulated exisitng cold and and hot trace messages in compile-time conditional macros and
    in same manner drops *.tmh includes when necessary.

5. Minor refactoring of:
    a) helper.c - GetScsiConfig()
    b) helper.c - SetGuestFeatures()

6. Major refactoring of:
    a) trace.h
    b) vioscsi.c - VioScsiHwInitialize() - corrects order of init for benefit of clean trace.

7. Major new instrumentation of:
    a) helper.c - InitVirtIODevice()

8. Reconfigured the following for INLINE function tracing:
    a) vioscsi.c - HandleResponse()
    b) vioscsi.c - PreProcessRequest()
    c) vioscsi.c - PostProcessRequest()
    d) vioscsi.c - DispatchQueue()

9. Mnemonic rename of VioScsiPassiveInitializeRoutine() to VioScsiPassiveDpcInitializeRoutine().

10. Correct struct virtio_bar for bMemorySpace rather than bPortSpace (vioscsi.h and virtio_pci.c).

11. Add missing structs for PCI Capabilities (vioscsi.h).

Hard to split this one up further methinks.
I do have a fair bit of additional instrumentation to merge after this one.

Signed-off-by: benyamin-codez <[email protected]>
  • Loading branch information
benyamin-codez committed Dec 20, 2024
1 parent a01c696 commit 0256e2f
Show file tree
Hide file tree
Showing 10 changed files with 1,536 additions and 407 deletions.
11 changes: 10 additions & 1 deletion vioscsi/buildAll.bat
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
@echo off

rem Uncomment the following to enable ETW or debug for the hot path too. Defaults to cold path ETW only.
rem set RUN_WPP_ALL_PATHS=Yes

rem Uncomment the following to compile without ETW or debug support.
rem set FORCE_RUN_UNCHECKED=Yes
rem Uncomment the following to enable debug instead of ETW.
rem set FORCE_RUN_DEBUG=Yes

if "%VIRTIO_WIN_NO_ARM%"=="" call ..\build\build.bat vioscsi.sln "Win10 Win11" ARM64
if errorlevel 1 goto :eof
call ..\build\build.bat vioscsi.sln "Win10 Win11" %*
if errorlevel 1 goto :eof
call ..\build\build.bat vioscsi.vcxproj "Win11_SDV" %*
call ..\build\build.bat vioscsi.vcxproj "Win10_SDV Win11_SDV" %*
Loading

0 comments on commit 0256e2f

Please sign in to comment.