-
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
[vioscsi] SendSRB minor refactor #1153
[vioscsi] SendSRB minor refactor #1153
Conversation
The virtqueue_add_buf() routine will return 0 on SUCCESS or otherwise a negative number, usually -28 (ENOSPC), i.e no space for buffer. An inline comment is added for edification. Here we refactor virtqueue_add_buf() handling to only process the SRB if virtqueue_add_buf() returns SUCCESS. Presently, other positive return codes would be processed. Here we define VQ_ADD_BUFFER_SUCCESS in vioscsi\helper.h To ensure valid data is reported we also move the trace event on failure to above the call to CompleteRequest() and wrap the line for improved readability. Signed-off-by: benyamin-codez <[email protected]>
I'll drop another commit here in coming hours but thought it worth mentioning that I'm expecting the following gets clobbered by PR #1150, so won't do anything with that... kvm-guest-drivers-windows/vioscsi/helper.c Lines 116 to 121 in 281bb7b
|
From @JonKohler review feedback: 1. Use VQ_ADD_BUFFER_SUCCESS definition in virtqueue_add_buf() status variable init 2. Add virtqueue_add_buf() status variable to trace output on error Also: 1. Cleaned up init table 2. Replaced mentions of index variable with vq_req_idx Signed-off-by: benyamin-codez <[email protected]>
Have pushed the additional commit... |
Check will fail per:
...for undeclared identifier Let me know if that's ok or you need something else from me. |
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 glance, thanks for the cleanup
Hi @benyamin-codez, please fix build errors. |
Thanks I will revert the offending changes and put them in a new PR to review after other merges... |
Revert variable add_buffer_req_status to res to complete build scripts Will raise new PR for these changes Signed-off-by: benyamin-codez <[email protected]>
Jon, I thought I'd better check the modded trace works properly... I found we do actually set kvm-guest-drivers-windows/VirtIO/VirtIORing.c Line 263 in 22d0908
However, it returns kvm-guest-drivers-windows/VirtIO/osdep.h Line 20 in 22d0908
I'm still of the view that Per the above, do you know if there was any reason we define In Windows, 0x1 is
...but these would require single line changes to VirtIO ( both AFAICT, these are the only files in the tree which reference An alternative might be for me to use: RhelDbgPrint(TRACE_LEVEL_WARNING,
" Could not put an SRB into a VQ due to error %s. To be completed with SRB_STATUS_BUSY. QueueNumber = %lu, SRB = 0x%p, Lun = %d, TimeOut = %d.\n",
(res == -1) ? "ENOSPC" : "UNKNOWN", QueueNumber, srbExt->Srb, SRB_LUN(Srb), Srb->TimeOutValue); Any advice on how to proceed would be appreciated. cc: @vrozenfe |
@benyamin-codez I will take a look. But I am travelling for the KVM Forum now and it might take me some time. |
Glad you could make it. Travel logistics to Brno are brutal from where I live, I wanted to go this year but yikes, it's tough! |
Yan & Vadim, I've set this back to draft with a view to replacing it with a single commit PR. I will rebase against master and add the changes I had reverted back in. On the ENOSPC / SCSISTAT_QUEUE_FULL trace, I think it best to use: RhelDbgPrint(TRACE_LEVEL_WARNING,
" Could not put an SRB into a VQ due to error %s (%i). To be completed with SRB_STATUS_BUSY. QueueNumber = %lu, SRB = 0x%p, Lun = %d, TimeOut = %d.\n",
(res == -ENOSPC) ? "ENOSPC" : "UNKNOWN", res, QueueNumber, srbExt->Srb, SRB_LUN(Srb), Srb->TimeOutValue); Let me know if you want a PR to change the definition of cc: @JonKohler |
As for me, I think it would be nice to keep the same definitions as in Linux. Best, |
@benyamin-codez I agree with Vadim. Better be consistence with Linux. |
The
virtqueue_add_buf()
routine will return 0 on SUCCESS or otherwise a negative number, usually -28 (ENOSPC
), i.e no space for buffer. An inline comment is added for edification.Here we refactor
virtqueue_add_buf()
handling to only process the SRB ifvirtqueue_add_buf()
returns SUCCESS. Presently, other positive return codes would be processed.Here we define
VQ_ADD_BUFFER_SUCCESS
invioscsi\helper.h
.To ensure valid data is reported we also move the trace event on failure to above the call to
CompleteRequest()
and wrap the line for improved readability.