Skip to content

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

Merged
merged 2 commits into from
May 27, 2025

Conversation

vashanmu
Copy link
Contributor

Signed-off-by: Rajan Shanmugavelu <[email protected]

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Apr 14, 2025
@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Apr 14, 2025
Copy link
Member

@biger410 biger410 left a 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.

@vashanmu vashanmu force-pushed the main branch 3 times, most recently from 56e6fe2 to fd4a6b8 Compare May 14, 2025 19:39
Copy link
Member

@biger410 biger410 left a 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:

  1. please run gitlab test to run vmcore test
  2. 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",
]
]
Copy link
Member

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.


for shost in for_each_scsi_host(prog):
if host_module_name(shost) == "ahci":
continue
Copy link
Member

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

@vashanmu
Copy link
Contributor Author

vashanmu commented May 19, 2025 via email

@vashanmu
Copy link
Contributor Author

Sample devices per SCSI host controller port output, the host data here is just the address which is common for all the devices.

$ python -m drgn_tools.corelens /proc/kcore -M scsiinfo --dev
warning: Running corelens against a live system.
         Data may be inconsistent, or corelens may crash.

--------------------------------------------------------------------------------------------------------------
HOST   DRIVER   Scsi_Host           shost_data          hostdata
host7  qla2xxx  0xffff90b78e3bc000  0xffff90b78e3bc980  0xffff90b78e3bc9c0
--------------------------------------------------------------------------------------------------------------
Device  H:C:T:L     Scsi Device Addr    Vendor                        State         IO Req   IO Done  IO Error
sdb     [7:0:0:3]   0xffff90c67016d000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  4227768  4227768     4
sdc     [7:0:0:5]   0xffff90c670081000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  4869212  4869212     4
sdd     [7:0:0:23]  0xffff90c6701a4000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  1712162  1712162     4
sde     [7:0:1:3]   0xffff90c6701a5000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  4233772  4233772     3
sdf     [7:0:1:5]   0xffff90c6701a0000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  4868350  4868350     3
sdg     [7:0:1:23]  0xffff90c6701a7000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  1712074  1712074     3
sdh     [7:0:2:3]   0xffff90c6701a1000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4343     4343    11
sdi     [7:0:2:5]   0xffff90c645366000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4343     4343    11
sdj     [7:0:2:23]  0xffff90c645365000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4343     4343    11
sdu     [7:0:3:3]   0xffff90c645364000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4342     4342    11
sdw     [7:0:3:5]   0xffff90c6700bd000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4343     4343    11
sdy     [7:0:3:23]  0xffff90c6700b8000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4342     4342    11
--------------------------------------------------------------------------------------------------------------
HOST   DRIVER   Scsi_Host           shost_data          hostdata
host8  qla2xxx  0xffff90b78e5b6000  0xffff90b78e5b6980  0xffff90b78e5b69c0
--------------------------------------------------------------------------------------------------------------
Device  H:C:T:L     Scsi Device Addr    Vendor                        State         IO Req   IO Done  IO Error
sdk     [8:0:0:3]   0xffff90c67024d000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  4225132  4225132     3
sdl     [8:0:0:5]   0xffff90c670248000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  4866636  4866636     3
sdm     [8:0:0:23]  0xffff90c67024f000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  1713990  1713990     3
sdn     [8:0:1:3]   0xffff90c670249000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  4224919  4224919     3
sdo     [8:0:1:5]   0xffff90c654ecd000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  4872588  4872588     3
sdp     [8:0:1:23]  0xffff90c654ec8000  SUN     ZFS Storage 73501.0   SDEV_RUNNING  1710283  1710283     3
sdq     [8:0:2:3]   0xffff90c654eca000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4343     4343    11
sdr     [8:0:2:5]   0xffff90c654ecb000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4343     4343    11
sds     [8:0:2:23]  0xffff90c654ece000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4343     4343    11
sdt     [8:0:3:3]   0xffff90c654ecf000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4343     4343    11
sdv     [8:0:3:5]   0xffff90c654ec9000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4343     4343    11
sdx     [8:0:3:23]  0xffff90c654ecc000  SUN     ZFS Storage 73501.0   SDEV_RUNNING     4343     4343    11

Copy link
Member

@biger410 biger410 left a 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.

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
Copy link
Member

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.

@vashanmu
Copy link
Contributor Author

vashanmu commented May 23, 2025 via email

@vashanmu vashanmu force-pushed the main branch 2 times, most recently from 1c70166 to 20facfa Compare May 23, 2025 16:28
Copy link
Member

@biger410 biger410 left a 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

@biger410 biger410 merged commit 0873913 into oracle-samples:main May 27, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants