-
Notifications
You must be signed in to change notification settings - Fork 20
Update scsi host and added scsi devices with scsiinfo module #156
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
Conversation
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.
Thanks Rajan for creating these new helpers, it's very helpful. There are some nit pick comments, besides can you create a bug to track this and update bug id in the commit? Also please refer to the docstring of others function to change accordingly.
56e6fe2
to
fd4a6b8
Compare
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.
Hi Rajan, thanks for addressing the comments. I have post some more comments, please review, beside that, two generate comments:
- please run gitlab test to run vmcore test
- can you please merge the two patches or at lease make the second patch only for inflight commands, because when i review the first patch, i made some comments, then later when review the second patch, i found the commented code get removed, this happened when i made first round review and this time again, i think this will help other reviewers as well. Thanks.
"shost_data", | ||
"hostdata", | ||
] | ||
] |
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.
These are host information, it can be dump with print_scsi_hosts
to avoid duplicate information. To connect scsi device with host, you can add a column for scsi host address for each device dump, to have device linking to its host information.
drgn_tools/scsi.py
Outdated
|
||
for shost in for_each_scsi_host(prog): | ||
if host_module_name(shost) == "ahci": | ||
continue |
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.
Sorry for the confusion, i mean why skip "ahci" here, but anyway i see you removed it from 2nd patch
Ok, I’ll use the version under /drgn_tools/device.py
Thanks,
Rajan
From: Stephen Brennan ***@***.***>
Date: Monday, May 19, 2025 at 11:28 AM
To: oracle-samples/drgn-tools ***@***.***>
Cc: Rajan Shanmugavelu ***@***.***>, Author ***@***.***>
Subject: Re: [oracle-samples/drgn-tools] Update scsi host and added scsi devices with scsiinfo module (PR #156)
@brenns10 commented on this pull request.
________________________________
In drgn_tools/scsi.py<#156 (comment)>:
from drgn import container_of
from drgn import FaultError
from drgn import Object
from drgn import Program
+from drgn.helpers.linux.block import _class_to_subsys
Let's use my version from drgn_tools/device.py. While we will be increasing the minimum supported drgn version to 0.0.31 very soon, the _class_to_subsys function you're importing here is not a public helper in drgn (due to the leading underscore).
We do use private drgn APIs in a few critical places in drgn-tools (namely the slab allocator helpers) but really we want to keep it to a minimum. (Each one is one that I need to monitor for breakages as new drgn changes get merged :P ). This is a small enough (and simple enough) function that I don't mind keeping our own copy. If we want to use the drgn version, we should send a patch to make it a public helper first.
—
Reply to this email directly, view it on GitHub<#156 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIQN7X47D6DRQXWPG7AOWLT27IPDFAVCNFSM6AAAAAB3DWRRNCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDQNJRGY3DSMRZGY>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Signed-off-by: Rajan Shanmugavelu <[email protected]
Sample devices per SCSI host controller port output, the host data here is just the address which is common for all the devices.
|
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.
Only one more comment, other looks good.
drgn_tools/scsi.py
Outdated
scsi_disk = cast("struct scsi_disk *", disk.private_data) | ||
scsi_device = cast("struct scsi_device *", scsi_disk.device) | ||
if not scsi_disk or not scsi_device: | ||
continue |
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.
This still not address? Can you run the helper in an system with nvme disk and use fio to push lots of io to the nvme disk, when disk
is nvme disk, all these casting to scsi data structure will cause unexpected result.
I think the right way to do it is using for_each_scsi_host
and for_each_scsi_host_device
, that will make sure it is only operating on real scsi disk.
Hi Junxiao,
Had to make small change to avoid NVMe disks.
diff --git a/drgn_tools/scsi.py b/drgn_tools/scsi.py
index a2119f6..fdcbaad 100644
--- a/drgn_tools/scsi.py
+++ b/drgn_tools/scsi.py
@@ -331,7 +331,8 @@ def print_inflight_scsi_cmnds(prog: Program):
for disk in for_each_disk(prog):
scsi_disk = cast("struct scsi_disk *", disk.private_data)
scsi_device = cast("struct scsi_device *", scsi_disk.device)
- if not scsi_disk or not scsi_device:
+ if not scsi_disk.disk or not scsi_device:
+ # skipping non-SCSI device like NVMe LUNs
continue
counter = 0
output = [
Have run this test on system with NVMe and NVMe-of (over fibrechannel) luns. They don’t show the NVMe luns or the pending commands that are on NVMe channel. It does pick up all SCSI devices that are on fibrechannel, SAS and iSCSI.
Thanks,
Rajan
From: Junxiao Bi ***@***.***>
Date: Thursday, May 22, 2025 at 2:47 PM
To: oracle-samples/drgn-tools ***@***.***>
Cc: Rajan Shanmugavelu ***@***.***>, Author ***@***.***>
Subject: Re: [oracle-samples/drgn-tools] Update scsi host and added scsi devices with scsiinfo module (PR #156)
@biger410 commented on this pull request.
Only one more comment, other looks good.
________________________________
In drgn_tools/scsi.py<#156 (comment)>:
]
)
print_table(output)
+def print_inflight_scsi_cmnds(prog: Program):
+ TotalInflight = 0
+ for disk in for_each_disk(prog):
+ scsi_disk = cast("struct scsi_disk *", disk.private_data)
+ scsi_device = cast("struct scsi_device *", scsi_disk.device)
+ if not scsi_disk or not scsi_device:
+ continue
This still not address? Can you run the helper in an system with nvme disk and use fio to push lots of io to the nvme disk, when disk is nvme disk, all these casting to scsi data structure will cause unexpected result.
I think the right way to do it is using for_each_scsi_host and for_each_scsi_host_device, that will make sure it is only operating on real scsi disk.
—
Reply to this email directly, view it on GitHub<#156 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIQN7X6DYEMXV3MTR2AY3M327ZAU3AVCNFSM6AAAAAB3DWRRNCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDQNRSGYZDINBYHA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
1c70166
to
20facfa
Compare
Signed-off-by: Rajan <[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.
Looks good. Thanks @vashanmu
Signed-off-by: Rajan Shanmugavelu <[email protected]