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

Rework IRP locking #38

Merged
merged 12 commits into from
Sep 19, 2023
Merged

Rework IRP locking #38

merged 12 commits into from
Sep 19, 2023

Conversation

tormodvolden
Copy link
Contributor

@tormodvolden tormodvolden commented Sep 19, 2023

This is on top of my PR #36

Note this has only been minimally tested with xusb.exe so far.

  • driver: Rework cancel and timeout handling in call_usbd_ex
    This is based on the "text book" (the MS documentation referenced in the commit message)
    The original code is using the same event for 2 different purposes, which I think is wrong.

  • driver: Allow synchronous return from lower driver in get_current_frame
    Also just based on code review and MS documentation.

I am curious whether this (especially the call_usbd_ex patch) can help for issue libusb/libusb#1255

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
The inconsistent indentation was giving compiler warnings.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
The preprocessor introduces a space between L and the string:
 L "abc"
and GCC will fail to recognize this as one token.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Many things have improved in MinGW over the years and less
special-casing is needed.

Due to many DDK header files referring to each other without
the ddk/ path prefix, we must tell make where to find the
include/ddk folder, e.g. (Ubuntu 20.04):

make host_prefix=i686-w64-mingw32 ddk=/usr/i686-w64-mingw32 driver
or
make host_prefix=x86_64-w64-mingw32 ddk=/usr/x86_64-w64-mingw32 driver
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Same includes for 32-bit as for 64-bit.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Also add a debug print for lower driver failure.

This corresponds to Scenario 2 from
https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/different-ways-of-handling-irps-cheat-sheet
but with the IO completion done by the calling code.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
@mcuee
Copy link
Owner

mcuee commented Sep 19, 2023

@dontech

Please help to look at this PR when you got the time. Thanks.

@dontech
Copy link
Collaborator

dontech commented Sep 19, 2023

Really impressive patch @tormodvolden.

Quick question: most of the patches are cosmetic, but the last 2 can have deeper impact.
Was there an actual problem here, or are these also cosmetic? Was there failing test cases?

Thanks,

/pedro

@dontech
Copy link
Collaborator

dontech commented Sep 19, 2023

Ah, OK i answered my own question. The failing test case was here: libusb/libusb#1255

Yes, my original fix was just not good enough :-(

Thanks again @tormodvolden for fixing this.

Approved.

@dontech dontech merged commit 5f03489 into mcuee:master Sep 19, 2023
@tormodvolden tormodvolden deleted the usbd_ex_locks branch February 12, 2024 21:40
@mcuee mcuee mentioned this pull request Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants