Skip to content
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

[vioscsi] DriverEntry() improved tracing #1215

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

benyamin-codez
Copy link
Contributor

Show the RegistryPath.
Show the CrashDump Mode.
Show StorPortInitialize() return value (including LONG).
Show NTDDI_VERSION.
Also added hwInitData.AddressTypeFlags.
Added missing NTDDI definitions in vioscsi.h.

vioscsi/vioscsi.h Outdated Show resolved Hide resolved
vioscsi/vioscsi.c Outdated Show resolved Hide resolved
vioscsi/vioscsi.c Outdated Show resolved Hide resolved
@benyamin-codez
Copy link
Contributor Author

@YanVugenfirer

Many thanks for the review, Yan...!

Unfortunately I've run out of time for now...
I'll come back to this one after pushing the new commits for the build stuff.
Hopefully before too long.

Best regards,
Ben

@benyamin-codez
Copy link
Contributor Author

@YanVugenfirer @vrozenfe @kostyanf14

This one should be right to go again.
Did you want to re-run any checks before switching from draft to Ready for review...?

I've fixed the problem breaking compilation (my bad), so the HCK-CI [EWDK] check should be right to go again. 8^d
The build completes a full SDV build for all platforms and all targets without errors...
... so should be good-to-go for other HCK-CI/vioscsi checks too.

All appears to work as expected in both Win10 and Win11.

@benyamin-codez benyamin-codez marked this pull request as ready for review January 5, 2025 18:54
@benyamin-codez
Copy link
Contributor Author

@kostyanf14 @YanVugenfirer

I believe those check failures are all known issues, yes...?

@YanVugenfirer
Copy link
Collaborator

@benyamin-codez Disk Verification (LOGO) and Flush tests failures are known issue.


#if !defined(RUN_UNCHECKED) || defined(RUN_MIN_CHECKED)
RhelDbgPrint(TRACE_LEVEL_NONE, " VIOSCSI driver starting...");
RhelDbgPrint(TRACE_LEVEL_NONE, " Built on %s at %s \n", __DATE__, __TIME__);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, why not to print this alway?
This is not a "performance path," and it is degrading existing behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The mechanism provides a means to run without WPP which can result in an approx. 80-100 μs latency improvement and an increase of 20-50k IOPS for 4KiB random I/O (with 32 queues, 16 threads on 4KiB segments). When WPP is turned off, these macros stop compile-time errors when building.

The mechanism is also quite useful during development to help determine the overhead of various tracing changes.

#if !defined(RUN_UNCHECKED)
switch (NTDDI_VERSION) {
case NTDDI_WIN10:
RhelDbgPrint(TRACE_LEVEL_VERBOSE, " NTDDI_VERSION : ABRACADABRA_THRESHOLD | Windows 10.0.10240 | 1507 | Threshold 1 \n");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure I am OK with such a construct in a driver, even for debugging purposes. It would be better to have a wiki page.

Also, I mentioned before - controlling the amount of debug prints better be done in run time.

@vrozenfe, what do you think?

Even if we go for this:

  1. Remove "ABRACADABRA_ :)
  2. Move the switch/case to a separate function (compile under pre-processor conditions) to keep DriverEntry cleaner.

Copy link
Contributor Author

@benyamin-codez benyamin-codez Jan 7, 2025

Choose a reason for hiding this comment

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

@YanVugenfirer
CC: @vrozenfe

Also, I mentioned before - controlling the amount of debug prints better be done in run time.

This would be great, but I'm not sure how to do this with the way WPP works.

When the WPP runs it creates the relevant *.tmh file(s) with entries for any and all matching functions as determined by the scan file. This means that the WPP performance overhead is directly proportional to the number of entries, regardless of whether they are printed. Therefore, changes to the verbosity of debug messages will have no effect on performance with ETW - it will consistently be the worst possible.

This is not the case with the kDebugPrint (non-default) option, but I note my previous comment too, where I confirmed issues with boot-time and the HwStorPortProhibitedDDIs rule-set.

In any case, we presently choose between ETW (WPP) and kDebugPrint at compile-time.

Also, please see the changes I propose in PR #1228.

I am not sure I am OK with such a construct in a driver, even for debugging purposes.

This is very useful information to have for the purposes of advertising feature-set availability and for configuration confirmation. The prints would be most useful to sys admins preparing or troubleshooting configuration options. Here is an example of what it looks like in TraceView:

etw_driver_entry

You might notice the line at the bottom saying:

ConfigInfo->DmaAddressWidth is NOT supported in this version of the driver.

This is an example where the feature is not available as it is built with THRESHOLD when it needs WIN10_VB. One can then refer to the NTDDI_VERSION above to give this context.

It would be better to have a wiki page.

I don't know about better.. 8^)
...but it would be helpful to a range of roles to know what the NTDDI_VERSION and feature-set is.

Remove "ABRACADABRA_ :)

Can do... 8^D
With the squash... 8^d

Move the switch/case to a separate function (compile under pre-processor conditions) to keep DriverEntry cleaner.

This is run-time only...
...but I'm curious as to how this might work... 8^d
If you are worried about using switch-case, iirc, this is normally compiled as if-else...

EDIT: Corrected reference: tmf.* --> tmh.*

Copy link
Contributor Author

@benyamin-codez benyamin-codez Jan 23, 2025

Choose a reason for hiding this comment

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

@YanVugenfirer

Move the switch/case to a separate function (...) to keep DriverEntry cleaner.

Done...!
8^d

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this one is now resolved...!?

@YanVugenfirer
Copy link
Collaborator

Also, please squash the commits.

@benyamin-codez benyamin-codez force-pushed the vioscsi-driver-entry branch 3 times, most recently from 4bb4926 to 000c987 Compare January 7, 2025 15:40
@benyamin-codez
Copy link
Contributor Author

@YanVugenfirer

Modded, squashed and rebased... 8^d

1. Show the RegistryPath.
2. Show the CrashDump Mode.
3. Show StorPortInitialize() return value (including LONG).
4. Show NTDDI_VERSION.
5. Split NTDDI_ definitions to new file ntddi_ver.h and addedd missing NTDDI definitions
6. Removed references to obsoleted RUN_MIN_CHECKED definition (PR virtio-win#1228).

Signed-off-by: benyamin-codez <[email protected]>
@benyamin-codez
Copy link
Contributor Author

@YanVugenfirer @kostyanf14

Maybe some HCK-CI/vioscsi checks...?

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.

2 participants