-
Notifications
You must be signed in to change notification settings - Fork 389
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
NO-SDV [vioscsi] Reduce spinlock management complexity #1175
NO-SDV [vioscsi] Reduce spinlock management complexity #1175
Conversation
Spinlocks are now primarily of the DpcLock type, without which the driver will not properly operate. Fallback to an InterruptLock type spinlock is limited, perhaps even cosmetic. This commit removes the VioScsiVQLock() and VioScsiVQUnlock() wrapper routines to use the native functions instead, i.e. StorPortAcquireSpinLock() and StorPortReleaseSpinLock(). VioScsiVQLock() contained a superfluous MSI-X and QueueNumber check and VioScsiVQUnlock() did not release non-DpcLock type spinlocks. Removing the wrapper routines also resolves these two issues. Refactoring includes: * Renaming of ProcessQueue() to ProcessBuffer(). Whilst technically more accurate, this also provides space for a new ProcessQueue() routine, via which the HW_MESSAGE_SIGNALLED_INTERRUPT_ROUTINE and HW_INTERRUPT routines can then be consolidated. * Where necessary, changing BOOLEAN isr to STOR_SPINLOCK LockMode * CamelCase / conformity correction of MessageID to MessageId * Conformity correction of QueuNum to QueneNumber * Removal of unnecessary use of MsgID and MessageID or MessageId in area of focus (11 instances of MessageID remain in other vioscsi.c routines) * Mnemonic rename of: * CompletePendingRequests() to CompletePendingRequestsOnReset() * index to vq_req_idx * Syntactic correction of if statement (added braces) Signed-off-by: benyamin-codez <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM at first blush, will defer to Vadim for a deeper review
After exploring various blends of different spinlock types, I was minded to remove the spinlock wrappers entirely. This approach also has a minor performance improvement. For reference: The full spinlock manager I used: https://github.com/benyamin-codez/kvm-guest-drivers-windows/blob/bc85387690c04baaf21adad52b2ee827c3f740f3/vioscsi/helper.c#L853-L956 |
Thanks a lot.
Best regards, |
Thanks Vadim. I am pleased to confirm this commit works both with and without MSI-X using the registry control method via the I have been explicitly testing I also tested Regarding my comments about calls to kvm-guest-drivers-windows/vioscsi/vioscsi.c Lines 854 to 856 in 162fe67
InterruptLock type spinlocks?
If so, I would propose doing so in a different PR, perhaps following consolidation of the The natural progression of such refactoring would be to remove conditional checks for Please let me know your thoughts on this and if you have any other concerns. Best regards, cc: @YanVugenfirer |
Thanks,
that !adaptExt->dpc_ok condition is a kind of tricky one. IIRC, we hit this case when resuming from Suspend and/or Hibernation Best, |
We know that when kvm-guest-drivers-windows/vioscsi/vioscsi.c Lines 529 to 532 in 162fe67
MSISupported=1 and num_queues=1 via QEMU command line with vCPU>1 results in VioScsiInterrupt() only issuing DPCs whilst adaptExt->dpc_ok=TRUE via:kvm-guest-drivers-windows/vioscsi/vioscsi.c Lines 1057 to 1067 in 162fe67
InterruptLock type spinlock (which I have not tested) would only be used in the else branch, i.e. when IsCrashDumpMode=TRUE or when adaptExt->dpc_ok=FALSE (or !adaptExt->dpc_ok ).
In any case - to answer your question - this configuration also tests ok with this commit.
Very tricky indeed from what I can tell..! 8^d In fact, I cannot see how this would work when all other spinlocks are the I think this is worth exploring, but in a future PR as previously suggested. Best regards, cc: @YanVugenfirer |
rerun tests |
If I'm not mistaken, this one should be good to go too, per #1181 (comment). Perhaps it's worthwhile running one more CI retest? Best regards, cc: @kostyanf14 |
What do you think? Or is this one right to go too? |
rerun tests |
Thanks for re-running the checks. Apart from the NO-SDV / Are we getting BSODs on Server2022+...?!? |
|
Yep, that was pretty clear from the Jenkins config you shared the other day. I was more concerned with the In that PR, you stated it was safe to proceed. However, this PR is much more consequential, and having those failures is a concern. Are the failures a known issue which can be disregarded? Or are you able to provide some insight as to why they are occurring, e.g. are there BSODs? With kind regards, |
@vrozenfe is it OK to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Thank you.
Vadim.
@benyamin-codez sorry, can you rebase please? |
@benyamin-codez Sorry, we don't want to have merge commits in the repo. Can you please resolve the conflicts of rebase? |
3a2dab9
to
5d410aa
Compare
Apologies. I hope that reset and forced push was ok... 8^d I'm not seeing any rebase conflicts... |
GitHub still think that PR is not good
|
@benyamin-codez I stopped CI, as PR is blocked from merging by GitHub anyway. |
When the user stops the viogpusc service either through SCM or console command line, a timeout error is thrown out as the following, From the console, The service did not respond to the start or control request in a timely fashion. From SCM A timeout was reached while waiting for a transaction response from the viogpusc service. This error is due to the incomplete initialization of the Session creating viogpuap process. This initialization is blocked until the process is terminated. When SCM or console command tries to stop the service, it always fails because the Session is waiting for the process to be terminated. Actually, the process is waiting for the service to trigger an event to terminate itself. This is a dead loop. To fix this issue, the Session initialization should be completed, and the Session Manager should monitor the termination of the process and release the resources after the process is terminated. Signed-off-by: Annie Li <[email protected]>
https://issues.redhat.com/browse/RHEL-58679 https://issues.redhat.com/browse/RHEL-62318 Disable DMAR for storage devices for now. Signed-off-by: Yuri Benditovich <[email protected]>
https://issues.redhat.com/browse/RHEL-62318 https://issues.redhat.com/browse/RHEL-58680 Disable DMAR for storage drivers for now. Signed-off-by: Yuri Benditovich <[email protected]>
Includes: a) New RUN_UNCHECKED and RUN_MIN_CHECKED definitions for compilation conditional tracing b) DBG definition fix (remove superfluous "define") c) Use keywords for WPP FLAGS d) New INLINE function WPP definitions e) WPP Optimisation f) ETW Prettification g) Suggestion to cull code for InitializeDebugPrints() when EVENT_TRACING Signed-off-by: benyamin-codez <[email protected]>
Includes: a) Indentation fixes upon review (Credit to the eagle eye of @JonKohler..!) b) Removes unnecessary and orphaned code c) Culls unused code for InitializeDebugPrints() when EVENT_TRACING d) Added comments to show necessary and necessary ETW inclusions Signed-off-by: benyamin-codez <[email protected]>
SDV defects in vioscsi.c a) HwStorPortProhibitedDDIs Must-Fix defect in VioScsiInterrupt() IRQL for trace b) NullCheck defect in CompleteRequest() OpCode for trace Signed-off-by: benyamin-codez <[email protected]>
Backports fixes and improvements from vioscsi PRs virtio-win#1150 and virtio-win#1162 virtqueue struct vq was also removed in favour of adaptExt->vq[QueueNumber], which results in a minor performance increase. Signed-off-by: benyamin-codez <[email protected]>
Signed-off-by: Yuri Benditovich <[email protected]>
Signed-off-by: Yuri Benditovich <[email protected]>
Signed-off-by: Yuri Benditovich <[email protected]>
This fix prevents viostor from reporting requests with MessageNumber of zero as failed even in case they succeed. Signed-Off-By: Martin Drab <[email protected]>
Will that work, or have I cooked it..? It certainly seems rebased now, but I see it still says FYI, I used:
Is that right, or should I have used another technique? Let me know if you need a fresh PR instead. |
This doesn't look right to me at all... EDIT: Added quote for context. |
Signed-off-by: Yuri Benditovich <[email protected]>
https://issues.redhat.com/browse/RHEL-66228 Initially disable the DMA remapping. Will be enabled according to the needs in future. Signed-off-by: Yuri Benditovich <[email protected]>
Spinlocks are now primarily of the DpcLock type, without which the driver will not properly operate. Fallback to an InterruptLock type spinlock is limited, perhaps even cosmetic. This commit removes the VioScsiVQLock() and VioScsiVQUnlock() wrapper routines to use the native functions instead, i.e. StorPortAcquireSpinLock() and StorPortReleaseSpinLock(). VioScsiVQLock() contained a superfluous MSI-X and QueueNumber check and VioScsiVQUnlock() did not release non-DpcLock type spinlocks. Removing the wrapper routines also resolves these two issues. Refactoring includes: * Renaming of ProcessQueue() to ProcessBuffer(). Whilst technically more accurate, this also provides space for a new ProcessQueue() routine, via which the HW_MESSAGE_SIGNALLED_INTERRUPT_ROUTINE and HW_INTERRUPT routines can then be consolidated. * Where necessary, changing BOOLEAN isr to STOR_SPINLOCK LockMode * CamelCase / conformity correction of MessageID to MessageId * Conformity correction of QueuNum to QueneNumber * Removal of unnecessary use of MsgID and MessageID or MessageId in area of focus (11 instances of MessageID remain in other vioscsi.c routines) * Mnemonic rename of: * CompletePendingRequests() to CompletePendingRequestsOnReset() * index to vq_req_idx * Syntactic correction of if statement (added braces) DUPLICATE of PR virtio-win#1175 to produce clean rebased version. Signed-off-by: benyamin-codez <[email protected]>
@vrozenfe @YanVugenfirer @kostyanf14 I'm still getting Here is a fresh PR against master: #1196 |
Binary equivalent PR #1196 is reporting |
Spinlocks are now primarily of the DpcLock type, without which the driver will not properly operate. Fallback to an InterruptLock type spinlock is limited, perhaps even cosmetic. This commit removes the VioScsiVQLock() and VioScsiVQUnlock() wrapper routines to use the native functions instead, i.e. StorPortAcquireSpinLock() and StorPortReleaseSpinLock(). VioScsiVQLock() contained a superfluous MSI-X and QueueNumber check and VioScsiVQUnlock() did not release non-DpcLock type spinlocks. Removing the wrapper routines also resolves these two issues. Refactoring includes: * Renaming of ProcessQueue() to ProcessBuffer(). Whilst technically more accurate, this also provides space for a new ProcessQueue() routine, via which the HW_MESSAGE_SIGNALLED_INTERRUPT_ROUTINE and HW_INTERRUPT routines can then be consolidated. * Where necessary, changing BOOLEAN isr to STOR_SPINLOCK LockMode * CamelCase / conformity correction of MessageID to MessageId * Conformity correction of QueuNum to QueneNumber * Removal of unnecessary use of MsgID and MessageID or MessageId in area of focus (11 instances of MessageID remain in other vioscsi.c routines) * Mnemonic rename of: * CompletePendingRequests() to CompletePendingRequestsOnReset() * index to vq_req_idx * Syntactic correction of if statement (added braces) DUPLICATE of PR #1175 to produce clean rebased version. Signed-off-by: benyamin-codez <[email protected]>
Spinlocks are now primarily of the DpcLock type, without which the driver will not properly operate. Fallback to an InterruptLock type spinlock is limited, perhaps even cosmetic.
This commit removes the VioScsiVQLock() and VioScsiVQUnlock() wrapper routines to use the native functions instead, i.e. StorPortAcquireSpinLock() and StorPortReleaseSpinLock(). VioScsiVQLock() contained a superfluous MSI-X and QueueNumber check and VioScsiVQUnlock() did not release non-DpcLock type spinlocks. Removing the wrapper routines also resolves these two issues.
Refactoring includes: